From 5dde6860a5f2a2f9584ec0c73682c9197590635e Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:26:55 -0700 Subject: [PATCH] [Darwin] The objc subscription callback bridge is leaked for single attribute subscriptions --- .github/workflows/darwin.yaml | 8 +- src/controller/CHIPCluster.h | 13 +- src/controller/ReadInteraction.h | 21 +- .../CHIP/templates/MTRBaseClusters-src.zapt | 8 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 23472 +++++++++------- 5 files changed, 13199 insertions(+), 10323 deletions(-) diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index cc3cec1fbf2f2e..73c1961edbc761 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -26,7 +26,7 @@ concurrency: jobs: darwin: name: Build Darwin - timeout-minutes: 120 + timeout-minutes: 210 if: github.actor != 'restyled-io[bot]' runs-on: macos-latest @@ -64,7 +64,7 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Run iOS Build Debug - timeout-minutes: 30 + timeout-minutes: 50 working-directory: src/darwin/Framework # For now disable unguarded-availability-new warnings because we # internally use APIs that we are annotating as only available on @@ -72,7 +72,7 @@ jobs: # target versions instead? run: xcodebuild -target "Matter" -sdk iphoneos OTHER_CFLAGS='${inherited} -Wno-unguarded-availability-new' - name: Run iOS Build Release - timeout-minutes: 30 + timeout-minutes: 50 working-directory: src/darwin/Framework # For now disable unguarded-availability-new warnings because we # internally use APIs that we are annotating as only available on @@ -86,7 +86,7 @@ jobs: run: defaults delete com.apple.dt.xctest.tool continue-on-error: true - name: Run macOS Build - timeout-minutes: 40 + timeout-minutes: 70 # Enable -Werror by hand here, because the Xcode config can't # enable it for various reasons. Keep whatever Xcode settings # for OTHER_CFLAGS exist by using ${inherited}. diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h index 747760e2f5ea32..99afac63a6bb03 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -52,6 +52,7 @@ using ReadResponseFailureCallback = void (*)(void * context, CHIP_ERROR err) using ReadDoneCallback = void (*)(void * context); using SubscriptionEstablishedCallback = void (*)(void * context); using ResubscriptionAttemptCallback = void (*)(void * context, CHIP_ERROR aError, uint32_t aNextResubscribeIntervalMsec); +using SubscriptionOnDoneCallback = std::function; class DLL_EXPORT ClusterBase { @@ -262,12 +263,13 @@ class DLL_EXPORT ClusterBase ReadResponseFailureCallback failureCb, uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds, SubscriptionEstablishedCallback subscriptionEstablishedCb = nullptr, ResubscriptionAttemptCallback resubscriptionAttemptCb = nullptr, bool aIsFabricFiltered = true, - bool aKeepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) + bool aKeepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional, + SubscriptionOnDoneCallback subscriptionDoneCb = nullptr) { return SubscribeAttribute( context, AttributeInfo::GetClusterId(), AttributeInfo::GetAttributeId(), reportCb, failureCb, minIntervalFloorSeconds, maxIntervalCeilingSeconds, subscriptionEstablishedCb, resubscriptionAttemptCb, aIsFabricFiltered, - aKeepPreviousSubscriptions, aDataVersion); + aKeepPreviousSubscriptions, aDataVersion, subscriptionDoneCb); } template @@ -276,8 +278,9 @@ class DLL_EXPORT ClusterBase uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds, SubscriptionEstablishedCallback subscriptionEstablishedCb = nullptr, ResubscriptionAttemptCallback resubscriptionAttemptCb = nullptr, bool aIsFabricFiltered = true, - bool aKeepPreviousSubscriptions = false, - const Optional & aDataVersion = NullOptional) + bool aKeepPreviousSubscriptions = false, + const Optional & aDataVersion = NullOptional, + SubscriptionOnDoneCallback subscriptionDoneCb = nullptr) { auto onReportCb = [context, reportCb](const app::ConcreteAttributePath & aPath, const DecodableType & aData) { if (reportCb != nullptr) @@ -311,7 +314,7 @@ class DLL_EXPORT ClusterBase return Controller::SubscribeAttribute( &mExchangeManager, mSession.Get().Value(), mEndpoint, clusterId, attributeId, onReportCb, onFailureCb, minIntervalFloorSeconds, maxIntervalCeilingSeconds, onSubscriptionEstablishedCb, onResubscriptionAttemptCb, - aIsFabricFiltered, aKeepPreviousSubscriptions, aDataVersion); + aIsFabricFiltered, aKeepPreviousSubscriptions, aDataVersion, subscriptionDoneCb); } /** diff --git a/src/controller/ReadInteraction.h b/src/controller/ReadInteraction.h index cc4838cfafad45..88c1f902121de6 100644 --- a/src/controller/ReadInteraction.h +++ b/src/controller/ReadInteraction.h @@ -27,6 +27,8 @@ namespace chip { namespace Controller { namespace detail { +using SubscriptionOnDoneCallback = std::function; + template struct ReportAttributeParams : public app::ReadPrepareParams { @@ -40,6 +42,7 @@ struct ReportAttributeParams : public app::ReadPrepareParams mOnSubscriptionEstablishedCb = nullptr; typename TypedReadAttributeCallback::OnResubscriptionAttemptCallbackType mOnResubscriptionAttemptCb = nullptr; + SubscriptionOnDoneCallback mOnDoneCb = nullptr; app::ReadClient::InteractionType mReportType = app::ReadClient::InteractionType::Read; }; @@ -63,7 +66,14 @@ CHIP_ERROR ReportAttribute(Messaging::ExchangeManager * exchangeMgr, EndpointId readParams.mpDataVersionFilterList = dataVersionFilters.get(); readParams.mDataVersionFilterListSize = 1; } - auto onDone = [](TypedReadAttributeCallback * callback) { chip::Platform::Delete(callback); }; + auto onDoneCb = readParams.mOnDoneCb; + auto onDone = [onDoneCb](TypedReadAttributeCallback * callback) { + if (onDoneCb) + { + onDoneCb(); + } + chip::Platform::Delete(callback); + }; auto callback = chip::Platform::MakeUnique>( clusterId, attributeId, readParams.mOnReportCb, readParams.mOnErrorCb, onDone, readParams.mOnSubscriptionEstablishedCb, @@ -151,13 +161,15 @@ CHIP_ERROR SubscribeAttribute( nullptr, typename TypedReadAttributeCallback::OnResubscriptionAttemptCallbackType onResubscriptionAttemptCb = nullptr, - bool fabricFiltered = true, bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) + bool fabricFiltered = true, bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional, + typename detail::SubscriptionOnDoneCallback onDoneCb = nullptr) { detail::ReportAttributeParams params(sessionHandle); params.mOnReportCb = onReportCb; params.mOnErrorCb = onErrorCb; params.mOnSubscriptionEstablishedCb = onSubscriptionEstablishedCb; params.mOnResubscriptionAttemptCb = onResubscriptionAttemptCb; + params.mOnDoneCb = onDoneCb; params.mMinIntervalFloorSeconds = minIntervalFloorSeconds; params.mMaxIntervalCeilingSeconds = maxIntervalCeilingSeconds; params.mKeepSubscriptions = keepPreviousSubscriptions; @@ -185,12 +197,13 @@ CHIP_ERROR SubscribeAttribute( onSubscriptionEstablishedCb = nullptr, typename TypedReadAttributeCallback::OnResubscriptionAttemptCallbackType onResubscriptionAttemptCb = nullptr, - bool fabricFiltered = true, bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) + bool fabricFiltered = true, bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional, + typename detail::SubscriptionOnDoneCallback onDoneCb = nullptr) { return SubscribeAttribute( exchangeMgr, sessionHandle, endpointId, AttributeTypeInfo::GetClusterId(), AttributeTypeInfo::GetAttributeId(), onReportCb, onErrorCb, aMinIntervalFloorSeconds, aMaxIntervalCeilingSeconds, onSubscriptionEstablishedCb, onResubscriptionAttemptCb, - fabricFiltered, keepPreviousSubscriptions, aDataVersion); + fabricFiltered, keepPreviousSubscriptions, aDataVersion, onDoneCb); } namespace detail { diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index c32c72be7e9b8c..9992ccc9606810 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt @@ -14,6 +14,7 @@ #include #include #include +#include using chip::Callback::Callback; using chip::Callback::Cancelable; @@ -189,7 +190,7 @@ subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEs minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTR{{>attribute_data_callback_name}}CallbackSubscriptionBridge(self.callbackQueue, + __block MTR{{>attribute_data_callback_name}}CallbackSubscriptionBridge * callbackBridge = new MTR{{>attribute_data_callback_name}}CallbackSubscriptionBridge(self.callbackQueue, self.device, {{! This treats reportHandler as taking an id for the data. This is not great from a type-safety perspective, of course. }} @@ -204,9 +205,12 @@ subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEs auto failureFn = Callback::FromCancelable(failure); chip::Controller::{{asUpperCamelCase parent.name}}Cluster cppCluster(exchangeManager, session, self->_endpoint); + MTR{{>attribute_data_callback_name}}CallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTR{{>attribute_data_callback_name}}CallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue] + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, + [innerCallbackBridge](void) { delete innerCallbackBridge; } ); }, subscriptionEstablishedHandler); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 8f5fec474c7a2b..230ce2c6928d0e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -28,6 +28,7 @@ #import "MTRCommandPayloadsObjc.h" #import "MTRStructsObjc.h" +#include #include #include #include @@ -173,7 +174,7 @@ - (void)subscribeAttributeIdentifyTimeWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -185,11 +186,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -242,7 +245,7 @@ - (void)subscribeAttributeIdentifyTypeWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -254,11 +257,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -313,25 +318,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRIdentifyGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Identify::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRIdentifyGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRIdentifyGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Identify::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRIdentifyGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRIdentifyGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRIdentifyGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -385,25 +393,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRIdentifyAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Identify::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRIdentifyAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRIdentifyAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Identify::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRIdentifyAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRIdentifyAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRIdentifyAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -455,25 +466,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRIdentifyAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Identify::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRIdentifyAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRIdentifyAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Identify::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRIdentifyAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRIdentifyAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRIdentifyAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -525,7 +539,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -537,11 +551,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -594,7 +610,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -606,11 +622,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -862,7 +880,7 @@ - (void)subscribeAttributeNameSupportWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -874,11 +892,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -933,25 +953,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Groups::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Groups::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -1005,25 +1028,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Groups::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Groups::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -1075,25 +1101,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Groups::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Groups::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -1144,7 +1173,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -1156,11 +1185,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -1213,7 +1244,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -1225,11 +1256,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -1721,7 +1754,7 @@ - (void)subscribeAttributeSceneCountWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -1733,11 +1766,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -1789,7 +1824,7 @@ - (void)subscribeAttributeCurrentSceneWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -1801,11 +1836,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -1858,7 +1895,7 @@ - (void)subscribeAttributeCurrentGroupWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -1870,11 +1907,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -1927,7 +1966,7 @@ - (void)subscribeAttributeSceneValidWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -1939,11 +1978,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -1995,7 +2036,7 @@ - (void)subscribeAttributeNameSupportWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2007,11 +2048,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -2065,25 +2108,28 @@ - (void)subscribeAttributeLastConfiguredByWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Scenes::Attributes::LastConfiguredBy::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Scenes::Attributes::LastConfiguredBy::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastConfiguredByWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2136,25 +2182,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRScenesGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Scenes::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRScenesGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRScenesGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Scenes::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRScenesGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRScenesGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRScenesGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2208,25 +2257,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRScenesAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Scenes::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRScenesAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRScenesAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Scenes::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRScenesAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRScenesAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRScenesAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2278,25 +2330,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRScenesAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Scenes::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRScenesAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRScenesAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Scenes::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRScenesAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRScenesAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRScenesAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2347,7 +2402,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2359,11 +2414,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -2416,7 +2473,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2428,11 +2485,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -2681,7 +2740,7 @@ - (void)subscribeAttributeOnOffWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2693,11 +2752,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -2750,7 +2811,7 @@ - (void)subscribeAttributeGlobalSceneControlWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2762,11 +2823,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -2856,7 +2919,7 @@ - (void)subscribeAttributeOnTimeWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2868,11 +2931,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -2962,7 +3027,7 @@ - (void)subscribeAttributeOffWaitTimeWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -2974,11 +3039,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -3074,25 +3141,28 @@ - (void)subscribeAttributeStartUpOnOffWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOff::Attributes::StartUpOnOff::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOff::Attributes::StartUpOnOff::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpOnOffWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3146,25 +3216,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROnOffGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOff::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROnOffGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROnOffGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOff::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROnOffGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROnOffGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROnOffGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3218,25 +3291,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROnOffAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOff::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROnOffAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROnOffAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOff::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROnOffAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROnOffAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROnOffAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3288,25 +3364,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROnOffAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOff::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROnOffAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROnOffAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOff::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROnOffAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROnOffAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROnOffAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3357,7 +3436,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -3369,11 +3448,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -3426,7 +3507,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -3438,11 +3519,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -3512,7 +3595,7 @@ - (void)subscribeAttributeSwitchTypeWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -3524,11 +3607,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -3619,7 +3704,7 @@ - (void)subscribeAttributeSwitchActionsWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -3631,11 +3716,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -3691,25 +3778,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROnOffSwitchConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOffSwitchConfiguration::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROnOffSwitchConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROnOffSwitchConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROnOffSwitchConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOffSwitchConfiguration::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROnOffSwitchConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROnOffSwitchConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3765,25 +3858,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROnOffSwitchConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOffSwitchConfiguration::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROnOffSwitchConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROnOffSwitchConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROnOffSwitchConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOffSwitchConfiguration::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROnOffSwitchConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROnOffSwitchConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3836,25 +3935,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OnOffSwitchConfiguration::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OnOffSwitchConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3906,7 +4009,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -3918,11 +4021,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -3975,7 +4080,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -3987,11 +4092,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OnOffSwitchConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4362,25 +4469,28 @@ - (void)subscribeAttributeCurrentLevelWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::CurrentLevel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::CurrentLevel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -4432,7 +4542,7 @@ - (void)subscribeAttributeRemainingTimeWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4444,11 +4554,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4501,7 +4613,7 @@ - (void)subscribeAttributeMinLevelWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4513,11 +4625,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4569,7 +4683,7 @@ - (void)subscribeAttributeMaxLevelWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4581,11 +4695,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4638,7 +4754,7 @@ - (void)subscribeAttributeCurrentFrequencyWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4650,11 +4766,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4707,7 +4825,7 @@ - (void)subscribeAttributeMinFrequencyWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4719,11 +4837,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4776,7 +4896,7 @@ - (void)subscribeAttributeMaxFrequencyWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4788,11 +4908,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4882,7 +5004,7 @@ - (void)subscribeAttributeOptionsWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -4894,11 +5016,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -4990,7 +5114,7 @@ - (void)subscribeAttributeOnOffTransitionTimeWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -5002,11 +5126,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -5101,25 +5227,28 @@ - (void)subscribeAttributeOnLevelWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::OnLevel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::OnLevel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOnLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5213,25 +5342,28 @@ - (void)subscribeAttributeOnTransitionTimeWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::OnTransitionTime::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::OnTransitionTime::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOnTransitionTimeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5326,25 +5458,28 @@ - (void)subscribeAttributeOffTransitionTimeWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::OffTransitionTime::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::OffTransitionTime::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOffTransitionTimeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5439,25 +5574,28 @@ - (void)subscribeAttributeDefaultMoveRateWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::DefaultMoveRate::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::DefaultMoveRate::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDefaultMoveRateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5553,25 +5691,28 @@ - (void)subscribeAttributeStartUpCurrentLevelWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::StartUpCurrentLevel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::StartUpCurrentLevel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpCurrentLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5624,25 +5765,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLevelControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLevelControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLevelControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLevelControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLevelControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLevelControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5696,25 +5840,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLevelControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLevelControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLevelControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLevelControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLevelControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLevelControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5766,25 +5913,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLevelControlAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LevelControl::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLevelControlAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLevelControlAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LevelControl::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLevelControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLevelControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLevelControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5836,7 +5986,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -5848,11 +5998,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -5905,7 +6057,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -5917,11 +6069,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6029,25 +6183,28 @@ - (void)subscribeAttributeActiveTextWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BinaryInputBasic::Attributes::ActiveText::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BinaryInputBasic::Attributes::ActiveText::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveTextWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6135,25 +6292,28 @@ - (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BinaryInputBasic::Attributes::Description::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BinaryInputBasic::Attributes::Description::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6242,25 +6402,28 @@ - (void)subscribeAttributeInactiveTextWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BinaryInputBasic::Attributes::InactiveText::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BinaryInputBasic::Attributes::InactiveText::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeInactiveTextWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6349,7 +6512,7 @@ - (void)subscribeAttributeOutOfServiceWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -6361,11 +6524,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6418,7 +6583,7 @@ - (void)subscribeAttributePolarityWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -6430,11 +6595,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6524,7 +6691,7 @@ - (void)subscribeAttributePresentValueWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -6536,11 +6703,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6631,7 +6800,7 @@ - (void)subscribeAttributeReliabilityWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -6643,11 +6812,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6700,7 +6871,7 @@ - (void)subscribeAttributeStatusFlagsWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -6712,11 +6883,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6770,7 +6943,7 @@ - (void)subscribeAttributeApplicationTypeWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -6782,11 +6955,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -6841,25 +7016,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BinaryInputBasic::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BinaryInputBasic::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6913,25 +7092,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BinaryInputBasic::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BinaryInputBasic::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6983,25 +7166,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBinaryInputBasicAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BinaryInputBasic::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBinaryInputBasicAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBinaryInputBasicAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BinaryInputBasic::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBinaryInputBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBinaryInputBasicAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBinaryInputBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7053,7 +7239,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -7065,11 +7251,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -7122,7 +7310,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -7134,11 +7322,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BinaryInputBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -7208,25 +7398,28 @@ - (void)subscribeAttributeDeviceListWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorDeviceTypeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::DeviceTypeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorDeviceTypeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorDeviceTypeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::DeviceTypeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorDeviceTypeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorDeviceTypeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorDeviceTypeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDeviceListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7277,25 +7470,28 @@ - (void)subscribeAttributeServerListWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorServerListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::ServerList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorServerListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorServerListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::ServerList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorServerListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorServerListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorServerListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeServerListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7345,25 +7541,28 @@ - (void)subscribeAttributeClientListWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorClientListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::ClientList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorClientListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorClientListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::ClientList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorClientListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorClientListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorClientListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeClientListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7413,25 +7612,28 @@ - (void)subscribeAttributePartsListWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorPartsListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::PartsList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorPartsListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorPartsListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::PartsList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorPartsListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorPartsListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorPartsListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartsListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7483,25 +7685,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7555,25 +7760,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7625,25 +7833,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDescriptorAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Descriptor::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDescriptorAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDescriptorAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Descriptor::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDescriptorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDescriptorAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDescriptorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7695,7 +7906,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -7707,11 +7918,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -7764,7 +7977,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -7776,11 +7989,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DescriptorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -7927,25 +8142,28 @@ - (void)subscribeAttributeBindingWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBindingBindingListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Binding::Attributes::Binding::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBindingBindingListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBindingBindingListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Binding::Attributes::Binding::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBindingBindingListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBindingBindingListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBindingBindingListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBindingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7997,25 +8215,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBindingGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Binding::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBindingGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBindingGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Binding::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBindingGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBindingGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBindingGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8069,25 +8290,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBindingAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Binding::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBindingAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBindingAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Binding::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBindingAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBindingAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBindingAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8139,25 +8363,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBindingAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Binding::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBindingAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBindingAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Binding::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBindingAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBindingAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBindingAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8208,7 +8435,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -8220,11 +8447,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -8277,7 +8506,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -8289,11 +8518,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BindingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -8501,25 +8732,28 @@ - (void)subscribeAttributeAclWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccessControlAclListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccessControl::Attributes::Acl::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccessControlAclListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccessControlAclListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccessControl::Attributes::Acl::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccessControlAclListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccessControlAclListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccessControlAclListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAclWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8631,25 +8865,28 @@ - (void)subscribeAttributeExtensionWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccessControlExtensionListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccessControl::Attributes::Extension::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccessControlExtensionListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccessControlExtensionListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccessControl::Attributes::Extension::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccessControlExtensionListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccessControlExtensionListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccessControlExtensionListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeExtensionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8702,7 +8939,7 @@ - (void)subscribeAttributeSubjectsPerAccessControlEntryWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -8714,11 +8951,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -8773,7 +9012,7 @@ - (void)subscribeAttributeTargetsPerAccessControlEntryWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -8785,11 +9024,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -8844,7 +9085,7 @@ - (void)subscribeAttributeAccessControlEntriesPerFabricWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -8856,11 +9097,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -8915,25 +9158,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccessControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccessControl::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccessControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccessControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccessControl::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccessControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccessControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccessControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8987,25 +9233,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccessControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccessControl::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccessControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccessControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccessControl::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccessControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccessControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccessControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9057,25 +9306,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccessControlAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccessControl::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccessControlAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccessControlAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccessControl::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccessControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccessControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccessControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9127,7 +9379,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -9139,11 +9391,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -9196,7 +9450,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -9208,11 +9462,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccessControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -9664,25 +9920,28 @@ - (void)subscribeAttributeActionListWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRActionsActionListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Actions::Attributes::ActionList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRActionsActionListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRActionsActionListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Actions::Attributes::ActionList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRActionsActionListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRActionsActionListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRActionsActionListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActionListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9732,25 +9991,28 @@ - (void)subscribeAttributeEndpointListsWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRActionsEndpointListsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Actions::Attributes::EndpointLists::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRActionsEndpointListsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRActionsEndpointListsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Actions::Attributes::EndpointLists::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRActionsEndpointListsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRActionsEndpointListsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRActionsEndpointListsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEndpointListsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9801,25 +10063,28 @@ - (void)subscribeAttributeSetupURLWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Actions::Attributes::SetupURL::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Actions::Attributes::SetupURL::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSetupURLWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9871,25 +10136,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRActionsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Actions::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRActionsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRActionsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Actions::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRActionsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRActionsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRActionsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9943,25 +10211,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRActionsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Actions::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRActionsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRActionsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Actions::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRActionsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRActionsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRActionsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10013,25 +10284,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRActionsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Actions::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRActionsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRActionsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Actions::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRActionsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRActionsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRActionsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10082,7 +10356,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10094,11 +10368,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -10151,7 +10427,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10163,11 +10439,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -10269,7 +10547,7 @@ - (void)subscribeAttributeDataModelRevisionWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10281,11 +10559,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -10338,25 +10618,28 @@ - (void)subscribeAttributeVendorNameWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::VendorName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::VendorName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10406,7 +10689,7 @@ - (void)subscribeAttributeVendorIDWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRVendorIdAttributeCallbackSubscriptionBridge( + __block MTRVendorIdAttributeCallbackSubscriptionBridge * callbackBridge = new MTRVendorIdAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10418,11 +10701,13 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -10474,25 +10759,28 @@ - (void)subscribeAttributeProductNameWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::ProductName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::ProductName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10543,7 +10831,7 @@ - (void)subscribeAttributeProductIDWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10555,11 +10843,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -10649,25 +10939,28 @@ - (void)subscribeAttributeNodeLabelWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::NodeLabel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::NodeLabel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNodeLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10755,25 +11048,28 @@ - (void)subscribeAttributeLocationWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::Location::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::Location::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10824,7 +11120,7 @@ - (void)subscribeAttributeHardwareVersionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10836,11 +11132,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -10895,25 +11193,28 @@ - (void)subscribeAttributeHardwareVersionStringWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::HardwareVersionString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::HardwareVersionString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeHardwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10965,7 +11266,7 @@ - (void)subscribeAttributeSoftwareVersionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -10977,11 +11278,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -11036,25 +11339,28 @@ - (void)subscribeAttributeSoftwareVersionStringWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::SoftwareVersionString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::SoftwareVersionString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSoftwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11106,25 +11412,28 @@ - (void)subscribeAttributeManufacturingDateWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::ManufacturingDate::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::ManufacturingDate::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeManufacturingDateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11175,25 +11484,28 @@ - (void)subscribeAttributePartNumberWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::PartNumber::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::PartNumber::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11243,25 +11555,28 @@ - (void)subscribeAttributeProductURLWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::ProductURL::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::ProductURL::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductURLWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11311,25 +11626,28 @@ - (void)subscribeAttributeProductLabelWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::ProductLabel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::ProductLabel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11380,25 +11698,28 @@ - (void)subscribeAttributeSerialNumberWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::SerialNumber::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::SerialNumber::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSerialNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11489,7 +11810,7 @@ - (void)subscribeAttributeLocalConfigDisabledWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -11501,11 +11822,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -11558,7 +11881,7 @@ - (void)subscribeAttributeReachableWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -11570,11 +11893,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -11626,25 +11951,28 @@ - (void)subscribeAttributeUniqueIDWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::UniqueID::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::UniqueID::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUniqueIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11695,25 +12023,28 @@ - (void)subscribeAttributeCapabilityMinimaWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBasicCapabilityMinimaStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::CapabilityMinima::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBasicCapabilityMinimaStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBasicCapabilityMinimaStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::CapabilityMinima::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBasicCapabilityMinimaStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBasicCapabilityMinimaStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBasicCapabilityMinimaStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCapabilityMinimaWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11767,25 +12098,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11839,25 +12173,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11909,25 +12246,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBasicAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Basic::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBasicAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBasicAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Basic::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBasicAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11978,7 +12318,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -11990,11 +12330,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -12047,7 +12389,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -12059,11 +12401,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -12257,25 +12601,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateProviderGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateProvider::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateProviderGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROtaSoftwareUpdateProviderGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateProviderGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateProvider::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateProviderGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateProviderGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12331,25 +12681,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateProviderAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateProvider::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateProviderAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROtaSoftwareUpdateProviderAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateProviderAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateProvider::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateProviderAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateProviderAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12402,25 +12758,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateProvider::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateProvider::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12472,7 +12832,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -12484,11 +12844,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -12541,7 +12903,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -12553,11 +12915,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -12729,25 +13093,31 @@ - (void)subscribeAttributeDefaultOtaProvidersWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateRequestorDefaultOtaProvidersListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateRequestorDefaultOtaProvidersListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROtaSoftwareUpdateRequestorDefaultOtaProvidersListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateRequestorDefaultOtaProvidersListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateRequestorDefaultOtaProvidersListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateRequestorDefaultOtaProvidersListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDefaultOtaProvidersWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12801,7 +13171,7 @@ - (void)subscribeAttributeUpdatePossibleWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -12813,11 +13183,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -12872,27 +13244,31 @@ - (void)subscribeAttributeUpdateStateWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateState::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateState::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUpdateStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12947,25 +13323,28 @@ - (void)subscribeAttributeUpdateStateProgressWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUpdateStateProgressWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13019,25 +13398,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateRequestorGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateRequestorGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROtaSoftwareUpdateRequestorGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateRequestorGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateRequestorGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateRequestorGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13093,25 +13478,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateRequestorAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateRequestorAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROtaSoftwareUpdateRequestorAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateRequestorAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateRequestorAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateRequestorAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13164,25 +13555,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13234,7 +13629,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -13246,11 +13641,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -13303,7 +13700,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -13315,11 +13712,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -13427,25 +13826,28 @@ - (void)subscribeAttributeActiveLocaleWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveLocaleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13497,25 +13899,29 @@ - (void)subscribeAttributeSupportedLocalesWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LocalizationConfiguration::Attributes::SupportedLocales::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LocalizationConfiguration::Attributes::SupportedLocales::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedLocalesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13570,25 +13976,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLocalizationConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LocalizationConfiguration::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLocalizationConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRLocalizationConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLocalizationConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LocalizationConfiguration::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLocalizationConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLocalizationConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13644,25 +14056,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLocalizationConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LocalizationConfiguration::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLocalizationConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRLocalizationConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLocalizationConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LocalizationConfiguration::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLocalizationConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLocalizationConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13715,25 +14133,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LocalizationConfiguration::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LocalizationConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13785,7 +14207,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -13797,11 +14219,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -13854,7 +14278,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -13866,11 +14290,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LocalizationConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -13978,25 +14404,29 @@ - (void)subscribeAttributeHourFormatWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TimeFormatLocalization::Attributes::HourFormat::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TimeFormatLocalization::Attributes::HourFormat::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeHourFormatWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14086,25 +14516,29 @@ - (void)subscribeAttributeActiveCalendarTypeWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TimeFormatLocalization::Attributes::ActiveCalendarType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TimeFormatLocalization::Attributes::ActiveCalendarType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveCalendarTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14159,25 +14593,31 @@ - (void)subscribeAttributeSupportedCalendarTypesWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTimeFormatLocalizationSupportedCalendarTypesListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TimeFormatLocalization::Attributes::SupportedCalendarTypes::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTimeFormatLocalizationSupportedCalendarTypesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRTimeFormatLocalizationSupportedCalendarTypesListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTimeFormatLocalizationSupportedCalendarTypesListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TimeFormatLocalization::Attributes::SupportedCalendarTypes::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTimeFormatLocalizationSupportedCalendarTypesListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationSupportedCalendarTypesListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedCalendarTypesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14232,25 +14672,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TimeFormatLocalization::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TimeFormatLocalization::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14304,25 +14748,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TimeFormatLocalization::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TimeFormatLocalization::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14374,25 +14822,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TimeFormatLocalization::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TimeFormatLocalization::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14444,7 +14896,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -14456,11 +14908,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -14513,7 +14967,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -14525,11 +14979,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TimeFormatLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -14638,25 +15094,28 @@ - (void)subscribeAttributeTemperatureUnitWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUnitLocalizationClusterTempUnitAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UnitLocalization::Attributes::TemperatureUnit::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUnitLocalizationClusterTempUnitAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUnitLocalizationClusterTempUnitAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UnitLocalization::Attributes::TemperatureUnit::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUnitLocalizationClusterTempUnitAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUnitLocalizationClusterTempUnitAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUnitLocalizationClusterTempUnitAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTemperatureUnitWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14710,25 +15169,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UnitLocalization::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UnitLocalization::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14782,25 +15245,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UnitLocalization::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UnitLocalization::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14852,25 +15319,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUnitLocalizationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UnitLocalization::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUnitLocalizationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUnitLocalizationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UnitLocalization::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUnitLocalizationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUnitLocalizationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUnitLocalizationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14922,7 +15392,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -14934,11 +15404,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -14991,7 +15463,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -15003,11 +15475,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::UnitLocalizationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -15076,25 +15550,28 @@ - (void)subscribeAttributeSourcesWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceConfigurationSourcesListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSourceConfiguration::Attributes::Sources::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceConfigurationSourcesListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceConfigurationSourcesListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSourceConfiguration::Attributes::Sources::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceConfigurationSourcesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceConfigurationSourcesListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceConfigurationSourcesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSourcesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15148,25 +15625,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSourceConfiguration::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPowerSourceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSourceConfiguration::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15222,25 +15705,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSourceConfiguration::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPowerSourceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSourceConfiguration::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15293,25 +15782,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSourceConfiguration::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSourceConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15363,7 +15856,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -15375,11 +15868,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -15432,7 +15927,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -15444,11 +15939,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -15517,25 +16014,28 @@ - (void)subscribeAttributeStatusWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceClusterPowerSourceStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::Status::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceClusterPowerSourceStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceClusterPowerSourceStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::Status::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceClusterPowerSourceStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceClusterPowerSourceStatusAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceClusterPowerSourceStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15585,7 +16085,7 @@ - (void)subscribeAttributeOrderWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -15597,11 +16097,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -15653,25 +16155,28 @@ - (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::Description::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::Description::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15724,25 +16229,28 @@ - (void)subscribeAttributeWiredAssessedInputVoltageWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::WiredAssessedInputVoltage::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::WiredAssessedInputVoltage::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredAssessedInputVoltageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15795,25 +16303,28 @@ - (void)subscribeAttributeWiredAssessedInputFrequencyWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::WiredAssessedInputFrequency::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::WiredAssessedInputFrequency::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredAssessedInputFrequencyWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15865,25 +16376,28 @@ - (void)subscribeAttributeWiredCurrentTypeWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceClusterWiredCurrentTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::WiredCurrentType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceClusterWiredCurrentTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceClusterWiredCurrentTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::WiredCurrentType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceClusterWiredCurrentTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceClusterWiredCurrentTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceClusterWiredCurrentTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredCurrentTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15937,25 +16451,28 @@ - (void)subscribeAttributeWiredAssessedCurrentWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::WiredAssessedCurrent::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::WiredAssessedCurrent::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredAssessedCurrentWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16008,7 +16525,7 @@ - (void)subscribeAttributeWiredNominalVoltageWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -16020,11 +16537,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -16079,7 +16598,7 @@ - (void)subscribeAttributeWiredMaximumCurrentWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -16091,11 +16610,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -16148,7 +16669,7 @@ - (void)subscribeAttributeWiredPresentWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -16160,11 +16681,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -16218,25 +16741,28 @@ - (void)subscribeAttributeActiveWiredFaultsWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceActiveWiredFaultsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::ActiveWiredFaults::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceActiveWiredFaultsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceActiveWiredFaultsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::ActiveWiredFaults::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceActiveWiredFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceActiveWiredFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceActiveWiredFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveWiredFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16288,25 +16814,28 @@ - (void)subscribeAttributeBatVoltageWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatVoltage::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatVoltage::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatVoltageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16358,25 +16887,28 @@ - (void)subscribeAttributeBatPercentRemainingWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatPercentRemaining::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatPercentRemaining::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatPercentRemainingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16428,25 +16960,28 @@ - (void)subscribeAttributeBatTimeRemainingWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatTimeRemaining::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatTimeRemaining::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatTimeRemainingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16498,25 +17033,28 @@ - (void)subscribeAttributeBatChargeLevelWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceClusterBatChargeLevelAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatChargeLevel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceClusterBatChargeLevelAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceClusterBatChargeLevelAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatChargeLevel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceClusterBatChargeLevelAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceClusterBatChargeLevelAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceClusterBatChargeLevelAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatChargeLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16570,7 +17108,7 @@ - (void)subscribeAttributeBatReplacementNeededWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -16582,11 +17120,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -16640,25 +17180,28 @@ - (void)subscribeAttributeBatReplaceabilityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceClusterBatReplaceabilityAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatReplaceability::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceClusterBatReplaceabilityAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceClusterBatReplaceabilityAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatReplaceability::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceClusterBatReplaceabilityAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceClusterBatReplaceabilityAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceClusterBatReplaceabilityAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatReplaceabilityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16710,7 +17253,7 @@ - (void)subscribeAttributeBatPresentWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -16722,11 +17265,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -16779,25 +17324,28 @@ - (void)subscribeAttributeActiveBatFaultsWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceActiveBatFaultsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::ActiveBatFaults::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceActiveBatFaultsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceActiveBatFaultsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::ActiveBatFaults::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceActiveBatFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceActiveBatFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceActiveBatFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveBatFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16851,25 +17399,28 @@ - (void)subscribeAttributeBatReplacementDescriptionWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatReplacementDescription::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatReplacementDescription::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatReplacementDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16922,7 +17473,7 @@ - (void)subscribeAttributeBatCommonDesignationWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -16934,11 +17485,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -16992,25 +17545,28 @@ - (void)subscribeAttributeBatANSIDesignationWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatANSIDesignation::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatANSIDesignation::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatANSIDesignationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17062,25 +17618,28 @@ - (void)subscribeAttributeBatIECDesignationWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatIECDesignation::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatIECDesignation::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatIECDesignationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17133,7 +17692,7 @@ - (void)subscribeAttributeBatApprovedChemistryWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -17145,11 +17704,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -17202,7 +17763,7 @@ - (void)subscribeAttributeBatCapacityWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -17214,11 +17775,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -17271,7 +17834,7 @@ - (void)subscribeAttributeBatQuantityWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -17283,11 +17846,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -17341,25 +17906,28 @@ - (void)subscribeAttributeBatChargeStateWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceClusterBatChargeStateAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatChargeState::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceClusterBatChargeStateAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceClusterBatChargeStateAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatChargeState::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceClusterBatChargeStateAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceClusterBatChargeStateAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceClusterBatChargeStateAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatChargeStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17413,25 +17981,28 @@ - (void)subscribeAttributeBatTimeToFullChargeWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatTimeToFullCharge::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatTimeToFullCharge::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatTimeToFullChargeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17484,7 +18055,7 @@ - (void)subscribeAttributeBatFunctionalWhileChargingWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -17496,11 +18067,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -17554,25 +18127,28 @@ - (void)subscribeAttributeBatChargingCurrentWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::BatChargingCurrent::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::BatChargingCurrent::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatChargingCurrentWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17625,25 +18201,28 @@ - (void)subscribeAttributeActiveBatChargeFaultsWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceActiveBatChargeFaultsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::ActiveBatChargeFaults::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceActiveBatChargeFaultsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceActiveBatChargeFaultsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::ActiveBatChargeFaults::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceActiveBatChargeFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceActiveBatChargeFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceActiveBatChargeFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveBatChargeFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17697,25 +18276,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17769,25 +18351,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17839,25 +18424,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPowerSourceAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PowerSource::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPowerSourceAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPowerSourceAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PowerSource::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPowerSourceAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPowerSourceAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPowerSourceAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17909,7 +18497,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -17921,11 +18509,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -17978,7 +18568,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -17990,11 +18580,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PowerSourceCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -18189,7 +18781,7 @@ - (void)subscribeAttributeBreadcrumbWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -18201,11 +18793,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -18261,25 +18855,31 @@ new MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackBridge(s minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralCommissioning::Attributes::BasicCommissioningInfo::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralCommissioning::Attributes::BasicCommissioningInfo::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralCommissioningBasicCommissioningInfoStructAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBasicCommissioningInfoWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18335,25 +18935,31 @@ - (void)subscribeAttributeRegulatoryConfigWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralCommissioning::Attributes::RegulatoryConfig::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralCommissioning::Attributes::RegulatoryConfig::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRegulatoryConfigWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18408,25 +19014,31 @@ - (void)subscribeAttributeLocationCapabilityWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralCommissioning::Attributes::LocationCapability::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralCommissioning::Attributes::LocationCapability::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocationCapabilityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18481,7 +19093,7 @@ - (void)subscribeAttributeSupportsConcurrentConnectionWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -18493,11 +19105,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -18552,25 +19166,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralCommissioning::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralCommissioning::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18624,25 +19242,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralCommissioning::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralCommissioning::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18694,25 +19316,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralCommissioningAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralCommissioning::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralCommissioningAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralCommissioningAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralCommissioning::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralCommissioningAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18764,7 +19389,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -18776,11 +19401,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -18833,7 +19460,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -18845,11 +19472,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -19105,7 +19734,7 @@ - (void)subscribeAttributeMaxNetworksWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -19117,11 +19746,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -19173,25 +19804,28 @@ - (void)subscribeAttributeNetworksWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNetworkCommissioningNetworksListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::Networks::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNetworkCommissioningNetworksListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNetworkCommissioningNetworksListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::Networks::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNetworkCommissioningNetworksListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNetworkCommissioningNetworksListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNetworkCommissioningNetworksListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNetworksWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19243,7 +19877,7 @@ - (void)subscribeAttributeScanMaxTimeSecondsWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -19255,11 +19889,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -19314,7 +19950,7 @@ - (void)subscribeAttributeConnectMaxTimeSecondsWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -19326,11 +19962,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -19422,7 +20060,7 @@ - (void)subscribeAttributeInterfaceEnabledWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -19434,11 +20072,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -19495,27 +20135,33 @@ - (void)subscribeAttributeLastNetworkingStatusWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableNetworkCommissioningClusterNetworkCommissioningStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::LastNetworkingStatus::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableNetworkCommissioningClusterNetworkCommissioningStatusAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRNullableNetworkCommissioningClusterNetworkCommissioningStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableNetworkCommissioningClusterNetworkCommissioningStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::LastNetworkingStatus::TypeInfo; + auto successFn + = Callback::FromCancelable( + success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableNetworkCommissioningClusterNetworkCommissioningStatusAttributeCallbackSubscriptionBridge * + innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableNetworkCommissioningClusterNetworkCommissioningStatusAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastNetworkingStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19569,25 +20215,28 @@ - (void)subscribeAttributeLastNetworkIDWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::LastNetworkID::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableOctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::LastNetworkID::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableOctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastNetworkIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19640,25 +20289,28 @@ - (void)subscribeAttributeLastConnectErrorValueWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::LastConnectErrorValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::LastConnectErrorValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastConnectErrorValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19711,25 +20363,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19783,25 +20439,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19853,25 +20513,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNetworkCommissioningAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = NetworkCommissioning::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNetworkCommissioningAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNetworkCommissioningAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = NetworkCommissioning::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNetworkCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNetworkCommissioningAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNetworkCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19923,7 +20586,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -19935,11 +20598,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -19992,7 +20657,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20004,11 +20669,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20108,25 +20775,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDiagnosticLogsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DiagnosticLogs::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDiagnosticLogsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDiagnosticLogsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DiagnosticLogs::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDiagnosticLogsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDiagnosticLogsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDiagnosticLogsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20180,25 +20850,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDiagnosticLogsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DiagnosticLogs::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDiagnosticLogsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDiagnosticLogsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DiagnosticLogs::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDiagnosticLogsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDiagnosticLogsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDiagnosticLogsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20250,25 +20923,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DiagnosticLogs::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DiagnosticLogs::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDiagnosticLogsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20320,7 +20996,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20332,11 +21008,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20389,7 +21067,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20401,11 +21079,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20505,25 +21185,29 @@ - (void)subscribeAttributeNetworkInterfacesWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::NetworkInterfaces::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::NetworkInterfaces::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNetworkInterfacesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20575,7 +21259,7 @@ - (void)subscribeAttributeRebootCountWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20587,11 +21271,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20643,7 +21329,7 @@ - (void)subscribeAttributeUpTimeWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20655,11 +21341,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20713,7 +21401,7 @@ - (void)subscribeAttributeTotalOperationalHoursWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20725,11 +21413,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20782,7 +21472,7 @@ - (void)subscribeAttributeBootReasonsWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -20794,11 +21484,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -20853,25 +21545,29 @@ - (void)subscribeAttributeActiveHardwareFaultsWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::ActiveHardwareFaults::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::ActiveHardwareFaults::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveHardwareFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20924,25 +21620,29 @@ - (void)subscribeAttributeActiveRadioFaultsWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::ActiveRadioFaults::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::ActiveRadioFaults::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveRadioFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20996,25 +21696,29 @@ - (void)subscribeAttributeActiveNetworkFaultsWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::ActiveNetworkFaults::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::ActiveNetworkFaults::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveNetworkFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21068,7 +21772,7 @@ - (void)subscribeAttributeTestEventTriggersEnabledWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -21080,11 +21784,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -21139,25 +21845,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21211,25 +21921,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21281,25 +21995,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GeneralDiagnostics::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GeneralDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21351,7 +22068,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -21363,11 +22080,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -21420,7 +22139,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -21432,11 +22151,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -21537,25 +22258,28 @@ - (void)subscribeAttributeThreadMetricsWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSoftwareDiagnosticsThreadMetricsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = SoftwareDiagnostics::Attributes::ThreadMetrics::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSoftwareDiagnosticsThreadMetricsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSoftwareDiagnosticsThreadMetricsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = SoftwareDiagnostics::Attributes::ThreadMetrics::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSoftwareDiagnosticsThreadMetricsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSoftwareDiagnosticsThreadMetricsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSoftwareDiagnosticsThreadMetricsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeThreadMetricsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21608,7 +22332,7 @@ - (void)subscribeAttributeCurrentHeapFreeWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -21620,11 +22344,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -21678,7 +22404,7 @@ - (void)subscribeAttributeCurrentHeapUsedWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -21690,11 +22416,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -21749,7 +22477,7 @@ - (void)subscribeAttributeCurrentHeapHighWatermarkWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -21761,11 +22489,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -21820,25 +22550,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = SoftwareDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = SoftwareDiagnostics::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21892,25 +22626,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = SoftwareDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = SoftwareDiagnostics::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21962,25 +22700,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSoftwareDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = SoftwareDiagnostics::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSoftwareDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSoftwareDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = SoftwareDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSoftwareDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSoftwareDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSoftwareDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22032,7 +22773,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -22044,11 +22785,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -22101,7 +22844,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -22113,11 +22856,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -22217,25 +22962,28 @@ - (void)subscribeAttributeChannelWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::Channel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::Channel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22286,25 +23034,31 @@ - (void)subscribeAttributeRoutingRoleWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RoutingRole::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::RoutingRole::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRoutingRoleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22357,25 +23111,28 @@ - (void)subscribeAttributeNetworkNameWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::NetworkName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::NetworkName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNetworkNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22425,25 +23182,28 @@ - (void)subscribeAttributePanIdWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PanId::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::PanId::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePanIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22494,25 +23254,28 @@ - (void)subscribeAttributeExtendedPanIdWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ExtendedPanId::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::ExtendedPanId::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeExtendedPanIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22564,25 +23327,28 @@ - (void)subscribeAttributeMeshLocalPrefixWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableOctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableOctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeshLocalPrefixWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22633,7 +23399,7 @@ - (void)subscribeAttributeOverrunCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -22645,11 +23411,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -22703,25 +23471,29 @@ - (void)subscribeAttributeNeighborTableListWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::NeighborTableList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::NeighborTableList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNeighborTableListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22774,25 +23546,29 @@ - (void)subscribeAttributeRouteTableListWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::RouteTableList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::RouteTableList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRouteTableListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22844,25 +23620,28 @@ - (void)subscribeAttributePartitionIdWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PartitionId::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::PartitionId::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartitionIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22913,25 +23692,28 @@ - (void)subscribeAttributeWeightingWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::Weighting::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::Weighting::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWeightingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22981,25 +23763,28 @@ - (void)subscribeAttributeDataVersionWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::DataVersion::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::DataVersion::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDataVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -23051,25 +23836,28 @@ - (void)subscribeAttributeStableDataVersionWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::StableDataVersion::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::StableDataVersion::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStableDataVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -23121,25 +23909,28 @@ - (void)subscribeAttributeLeaderRouterIdWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::LeaderRouterId::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::LeaderRouterId::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLeaderRouterIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -23191,7 +23982,7 @@ - (void)subscribeAttributeDetachedRoleCountWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23203,11 +23994,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23261,7 +24054,7 @@ - (void)subscribeAttributeChildRoleCountWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23273,11 +24066,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23331,7 +24126,7 @@ - (void)subscribeAttributeRouterRoleCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23343,11 +24138,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23401,7 +24198,7 @@ - (void)subscribeAttributeLeaderRoleCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23413,11 +24210,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23471,7 +24270,7 @@ - (void)subscribeAttributeAttachAttemptCountWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23483,11 +24282,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23542,7 +24343,7 @@ - (void)subscribeAttributePartitionIdChangeCountWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23554,11 +24355,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23613,7 +24416,7 @@ - (void)subscribeAttributeBetterPartitionAttachAttemptCountWithMinInterval:(NSNu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23625,11 +24428,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23683,7 +24488,7 @@ - (void)subscribeAttributeParentChangeCountWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23695,11 +24500,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23752,7 +24559,7 @@ - (void)subscribeAttributeTxTotalCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23764,11 +24571,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23822,7 +24631,7 @@ - (void)subscribeAttributeTxUnicastCountWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23834,11 +24643,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23892,7 +24703,7 @@ - (void)subscribeAttributeTxBroadcastCountWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23904,11 +24715,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -23963,7 +24776,7 @@ - (void)subscribeAttributeTxAckRequestedCountWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -23975,11 +24788,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24032,7 +24847,7 @@ - (void)subscribeAttributeTxAckedCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24044,11 +24859,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24103,7 +24920,7 @@ - (void)subscribeAttributeTxNoAckRequestedCountWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24115,11 +24932,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24172,7 +24991,7 @@ - (void)subscribeAttributeTxDataCountWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24184,11 +25003,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24242,7 +25063,7 @@ - (void)subscribeAttributeTxDataPollCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24254,11 +25075,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24312,7 +25135,7 @@ - (void)subscribeAttributeTxBeaconCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24324,11 +25147,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24383,7 +25208,7 @@ - (void)subscribeAttributeTxBeaconRequestCountWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24395,11 +25220,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24452,7 +25279,7 @@ - (void)subscribeAttributeTxOtherCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24464,11 +25291,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24521,7 +25350,7 @@ - (void)subscribeAttributeTxRetryCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24533,11 +25362,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24592,7 +25423,7 @@ - (void)subscribeAttributeTxDirectMaxRetryExpiryCountWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24604,11 +25435,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24663,7 +25496,7 @@ - (void)subscribeAttributeTxIndirectMaxRetryExpiryCountWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24675,11 +25508,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24733,7 +25568,7 @@ - (void)subscribeAttributeTxErrCcaCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24745,11 +25580,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24803,7 +25640,7 @@ - (void)subscribeAttributeTxErrAbortCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24815,11 +25652,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24874,7 +25713,7 @@ - (void)subscribeAttributeTxErrBusyChannelCountWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24886,11 +25725,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -24943,7 +25784,7 @@ - (void)subscribeAttributeRxTotalCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -24955,11 +25796,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25013,7 +25856,7 @@ - (void)subscribeAttributeRxUnicastCountWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25025,11 +25868,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25083,7 +25928,7 @@ - (void)subscribeAttributeRxBroadcastCountWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25095,11 +25940,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25152,7 +25999,7 @@ - (void)subscribeAttributeRxDataCountWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25164,11 +26011,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25222,7 +26071,7 @@ - (void)subscribeAttributeRxDataPollCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25234,11 +26083,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25292,7 +26143,7 @@ - (void)subscribeAttributeRxBeaconCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25304,11 +26155,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25363,7 +26216,7 @@ - (void)subscribeAttributeRxBeaconRequestCountWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25375,11 +26228,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25432,7 +26287,7 @@ - (void)subscribeAttributeRxOtherCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25444,11 +26299,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25503,7 +26360,7 @@ - (void)subscribeAttributeRxAddressFilteredCountWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25515,11 +26372,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25574,7 +26433,7 @@ - (void)subscribeAttributeRxDestAddrFilteredCountWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25586,11 +26445,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25644,7 +26505,7 @@ - (void)subscribeAttributeRxDuplicatedCountWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25656,11 +26517,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25714,7 +26577,7 @@ - (void)subscribeAttributeRxErrNoFrameCountWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25726,11 +26589,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25785,7 +26650,7 @@ - (void)subscribeAttributeRxErrUnknownNeighborCountWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25797,11 +26662,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25856,7 +26723,7 @@ - (void)subscribeAttributeRxErrInvalidSrcAddrCountWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25868,11 +26735,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25926,7 +26795,7 @@ - (void)subscribeAttributeRxErrSecCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -25938,11 +26807,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -25996,7 +26867,7 @@ - (void)subscribeAttributeRxErrFcsCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -26008,11 +26879,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -26066,7 +26939,7 @@ - (void)subscribeAttributeRxErrOtherCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -26078,11 +26951,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -26136,25 +27011,28 @@ - (void)subscribeAttributeActiveTimestampWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveTimestampWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26206,25 +27084,28 @@ - (void)subscribeAttributePendingTimestampWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePendingTimestampWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26274,25 +27155,28 @@ - (void)subscribeAttributeDelayWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDelayWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26344,25 +27228,29 @@ - (void)subscribeAttributeSecurityPolicyWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::SecurityPolicy::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::SecurityPolicy::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSecurityPolicyWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26415,25 +27303,28 @@ - (void)subscribeAttributeChannelPage0MaskWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ChannelPage0Mask::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableOctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::ChannelPage0Mask::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableOctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelPage0MaskWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26492,27 +27383,33 @@ new MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallba minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::TypeInfo; + auto successFn + = Callback::FromCancelable( + success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallbackSubscriptionBridge * + innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsOperationalDatasetComponentsStructAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void) @@ -26573,27 +27470,31 @@ - (void)subscribeAttributeActiveNetworkFaultsListWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveNetworkFaultsListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26649,25 +27550,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThreadNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26723,25 +27630,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThreadNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26794,25 +27707,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThreadNetworkDiagnostics::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThreadNetworkDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26864,7 +27781,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -26876,11 +27793,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -26933,7 +27852,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -26945,11 +27864,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -27049,25 +27970,28 @@ - (void)subscribeAttributeBssidWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::Bssid::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableOctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::Bssid::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableOctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBssidWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27118,25 +28042,31 @@ - (void)subscribeAttributeSecurityTypeWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::SecurityType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::SecurityType::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSecurityTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27191,27 +28121,31 @@ - (void)subscribeAttributeWiFiVersionWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::WiFiVersion::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::WiFiVersion::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiFiVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27265,25 +28199,28 @@ - (void)subscribeAttributeChannelNumberWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::ChannelNumber::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::ChannelNumber::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27333,25 +28270,28 @@ - (void)subscribeAttributeRssiWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::Rssi::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::Rssi::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRssiWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27402,25 +28342,28 @@ - (void)subscribeAttributeBeaconLostCountWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::BeaconLostCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::BeaconLostCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBeaconLostCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27472,25 +28415,28 @@ - (void)subscribeAttributeBeaconRxCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::BeaconRxCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::BeaconRxCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBeaconRxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27543,25 +28489,28 @@ - (void)subscribeAttributePacketMulticastRxCountWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketMulticastRxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27614,25 +28563,28 @@ - (void)subscribeAttributePacketMulticastTxCountWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketMulticastTxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27685,25 +28637,28 @@ - (void)subscribeAttributePacketUnicastRxCountWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketUnicastRxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27756,25 +28711,28 @@ - (void)subscribeAttributePacketUnicastTxCountWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketUnicastTxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27826,25 +28784,28 @@ - (void)subscribeAttributeCurrentMaxRateWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentMaxRateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27895,25 +28856,28 @@ - (void)subscribeAttributeOverrunCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::OverrunCount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOverrunCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27966,25 +28930,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28038,25 +29006,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28108,25 +29080,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WiFiNetworkDiagnostics::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WiFiNetworkDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28178,7 +29154,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28190,11 +29166,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28247,7 +29225,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28259,11 +29237,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28365,27 +29345,31 @@ - (void)subscribeAttributePHYRateWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = EthernetNetworkDiagnostics::Attributes::PHYRate::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = EthernetNetworkDiagnostics::Attributes::PHYRate::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePHYRateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28437,25 +29421,28 @@ - (void)subscribeAttributeFullDuplexWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableBooleanAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = EthernetNetworkDiagnostics::Attributes::FullDuplex::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableBooleanAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableBooleanAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = EthernetNetworkDiagnostics::Attributes::FullDuplex::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFullDuplexWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28506,7 +29493,7 @@ - (void)subscribeAttributePacketRxCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28518,11 +29505,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28576,7 +29565,7 @@ - (void)subscribeAttributePacketTxCountWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28588,11 +29577,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28645,7 +29636,7 @@ - (void)subscribeAttributeTxErrCountWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28657,11 +29648,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28714,7 +29707,7 @@ - (void)subscribeAttributeCollisionCountWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28726,11 +29719,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28783,7 +29778,7 @@ - (void)subscribeAttributeOverrunCountWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28795,11 +29790,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28853,25 +29850,28 @@ - (void)subscribeAttributeCarrierDetectWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableBooleanAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = EthernetNetworkDiagnostics::Attributes::CarrierDetect::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableBooleanAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableBooleanAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = EthernetNetworkDiagnostics::Attributes::CarrierDetect::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCarrierDetectWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28923,7 +29923,7 @@ - (void)subscribeAttributeTimeSinceResetWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -28935,11 +29935,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -28995,25 +29997,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTREthernetNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTREthernetNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTREthernetNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTREthernetNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTREthernetNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTREthernetNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29069,25 +30077,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTREthernetNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTREthernetNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTREthernetNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTREthernetNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTREthernetNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTREthernetNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29140,25 +30154,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = EthernetNetworkDiagnostics::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = EthernetNetworkDiagnostics::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29210,7 +30228,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -29222,11 +30240,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -29279,7 +30299,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -29291,11 +30311,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -29365,25 +30387,28 @@ - (void)subscribeAttributeVendorNameWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::VendorName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::VendorName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29433,7 +30458,7 @@ - (void)subscribeAttributeVendorIDWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRVendorIdAttributeCallbackSubscriptionBridge( + __block MTRVendorIdAttributeCallbackSubscriptionBridge * callbackBridge = new MTRVendorIdAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -29445,11 +30470,13 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -29501,25 +30528,28 @@ - (void)subscribeAttributeProductNameWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::ProductName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::ProductName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29608,25 +30638,28 @@ - (void)subscribeAttributeNodeLabelWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::NodeLabel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::NodeLabel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNodeLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29677,7 +30710,7 @@ - (void)subscribeAttributeHardwareVersionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -29689,11 +30722,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -29748,25 +30783,28 @@ - (void)subscribeAttributeHardwareVersionStringWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::HardwareVersionString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::HardwareVersionString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeHardwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29818,7 +30856,7 @@ - (void)subscribeAttributeSoftwareVersionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -29830,11 +30868,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -29889,25 +30929,28 @@ - (void)subscribeAttributeSoftwareVersionStringWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::SoftwareVersionString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::SoftwareVersionString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSoftwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29959,25 +31002,28 @@ - (void)subscribeAttributeManufacturingDateWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::ManufacturingDate::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::ManufacturingDate::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeManufacturingDateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30028,25 +31074,28 @@ - (void)subscribeAttributePartNumberWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::PartNumber::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::PartNumber::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30096,25 +31145,28 @@ - (void)subscribeAttributeProductURLWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::ProductURL::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::ProductURL::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductURLWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30164,25 +31216,28 @@ - (void)subscribeAttributeProductLabelWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::ProductLabel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::ProductLabel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30233,25 +31288,28 @@ - (void)subscribeAttributeSerialNumberWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::SerialNumber::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::SerialNumber::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSerialNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30302,7 +31360,7 @@ - (void)subscribeAttributeReachableWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -30314,11 +31372,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -30370,25 +31430,28 @@ - (void)subscribeAttributeUniqueIDWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::UniqueID::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::UniqueID::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUniqueIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30440,25 +31503,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30512,25 +31579,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30582,25 +31653,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBridgedDeviceBasicAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BridgedDeviceBasic::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBridgedDeviceBasicAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBridgedDeviceBasicAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BridgedDeviceBasic::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBridgedDeviceBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBridgedDeviceBasicAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBridgedDeviceBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30652,7 +31726,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -30664,11 +31738,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -30721,7 +31797,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -30733,11 +31809,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BridgedDeviceBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -30808,7 +31886,7 @@ - (void)subscribeAttributeNumberOfPositionsWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -30820,11 +31898,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -30878,7 +31958,7 @@ - (void)subscribeAttributeCurrentPositionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -30890,11 +31970,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -30948,7 +32030,7 @@ - (void)subscribeAttributeMultiPressMaxWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -30960,11 +32042,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -31019,25 +32103,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSwitchGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Switch::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSwitchGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSwitchGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Switch::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSwitchGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSwitchGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSwitchGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31091,25 +32178,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSwitchAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Switch::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSwitchAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSwitchAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Switch::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSwitchAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSwitchAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSwitchAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31161,25 +32251,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRSwitchAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Switch::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRSwitchAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRSwitchAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Switch::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRSwitchAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRSwitchAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRSwitchAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31230,7 +32323,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -31242,11 +32335,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -31299,7 +32394,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -31311,11 +32406,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::SwitchCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -31487,27 +32584,33 @@ - (void)subscribeAttributeWindowStatusWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AdministratorCommissioning::Attributes::WindowStatus::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AdministratorCommissioning::Attributes::WindowStatus::TypeInfo; + auto successFn + = Callback::FromCancelable( + success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackSubscriptionBridge * + innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWindowStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31562,25 +32665,28 @@ - (void)subscribeAttributeAdminFabricIndexWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AdministratorCommissioning::Attributes::AdminFabricIndex::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AdministratorCommissioning::Attributes::AdminFabricIndex::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAdminFabricIndexWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31632,25 +32738,28 @@ - (void)subscribeAttributeAdminVendorIdWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AdministratorCommissioning::Attributes::AdminVendorId::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AdministratorCommissioning::Attributes::AdminVendorId::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAdminVendorIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31704,25 +32813,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAdministratorCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AdministratorCommissioning::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAdministratorCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRAdministratorCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAdministratorCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AdministratorCommissioning::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAdministratorCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAdministratorCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31778,25 +32893,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAdministratorCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AdministratorCommissioning::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAdministratorCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRAdministratorCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAdministratorCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AdministratorCommissioning::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAdministratorCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAdministratorCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31849,25 +32970,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AdministratorCommissioning::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AdministratorCommissioning::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31919,7 +33044,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -31931,11 +33056,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -31988,7 +33115,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -32000,11 +33127,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -32295,25 +33424,28 @@ - (void)subscribeAttributeNOCsWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROperationalCredentialsNOCsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OperationalCredentials::Attributes::NOCs::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROperationalCredentialsNOCsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROperationalCredentialsNOCsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OperationalCredentials::Attributes::NOCs::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROperationalCredentialsNOCsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROperationalCredentialsNOCsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROperationalCredentialsNOCsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNOCsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32366,25 +33498,28 @@ - (void)subscribeAttributeFabricsWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROperationalCredentialsFabricsListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OperationalCredentials::Attributes::Fabrics::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROperationalCredentialsFabricsListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROperationalCredentialsFabricsListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OperationalCredentials::Attributes::Fabrics::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROperationalCredentialsFabricsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROperationalCredentialsFabricsListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROperationalCredentialsFabricsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFabricsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32436,7 +33571,7 @@ - (void)subscribeAttributeSupportedFabricsWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -32448,11 +33583,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -32507,7 +33644,7 @@ - (void)subscribeAttributeCommissionedFabricsWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -32519,11 +33656,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -32579,25 +33718,31 @@ - (void)subscribeAttributeTrustedRootCertificatesWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROperationalCredentialsTrustedRootCertificatesListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OperationalCredentials::Attributes::TrustedRootCertificates::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROperationalCredentialsTrustedRootCertificatesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTROperationalCredentialsTrustedRootCertificatesListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROperationalCredentialsTrustedRootCertificatesListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OperationalCredentials::Attributes::TrustedRootCertificates::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROperationalCredentialsTrustedRootCertificatesListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROperationalCredentialsTrustedRootCertificatesListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTrustedRootCertificatesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32651,7 +33796,7 @@ - (void)subscribeAttributeCurrentFabricIndexWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -32663,11 +33808,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -32722,25 +33869,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OperationalCredentials::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OperationalCredentials::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32794,25 +33945,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OperationalCredentials::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OperationalCredentials::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32864,25 +34019,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OperationalCredentials::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OperationalCredentials::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32934,7 +34093,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -32946,11 +34105,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -33003,7 +34164,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -33015,11 +34176,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -33318,25 +34481,28 @@ - (void)subscribeAttributeGroupKeyMapWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGroupKeyMapWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33389,25 +34555,28 @@ - (void)subscribeAttributeGroupTableWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GroupKeyManagement::Attributes::GroupTable::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GroupKeyManagement::Attributes::GroupTable::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGroupTableWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33459,7 +34628,7 @@ - (void)subscribeAttributeMaxGroupsPerFabricWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -33471,11 +34640,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -33530,7 +34701,7 @@ - (void)subscribeAttributeMaxGroupKeysPerFabricWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -33542,11 +34713,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -33601,25 +34774,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GroupKeyManagement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GroupKeyManagement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33673,25 +34850,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GroupKeyManagement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GroupKeyManagement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33743,25 +34924,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRGroupKeyManagementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = GroupKeyManagement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRGroupKeyManagementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRGroupKeyManagementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = GroupKeyManagement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRGroupKeyManagementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRGroupKeyManagementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRGroupKeyManagementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33813,7 +34997,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -33825,11 +35009,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -33882,7 +35068,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -33894,11 +35080,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -33968,25 +35156,28 @@ - (void)subscribeAttributeLabelListWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFixedLabelLabelListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FixedLabel::Attributes::LabelList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFixedLabelLabelListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFixedLabelLabelListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FixedLabel::Attributes::LabelList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFixedLabelLabelListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFixedLabelLabelListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFixedLabelLabelListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLabelListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34038,25 +35229,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFixedLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FixedLabel::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFixedLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFixedLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FixedLabel::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFixedLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFixedLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFixedLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34110,25 +35304,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFixedLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FixedLabel::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFixedLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFixedLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FixedLabel::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFixedLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFixedLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFixedLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34180,25 +35377,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFixedLabelAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FixedLabel::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFixedLabelAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFixedLabelAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FixedLabel::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFixedLabelAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFixedLabelAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFixedLabelAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34250,7 +35450,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -34262,11 +35462,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -34319,7 +35521,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -34331,11 +35533,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FixedLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -34465,25 +35669,28 @@ - (void)subscribeAttributeLabelListWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUserLabelLabelListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UserLabel::Attributes::LabelList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUserLabelLabelListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUserLabelLabelListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UserLabel::Attributes::LabelList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUserLabelLabelListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUserLabelLabelListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUserLabelLabelListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLabelListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34535,25 +35742,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUserLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UserLabel::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUserLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUserLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UserLabel::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUserLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUserLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUserLabelGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34607,25 +35817,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUserLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UserLabel::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUserLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUserLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UserLabel::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUserLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUserLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUserLabelAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34677,25 +35890,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRUserLabelAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = UserLabel::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRUserLabelAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRUserLabelAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = UserLabel::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRUserLabelAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRUserLabelAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRUserLabelAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34747,7 +35963,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -34759,11 +35975,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -34816,7 +36034,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -34828,11 +36046,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::UserLabelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -34902,7 +36122,7 @@ - (void)subscribeAttributeStateValueWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -34914,11 +36134,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -34972,25 +36194,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanStateGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BooleanState::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBooleanStateGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBooleanStateGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BooleanState::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBooleanStateGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanStateGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBooleanStateGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35044,25 +36269,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanStateAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BooleanState::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBooleanStateAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBooleanStateAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BooleanState::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBooleanStateAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanStateAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBooleanStateAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35114,25 +36342,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanStateAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BooleanState::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBooleanStateAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBooleanStateAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BooleanState::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBooleanStateAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanStateAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBooleanStateAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35184,7 +36415,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -35196,11 +36427,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -35253,7 +36486,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -35265,11 +36498,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BooleanStateCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -35367,25 +36602,28 @@ - (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35437,25 +36675,28 @@ - (void)subscribeAttributeStandardNamespaceWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStandardNamespaceWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35507,25 +36748,28 @@ - (void)subscribeAttributeSupportedModesWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRModeSelectSupportedModesListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::SupportedModes::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRModeSelectSupportedModesListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRModeSelectSupportedModesListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::SupportedModes::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRModeSelectSupportedModesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRModeSelectSupportedModesListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRModeSelectSupportedModesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedModesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35577,7 +36821,7 @@ - (void)subscribeAttributeCurrentModeWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -35589,11 +36833,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -35689,25 +36935,28 @@ - (void)subscribeAttributeStartUpModeWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35800,25 +37049,28 @@ - (void)subscribeAttributeOnModeWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOnModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35870,25 +37122,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRModeSelectGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRModeSelectGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRModeSelectGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRModeSelectGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRModeSelectGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRModeSelectGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35942,25 +37197,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRModeSelectAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRModeSelectAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRModeSelectAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRModeSelectAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRModeSelectAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRModeSelectAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36012,25 +37270,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRModeSelectAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ModeSelect::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRModeSelectAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRModeSelectAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRModeSelectAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRModeSelectAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRModeSelectAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36082,7 +37343,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -36094,11 +37355,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -36151,7 +37414,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -36163,11 +37426,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -36840,25 +38105,28 @@ - (void)subscribeAttributeLockStateWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableDoorLockClusterDlLockStateAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableDoorLockClusterDlLockStateAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableDoorLockClusterDlLockStateAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableDoorLockClusterDlLockStateAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableDoorLockClusterDlLockStateAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableDoorLockClusterDlLockStateAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLockStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36909,25 +38177,28 @@ - (void)subscribeAttributeLockTypeWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockClusterDlLockTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockClusterDlLockTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockClusterDlLockTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockClusterDlLockTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockClusterDlLockTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockClusterDlLockTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLockTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36979,7 +38250,7 @@ - (void)subscribeAttributeActuatorEnabledWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -36991,11 +38262,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37048,25 +38321,28 @@ - (void)subscribeAttributeDoorStateWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableDoorLockClusterDlDoorStateAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableDoorLockClusterDlDoorStateAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableDoorLockClusterDlDoorStateAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableDoorLockClusterDlDoorStateAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableDoorLockClusterDlDoorStateAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableDoorLockClusterDlDoorStateAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDoorStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -37156,7 +38432,7 @@ - (void)subscribeAttributeDoorOpenEventsWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37168,11 +38444,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37264,7 +38542,7 @@ - (void)subscribeAttributeDoorClosedEventsWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37276,11 +38554,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37371,7 +38651,7 @@ - (void)subscribeAttributeOpenPeriodWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37383,11 +38663,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37441,7 +38723,7 @@ - (void)subscribeAttributeNumberOfTotalUsersSupportedWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37453,11 +38735,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37512,7 +38796,7 @@ - (void)subscribeAttributeNumberOfPINUsersSupportedWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37524,11 +38808,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37583,7 +38869,7 @@ - (void)subscribeAttributeNumberOfRFIDUsersSupportedWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37595,11 +38881,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37654,7 +38942,7 @@ - (void)subscribeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithMinInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37666,11 +38954,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37726,7 +39016,7 @@ - (void)subscribeAttributeNumberOfYearDaySchedulesSupportedPerUserWithMinInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37738,11 +39028,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37798,7 +39090,7 @@ - (void)subscribeAttributeNumberOfHolidaySchedulesSupportedWithMinInterval:(NSNu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37810,11 +39102,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37868,7 +39162,7 @@ - (void)subscribeAttributeMaxPINCodeLengthWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37880,11 +39174,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -37938,7 +39234,7 @@ - (void)subscribeAttributeMinPINCodeLengthWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -37950,11 +39246,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38008,7 +39306,7 @@ - (void)subscribeAttributeMaxRFIDCodeLengthWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -38020,11 +39318,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38078,7 +39378,7 @@ - (void)subscribeAttributeMinRFIDCodeLengthWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -38090,11 +39390,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38149,25 +39451,28 @@ - (void)subscribeAttributeCredentialRulesSupportWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockCredentialRulesSupportAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::CredentialRulesSupport::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockCredentialRulesSupportAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockCredentialRulesSupportAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::CredentialRulesSupport::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockCredentialRulesSupportAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockCredentialRulesSupportAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockCredentialRulesSupportAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCredentialRulesSupportWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38221,7 +39526,7 @@ - (void)subscribeAttributeNumberOfCredentialsSupportedPerUserWithMinInterval:(NS minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -38233,11 +39538,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38328,25 +39635,28 @@ - (void)subscribeAttributeLanguageWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::Language::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::Language::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLanguageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38434,7 +39744,7 @@ - (void)subscribeAttributeLEDSettingsWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -38446,11 +39756,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38542,7 +39854,7 @@ - (void)subscribeAttributeAutoRelockTimeWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -38554,11 +39866,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38649,7 +39963,7 @@ - (void)subscribeAttributeSoundVolumeWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -38661,11 +39975,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -38757,25 +40073,28 @@ - (void)subscribeAttributeOperatingModeWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockClusterDlOperatingModeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::OperatingMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockClusterDlOperatingModeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockClusterDlOperatingModeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::OperatingMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockClusterDlOperatingModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockClusterDlOperatingModeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockClusterDlOperatingModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOperatingModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38829,25 +40148,28 @@ - (void)subscribeAttributeSupportedOperatingModesWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::SupportedOperatingModes::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockSupportedOperatingModesAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedOperatingModesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38901,25 +40223,28 @@ - (void)subscribeAttributeDefaultConfigurationRegisterWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockDefaultConfigurationRegisterAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::DefaultConfigurationRegister::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockDefaultConfigurationRegisterAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockDefaultConfigurationRegisterAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::DefaultConfigurationRegister::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockDefaultConfigurationRegisterAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockDefaultConfigurationRegisterAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockDefaultConfigurationRegisterAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDefaultConfigurationRegisterWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -39012,7 +40337,7 @@ - (void)subscribeAttributeEnableLocalProgrammingWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39024,11 +40349,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39122,7 +40449,7 @@ - (void)subscribeAttributeEnableOneTouchLockingWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39134,11 +40461,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39232,7 +40561,7 @@ - (void)subscribeAttributeEnableInsideStatusLEDWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39244,11 +40573,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39344,7 +40675,7 @@ - (void)subscribeAttributeEnablePrivacyModeButtonWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39356,11 +40687,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39456,25 +40789,28 @@ - (void)subscribeAttributeLocalProgrammingFeaturesWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockLocalProgrammingFeaturesAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::LocalProgrammingFeatures::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockLocalProgrammingFeaturesAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockLocalProgrammingFeaturesAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::LocalProgrammingFeatures::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockLocalProgrammingFeaturesAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockLocalProgrammingFeaturesAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockLocalProgrammingFeaturesAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocalProgrammingFeaturesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -39566,7 +40902,7 @@ - (void)subscribeAttributeWrongCodeEntryLimitWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39578,11 +40914,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39678,7 +41016,7 @@ - (void)subscribeAttributeUserCodeTemporaryDisableTimeWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39690,11 +41028,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39786,7 +41126,7 @@ - (void)subscribeAttributeSendPINOverTheAirWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39798,11 +41138,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -39898,7 +41240,7 @@ - (void)subscribeAttributeRequirePINforRemoteOperationWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -39910,11 +41252,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -40007,7 +41351,7 @@ - (void)subscribeAttributeExpiringUserTimeoutWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -40019,11 +41363,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -40078,25 +41424,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40150,25 +41499,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40220,25 +41572,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoorLockAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = DoorLock::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRDoorLockAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRDoorLockAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = DoorLock::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRDoorLockAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoorLockAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRDoorLockAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40290,7 +41645,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -40302,11 +41657,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -40359,7 +41716,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -40371,11 +41728,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -40649,25 +42008,28 @@ - (void)subscribeAttributeTypeWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringClusterTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::Type::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringClusterTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringClusterTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::Type::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringClusterTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringClusterTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringClusterTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40720,7 +42082,7 @@ - (void)subscribeAttributePhysicalClosedLimitLiftWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -40732,11 +42094,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -40791,7 +42155,7 @@ - (void)subscribeAttributePhysicalClosedLimitTiltWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -40803,11 +42167,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -40862,25 +42228,28 @@ - (void)subscribeAttributeCurrentPositionLiftWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::CurrentPositionLift::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::CurrentPositionLift::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionLiftWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40933,25 +42302,28 @@ - (void)subscribeAttributeCurrentPositionTiltWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::CurrentPositionTilt::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::CurrentPositionTilt::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionTiltWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41004,7 +42376,7 @@ - (void)subscribeAttributeNumberOfActuationsLiftWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -41016,11 +42388,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -41075,7 +42449,7 @@ - (void)subscribeAttributeNumberOfActuationsTiltWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -41087,11 +42461,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -41144,25 +42520,28 @@ - (void)subscribeAttributeConfigStatusWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeConfigStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41216,25 +42595,28 @@ - (void)subscribeAttributeCurrentPositionLiftPercentageWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::CurrentPositionLiftPercentage::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::CurrentPositionLiftPercentage::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionLiftPercentageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41287,25 +42669,28 @@ - (void)subscribeAttributeCurrentPositionTiltPercentageWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::CurrentPositionTiltPercentage::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::CurrentPositionTiltPercentage::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionTiltPercentageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41357,25 +42742,28 @@ - (void)subscribeAttributeOperationalStatusWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOperationalStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41429,25 +42817,28 @@ - (void)subscribeAttributeTargetPositionLiftPercent100thsWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::TargetPositionLiftPercent100ths::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::TargetPositionLiftPercent100ths::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTargetPositionLiftPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41500,25 +42891,28 @@ - (void)subscribeAttributeTargetPositionTiltPercent100thsWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::TargetPositionTiltPercent100ths::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::TargetPositionTiltPercent100ths::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTargetPositionTiltPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41570,25 +42964,28 @@ - (void)subscribeAttributeEndProductTypeWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringClusterEndProductTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::EndProductType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringClusterEndProductTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringClusterEndProductTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::EndProductType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringClusterEndProductTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringClusterEndProductTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringClusterEndProductTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEndProductTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41642,25 +43039,28 @@ - (void)subscribeAttributeCurrentPositionLiftPercent100thsWithMinInterval:(NSNum minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::CurrentPositionLiftPercent100ths::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::CurrentPositionLiftPercent100ths::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionLiftPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41713,25 +43113,28 @@ - (void)subscribeAttributeCurrentPositionTiltPercent100thsWithMinInterval:(NSNum minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::CurrentPositionTiltPercent100ths::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::CurrentPositionTiltPercent100ths::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionTiltPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41784,7 +43187,7 @@ - (void)subscribeAttributeInstalledOpenLimitLiftWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -41796,11 +43199,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -41855,7 +43260,7 @@ - (void)subscribeAttributeInstalledClosedLimitLiftWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -41867,11 +43272,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -41926,7 +43333,7 @@ - (void)subscribeAttributeInstalledOpenLimitTiltWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -41938,11 +43345,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -41997,7 +43406,7 @@ - (void)subscribeAttributeInstalledClosedLimitTiltWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42009,11 +43418,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -42103,25 +43514,28 @@ - (void)subscribeAttributeModeWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringModeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringModeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringModeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringModeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42171,25 +43585,28 @@ - (void)subscribeAttributeSafetyStatusWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSafetyStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42243,25 +43660,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42315,25 +43735,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42385,25 +43808,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWindowCoveringAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WindowCovering::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWindowCoveringAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWindowCoveringAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WindowCovering::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWindowCoveringAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWindowCoveringAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWindowCoveringAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42455,7 +43881,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42467,11 +43893,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -42524,7 +43952,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42536,11 +43964,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -42670,7 +44100,7 @@ - (void)subscribeAttributeBarrierMovingStateWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42682,11 +44112,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -42741,7 +44173,7 @@ - (void)subscribeAttributeBarrierSafetyStatusWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42753,11 +44185,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -42812,7 +44246,7 @@ - (void)subscribeAttributeBarrierCapabilitiesWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42824,11 +44258,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -42920,7 +44356,7 @@ - (void)subscribeAttributeBarrierOpenEventsWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -42932,11 +44368,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43028,7 +44466,7 @@ - (void)subscribeAttributeBarrierCloseEventsWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43040,11 +44478,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43140,7 +44580,7 @@ - (void)subscribeAttributeBarrierCommandOpenEventsWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43152,11 +44592,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43252,7 +44694,7 @@ - (void)subscribeAttributeBarrierCommandCloseEventsWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43264,11 +44706,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43360,7 +44804,7 @@ - (void)subscribeAttributeBarrierOpenPeriodWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43372,11 +44816,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43468,7 +44914,7 @@ - (void)subscribeAttributeBarrierClosePeriodWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43480,11 +44926,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43538,7 +44986,7 @@ - (void)subscribeAttributeBarrierPositionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43550,11 +44998,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43609,25 +45059,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBarrierControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BarrierControl::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBarrierControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBarrierControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BarrierControl::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBarrierControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBarrierControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBarrierControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -43681,25 +45134,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBarrierControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BarrierControl::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBarrierControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBarrierControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BarrierControl::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBarrierControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBarrierControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBarrierControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -43751,25 +45207,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBarrierControlAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BarrierControl::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBarrierControlAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBarrierControlAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BarrierControl::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBarrierControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBarrierControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBarrierControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -43821,7 +45280,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43833,11 +45292,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43890,7 +45351,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -43902,11 +45363,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -43976,25 +45439,28 @@ - (void)subscribeAttributeMaxPressureWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxPressure::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxPressure::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44045,25 +45511,28 @@ - (void)subscribeAttributeMaxSpeedWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxSpeed::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxSpeed::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44112,25 +45581,28 @@ - (void)subscribeAttributeMaxFlowWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxFlow::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxFlow::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxFlowWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44181,25 +45653,28 @@ - (void)subscribeAttributeMinConstPressureWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstPressure::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstPressure::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44251,25 +45726,28 @@ - (void)subscribeAttributeMaxConstPressureWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstPressure::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstPressure::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44321,25 +45799,28 @@ - (void)subscribeAttributeMinCompPressureWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MinCompPressure::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MinCompPressure::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinCompPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44391,25 +45872,28 @@ - (void)subscribeAttributeMaxCompPressureWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxCompPressure::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxCompPressure::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxCompPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44461,25 +45945,28 @@ - (void)subscribeAttributeMinConstSpeedWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstSpeed::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstSpeed::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44531,25 +46018,28 @@ - (void)subscribeAttributeMaxConstSpeedWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstSpeed::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstSpeed::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44600,25 +46090,28 @@ - (void)subscribeAttributeMinConstFlowWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstFlow::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstFlow::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstFlowWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44669,25 +46162,28 @@ - (void)subscribeAttributeMaxConstFlowWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstFlow::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstFlow::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstFlowWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44738,25 +46234,28 @@ - (void)subscribeAttributeMinConstTempWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstTemp::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MinConstTemp::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstTempWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44807,25 +46306,28 @@ - (void)subscribeAttributeMaxConstTempWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstTemp::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::MaxConstTemp::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstTempWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44876,25 +46378,28 @@ - (void)subscribeAttributePumpStatusWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlPumpStatusAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::PumpStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPumpConfigurationAndControlPumpStatusAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlPumpStatusAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::PumpStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlPumpStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlPumpStatusAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlPumpStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePumpStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44949,27 +46454,31 @@ - (void)subscribeAttributeEffectiveOperationModeWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::EffectiveOperationMode::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::EffectiveOperationMode::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEffectiveOperationModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45025,25 +46534,31 @@ - (void)subscribeAttributeEffectiveControlModeWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::EffectiveControlMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::EffectiveControlMode::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEffectiveControlModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45096,25 +46611,28 @@ - (void)subscribeAttributeCapacityWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::Capacity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::Capacity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCapacityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45163,25 +46681,28 @@ - (void)subscribeAttributeSpeedWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::Speed::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::Speed::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45277,25 +46798,28 @@ - (void)subscribeAttributeLifetimeRunningHoursWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::LifetimeRunningHours::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::LifetimeRunningHours::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLifetimeRunningHoursWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45345,25 +46869,28 @@ - (void)subscribeAttributePowerWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::Power::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::Power::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePowerWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45461,25 +46988,28 @@ - (void)subscribeAttributeLifetimeEnergyConsumedWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLifetimeEnergyConsumedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45571,27 +47101,31 @@ - (void)subscribeAttributeOperationModeWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::OperationMode::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::OperationMode::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOperationModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45683,25 +47217,31 @@ - (void)subscribeAttributeControlModeWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::ControlMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::ControlMode::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeControlModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45758,27 +47298,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::GeneratedCommandList::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlGeneratedCommandListListAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPumpConfigurationAndControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45834,25 +47378,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRPumpConfigurationAndControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45905,25 +47455,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PumpConfigurationAndControl::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PumpConfigurationAndControl::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45975,7 +47529,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -45987,11 +47541,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46044,7 +47600,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46056,11 +47612,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PumpConfigurationAndControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46285,25 +47843,28 @@ - (void)subscribeAttributeLocalTemperatureWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::LocalTemperature::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::LocalTemperature::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocalTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -46355,25 +47916,28 @@ - (void)subscribeAttributeOutdoorTemperatureWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::OutdoorTemperature::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::OutdoorTemperature::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOutdoorTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -46424,7 +47988,7 @@ - (void)subscribeAttributeOccupancyWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46436,11 +48000,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46494,7 +48060,7 @@ - (void)subscribeAttributeAbsMinHeatSetpointLimitWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46506,11 +48072,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46565,7 +48133,7 @@ - (void)subscribeAttributeAbsMaxHeatSetpointLimitWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46577,11 +48145,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46636,7 +48206,7 @@ - (void)subscribeAttributeAbsMinCoolSetpointLimitWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46648,11 +48218,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46707,7 +48279,7 @@ - (void)subscribeAttributeAbsMaxCoolSetpointLimitWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46719,11 +48291,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46777,7 +48351,7 @@ - (void)subscribeAttributePICoolingDemandWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46789,11 +48363,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46847,7 +48423,7 @@ - (void)subscribeAttributePIHeatingDemandWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46859,11 +48435,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -46959,7 +48537,7 @@ - (void)subscribeAttributeHVACSystemTypeConfigurationWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -46971,11 +48549,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47071,7 +48651,7 @@ - (void)subscribeAttributeLocalTemperatureCalibrationWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47083,11 +48663,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47183,7 +48765,7 @@ - (void)subscribeAttributeOccupiedCoolingSetpointWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47195,11 +48777,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47295,7 +48879,7 @@ - (void)subscribeAttributeOccupiedHeatingSetpointWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47307,11 +48891,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47407,7 +48993,7 @@ - (void)subscribeAttributeUnoccupiedCoolingSetpointWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47419,11 +49005,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47519,7 +49107,7 @@ - (void)subscribeAttributeUnoccupiedHeatingSetpointWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47531,11 +49119,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47628,7 +49218,7 @@ - (void)subscribeAttributeMinHeatSetpointLimitWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47640,11 +49230,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47737,7 +49329,7 @@ - (void)subscribeAttributeMaxHeatSetpointLimitWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47749,11 +49341,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47846,7 +49440,7 @@ - (void)subscribeAttributeMinCoolSetpointLimitWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47858,11 +49452,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -47955,7 +49551,7 @@ - (void)subscribeAttributeMaxCoolSetpointLimitWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -47967,11 +49563,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48064,7 +49662,7 @@ - (void)subscribeAttributeMinSetpointDeadBandWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48076,11 +49674,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48172,7 +49772,7 @@ - (void)subscribeAttributeRemoteSensingWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48184,11 +49784,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48284,25 +49886,29 @@ - (void)subscribeAttributeControlSequenceOfOperationWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::ControlSequenceOfOperation::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::ControlSequenceOfOperation::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeControlSequenceOfOperationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -48392,7 +49998,7 @@ - (void)subscribeAttributeSystemModeWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48404,11 +50010,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48462,7 +50070,7 @@ - (void)subscribeAttributeThermostatRunningModeWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48474,11 +50082,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48531,7 +50141,7 @@ - (void)subscribeAttributeStartOfWeekWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48543,11 +50153,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48602,7 +50214,7 @@ - (void)subscribeAttributeNumberOfWeeklyTransitionsWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48614,11 +50226,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48673,7 +50287,7 @@ - (void)subscribeAttributeNumberOfDailyTransitionsWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48685,11 +50299,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48785,7 +50401,7 @@ - (void)subscribeAttributeTemperatureSetpointHoldWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -48797,11 +50413,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -48902,25 +50520,28 @@ - (void)subscribeAttributeTemperatureSetpointHoldDurationWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldDuration::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldDuration::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTemperatureSetpointHoldDurationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49014,7 +50635,7 @@ - (void)subscribeAttributeThermostatProgrammingOperationModeWithMinInterval:(NSN minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -49026,11 +50647,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -49085,7 +50708,7 @@ - (void)subscribeAttributeThermostatRunningStateWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -49097,11 +50720,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -49156,7 +50781,7 @@ - (void)subscribeAttributeSetpointChangeSourceWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -49168,11 +50793,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -49227,25 +50854,28 @@ - (void)subscribeAttributeSetpointChangeAmountWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::SetpointChangeAmount::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::SetpointChangeAmount::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSetpointChangeAmountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49298,7 +50928,7 @@ - (void)subscribeAttributeSetpointChangeSourceTimestampWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -49310,11 +50940,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -49411,25 +51043,28 @@ - (void)subscribeAttributeOccupiedSetbackWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::OccupiedSetback::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::OccupiedSetback::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOccupiedSetbackWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49481,25 +51116,28 @@ - (void)subscribeAttributeOccupiedSetbackMinWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::OccupiedSetbackMin::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::OccupiedSetbackMin::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOccupiedSetbackMinWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49551,25 +51189,28 @@ - (void)subscribeAttributeOccupiedSetbackMaxWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::OccupiedSetbackMax::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::OccupiedSetbackMax::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOccupiedSetbackMaxWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49664,25 +51305,28 @@ - (void)subscribeAttributeUnoccupiedSetbackWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::UnoccupiedSetback::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::UnoccupiedSetback::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUnoccupiedSetbackWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49735,25 +51379,28 @@ - (void)subscribeAttributeUnoccupiedSetbackMinWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::UnoccupiedSetbackMin::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::UnoccupiedSetbackMin::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUnoccupiedSetbackMinWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49806,25 +51453,28 @@ - (void)subscribeAttributeUnoccupiedSetbackMaxWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::UnoccupiedSetbackMax::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::UnoccupiedSetbackMax::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUnoccupiedSetbackMaxWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49914,7 +51564,7 @@ - (void)subscribeAttributeEmergencyHeatDeltaWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -49926,11 +51576,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50020,7 +51672,7 @@ - (void)subscribeAttributeACTypeWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50032,11 +51684,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50126,7 +51780,7 @@ - (void)subscribeAttributeACCapacityWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50138,11 +51792,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50233,7 +51889,7 @@ - (void)subscribeAttributeACRefrigerantTypeWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50245,11 +51901,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50341,7 +51999,7 @@ - (void)subscribeAttributeACCompressorTypeWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50353,11 +52011,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50448,7 +52108,7 @@ - (void)subscribeAttributeACErrorCodeWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50460,11 +52120,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50556,7 +52218,7 @@ - (void)subscribeAttributeACLouverPositionWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50568,11 +52230,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50626,25 +52290,28 @@ - (void)subscribeAttributeACCoilTemperatureWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::ACCoilTemperature::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::ACCoilTemperature::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeACCoilTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -50734,7 +52401,7 @@ - (void)subscribeAttributeACCapacityformatWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -50746,11 +52413,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -50805,25 +52474,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThermostatGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -50877,25 +52549,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThermostatAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -50947,25 +52622,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Thermostat::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRThermostatAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Thermostat::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51017,7 +52695,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51029,11 +52707,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51086,7 +52766,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51098,11 +52778,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51209,25 +52891,28 @@ - (void)subscribeAttributeFanModeWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFanControlClusterFanModeTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::FanMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFanControlClusterFanModeTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFanControlClusterFanModeTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::FanMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFanControlClusterFanModeTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFanControlClusterFanModeTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFanControlClusterFanModeTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFanModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51317,25 +53002,28 @@ - (void)subscribeAttributeFanModeSequenceWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFanControlClusterFanModeSequenceTypeAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::FanModeSequence::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFanControlClusterFanModeSequenceTypeAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFanControlClusterFanModeSequenceTypeAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::FanModeSequence::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFanControlClusterFanModeSequenceTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFanControlClusterFanModeSequenceTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFanControlClusterFanModeSequenceTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFanModeSequenceWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51431,25 +53119,28 @@ - (void)subscribeAttributePercentSettingWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::PercentSetting::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::PercentSetting::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePercentSettingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51501,7 +53192,7 @@ - (void)subscribeAttributePercentCurrentWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51513,11 +53204,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51570,7 +53263,7 @@ - (void)subscribeAttributeSpeedMaxWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51582,11 +53275,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51681,25 +53376,28 @@ - (void)subscribeAttributeSpeedSettingWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::SpeedSetting::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::SpeedSetting::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSpeedSettingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51750,7 +53448,7 @@ - (void)subscribeAttributeSpeedCurrentWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51762,11 +53460,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51819,7 +53519,7 @@ - (void)subscribeAttributeRockSupportWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51831,11 +53531,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51926,7 +53628,7 @@ - (void)subscribeAttributeRockSettingWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -51938,11 +53640,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -51995,7 +53699,7 @@ - (void)subscribeAttributeWindSupportWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52007,11 +53711,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52102,7 +53808,7 @@ - (void)subscribeAttributeWindSettingWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52114,11 +53820,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52173,25 +53881,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFanControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFanControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFanControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFanControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFanControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFanControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52245,25 +53956,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFanControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFanControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFanControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFanControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFanControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFanControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52315,25 +54029,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFanControlAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FanControl::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFanControlAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFanControlAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FanControl::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFanControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFanControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFanControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52385,7 +54102,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52397,11 +54114,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52454,7 +54173,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52466,11 +54185,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FanControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52581,7 +54302,7 @@ - (void)subscribeAttributeTemperatureDisplayModeWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52593,11 +54314,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52689,7 +54412,7 @@ - (void)subscribeAttributeKeypadLockoutWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52701,11 +54424,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52801,7 +54526,7 @@ - (void)subscribeAttributeScheduleProgrammingVisibilityWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -52813,11 +54538,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -52874,27 +54601,33 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable( + success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * + innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52952,27 +54685,33 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable( + success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * + innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -53028,27 +54767,31 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRThermostatUserInterfaceConfigurationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::AttributeList::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRThermostatUserInterfaceConfigurationAttributeListListAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRThermostatUserInterfaceConfigurationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRThermostatUserInterfaceConfigurationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ThermostatUserInterfaceConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRThermostatUserInterfaceConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRThermostatUserInterfaceConfigurationAttributeListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -53101,7 +54844,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -53113,11 +54856,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -53170,7 +54915,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -53182,11 +54927,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ThermostatUserInterfaceConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -53859,7 +55606,7 @@ - (void)subscribeAttributeCurrentHueWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -53871,11 +55618,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -53928,7 +55677,7 @@ - (void)subscribeAttributeCurrentSaturationWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -53940,11 +55689,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -53998,7 +55749,7 @@ - (void)subscribeAttributeRemainingTimeWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54010,11 +55761,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54067,7 +55820,7 @@ - (void)subscribeAttributeCurrentXWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54079,11 +55832,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54135,7 +55890,7 @@ - (void)subscribeAttributeCurrentYWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54147,11 +55902,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54204,7 +55961,7 @@ - (void)subscribeAttributeDriftCompensationWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54216,11 +55973,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54274,25 +56033,28 @@ - (void)subscribeAttributeCompensationTextWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::CompensationText::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::CompensationText::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCompensationTextWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -54345,7 +56107,7 @@ - (void)subscribeAttributeColorTemperatureMiredsWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54357,11 +56119,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54414,7 +56178,7 @@ - (void)subscribeAttributeColorModeWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54426,11 +56190,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54519,7 +56285,7 @@ - (void)subscribeAttributeOptionsWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54531,11 +56297,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54588,25 +56356,28 @@ - (void)subscribeAttributeNumberOfPrimariesWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::NumberOfPrimaries::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::NumberOfPrimaries::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNumberOfPrimariesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -54657,7 +56428,7 @@ - (void)subscribeAttributePrimary1XWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54669,11 +56440,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54725,7 +56498,7 @@ - (void)subscribeAttributePrimary1YWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54737,11 +56510,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54794,25 +56569,28 @@ - (void)subscribeAttributePrimary1IntensityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::Primary1Intensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::Primary1Intensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary1IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -54863,7 +56641,7 @@ - (void)subscribeAttributePrimary2XWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54875,11 +56653,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -54931,7 +56711,7 @@ - (void)subscribeAttributePrimary2YWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -54943,11 +56723,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55000,25 +56782,28 @@ - (void)subscribeAttributePrimary2IntensityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::Primary2Intensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::Primary2Intensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary2IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55069,7 +56854,7 @@ - (void)subscribeAttributePrimary3XWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55081,11 +56866,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55137,7 +56924,7 @@ - (void)subscribeAttributePrimary3YWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55149,11 +56936,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55206,25 +56995,28 @@ - (void)subscribeAttributePrimary3IntensityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::Primary3Intensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::Primary3Intensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary3IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55275,7 +57067,7 @@ - (void)subscribeAttributePrimary4XWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55287,11 +57079,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55343,7 +57137,7 @@ - (void)subscribeAttributePrimary4YWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55355,11 +57149,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55412,25 +57208,28 @@ - (void)subscribeAttributePrimary4IntensityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::Primary4Intensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::Primary4Intensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary4IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55481,7 +57280,7 @@ - (void)subscribeAttributePrimary5XWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55493,11 +57292,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55549,7 +57350,7 @@ - (void)subscribeAttributePrimary5YWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55561,11 +57362,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55618,25 +57421,28 @@ - (void)subscribeAttributePrimary5IntensityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::Primary5Intensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::Primary5Intensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary5IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55687,7 +57493,7 @@ - (void)subscribeAttributePrimary6XWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55699,11 +57505,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55755,7 +57563,7 @@ - (void)subscribeAttributePrimary6YWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55767,11 +57575,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -55824,25 +57634,28 @@ - (void)subscribeAttributePrimary6IntensityWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::Primary6Intensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::Primary6Intensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary6IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55931,7 +57744,7 @@ - (void)subscribeAttributeWhitePointXWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -55943,11 +57756,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56038,7 +57853,7 @@ - (void)subscribeAttributeWhitePointYWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56050,11 +57865,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56145,7 +57962,7 @@ - (void)subscribeAttributeColorPointRXWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56157,11 +57974,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56252,7 +58071,7 @@ - (void)subscribeAttributeColorPointRYWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56264,11 +58083,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56367,25 +58188,28 @@ - (void)subscribeAttributeColorPointRIntensityWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::ColorPointRIntensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::ColorPointRIntensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeColorPointRIntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -56474,7 +58298,7 @@ - (void)subscribeAttributeColorPointGXWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56486,11 +58310,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56581,7 +58407,7 @@ - (void)subscribeAttributeColorPointGYWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56593,11 +58419,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56696,25 +58524,28 @@ - (void)subscribeAttributeColorPointGIntensityWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::ColorPointGIntensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::ColorPointGIntensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeColorPointGIntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -56803,7 +58634,7 @@ - (void)subscribeAttributeColorPointBXWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56815,11 +58646,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -56910,7 +58743,7 @@ - (void)subscribeAttributeColorPointBYWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56922,11 +58755,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57025,25 +58860,28 @@ - (void)subscribeAttributeColorPointBIntensityWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::ColorPointBIntensity::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::ColorPointBIntensity::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeColorPointBIntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -57095,7 +58933,7 @@ - (void)subscribeAttributeEnhancedCurrentHueWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57107,11 +58945,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57165,7 +59005,7 @@ - (void)subscribeAttributeEnhancedColorModeWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57177,11 +59017,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57235,7 +59077,7 @@ - (void)subscribeAttributeColorLoopActiveWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57247,11 +59089,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57305,7 +59149,7 @@ - (void)subscribeAttributeColorLoopDirectionWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57317,11 +59161,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57375,7 +59221,7 @@ - (void)subscribeAttributeColorLoopTimeWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57387,11 +59233,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57446,7 +59294,7 @@ - (void)subscribeAttributeColorLoopStartEnhancedHueWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57458,11 +59306,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57517,7 +59367,7 @@ - (void)subscribeAttributeColorLoopStoredEnhancedHueWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57529,11 +59379,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57587,7 +59439,7 @@ - (void)subscribeAttributeColorCapabilitiesWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57599,11 +59451,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57658,7 +59512,7 @@ - (void)subscribeAttributeColorTempPhysicalMinMiredsWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57670,11 +59524,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57729,7 +59585,7 @@ - (void)subscribeAttributeColorTempPhysicalMaxMiredsWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57741,11 +59597,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57800,7 +59658,7 @@ - (void)subscribeAttributeCoupleColorTempToLevelMinMiredsWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -57812,11 +59670,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -57917,25 +59777,28 @@ - (void)subscribeAttributeStartUpColorTemperatureMiredsWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::StartUpColorTemperatureMireds::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::StartUpColorTemperatureMireds::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpColorTemperatureMiredsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -57988,25 +59851,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRColorControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRColorControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRColorControlGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRColorControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRColorControlGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRColorControlGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58060,25 +59926,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRColorControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRColorControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRColorControlAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRColorControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRColorControlAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRColorControlAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58130,25 +59999,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ColorControl::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ColorControl::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58200,7 +60072,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58212,11 +60084,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58269,7 +60143,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58281,11 +60155,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58356,7 +60232,7 @@ - (void)subscribeAttributePhysicalMinLevelWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58368,11 +60244,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58426,7 +60304,7 @@ - (void)subscribeAttributePhysicalMaxLevelWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58438,11 +60316,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58496,7 +60376,7 @@ - (void)subscribeAttributeBallastStatusWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58508,11 +60388,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58603,7 +60485,7 @@ - (void)subscribeAttributeMinLevelWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58615,11 +60497,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58709,7 +60593,7 @@ - (void)subscribeAttributeMaxLevelWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -58721,11 +60605,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -58825,25 +60711,28 @@ - (void)subscribeAttributeIntrinsicBalanceFactorWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::IntrinsicBalanceFactor::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::IntrinsicBalanceFactor::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeIntrinsicBalanceFactorWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58942,25 +60831,28 @@ - (void)subscribeAttributeBallastFactorAdjustmentWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::BallastFactorAdjustment::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::BallastFactorAdjustment::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBallastFactorAdjustmentWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59011,7 +60903,7 @@ - (void)subscribeAttributeLampQuantityWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -59023,11 +60915,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -59118,25 +61012,28 @@ - (void)subscribeAttributeLampTypeWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::LampType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::LampType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59225,25 +61122,28 @@ - (void)subscribeAttributeLampManufacturerWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::LampManufacturer::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::LampManufacturer::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampManufacturerWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59338,25 +61238,28 @@ - (void)subscribeAttributeLampRatedHoursWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::LampRatedHours::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::LampRatedHours::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampRatedHoursWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59451,25 +61354,28 @@ - (void)subscribeAttributeLampBurnHoursWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::LampBurnHours::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::LampBurnHours::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampBurnHoursWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59559,7 +61465,7 @@ - (void)subscribeAttributeLampAlarmModeWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -59571,11 +61477,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -59676,25 +61584,28 @@ - (void)subscribeAttributeLampBurnHoursTripPointWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::LampBurnHoursTripPoint::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::LampBurnHoursTripPoint::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampBurnHoursTripPointWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59747,25 +61658,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59819,25 +61734,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59889,25 +61808,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBallastConfigurationAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = BallastConfiguration::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRBallastConfigurationAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRBallastConfigurationAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = BallastConfiguration::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRBallastConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBallastConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRBallastConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59959,7 +61881,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -59971,11 +61893,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -60028,7 +61952,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -60040,11 +61964,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::BallastConfigurationCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -60115,25 +62041,28 @@ - (void)subscribeAttributeMeasuredValueWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::MeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::MeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60185,25 +62114,28 @@ - (void)subscribeAttributeMinMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::MinMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::MinMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60255,25 +62187,28 @@ - (void)subscribeAttributeMaxMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::MaxMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60324,7 +62259,7 @@ - (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -60336,11 +62271,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -60393,25 +62330,28 @@ - (void)subscribeAttributeLightSensorTypeWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::LightSensorType::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::LightSensorType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLightSensorTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60464,25 +62404,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60536,25 +62480,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60606,25 +62554,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = IlluminanceMeasurement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = IlluminanceMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60676,7 +62628,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -60688,11 +62640,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -60745,7 +62699,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -60757,11 +62711,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::IlluminanceMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -60832,25 +62788,28 @@ - (void)subscribeAttributeMeasuredValueWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TemperatureMeasurement::Attributes::MeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TemperatureMeasurement::Attributes::MeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60902,25 +62861,28 @@ - (void)subscribeAttributeMinMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TemperatureMeasurement::Attributes::MinMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TemperatureMeasurement::Attributes::MinMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60972,25 +62934,28 @@ - (void)subscribeAttributeMaxMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TemperatureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TemperatureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61041,7 +63006,7 @@ - (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -61053,11 +63018,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -61111,25 +63078,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TemperatureMeasurement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TemperatureMeasurement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61183,25 +63154,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TemperatureMeasurement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TemperatureMeasurement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61253,25 +63228,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TemperatureMeasurement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TemperatureMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61323,7 +63302,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -61335,11 +63314,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -61392,7 +63373,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -61404,11 +63385,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TemperatureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -61479,25 +63462,28 @@ - (void)subscribeAttributeMeasuredValueWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::MeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61549,25 +63535,28 @@ - (void)subscribeAttributeMinMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::MinMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MinMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61619,25 +63608,28 @@ - (void)subscribeAttributeMaxMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MaxMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61688,7 +63680,7 @@ - (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -61700,11 +63692,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -61756,25 +63750,28 @@ - (void)subscribeAttributeScaledValueWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::ScaledValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::ScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeScaledValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61826,25 +63823,28 @@ - (void)subscribeAttributeMinScaledValueWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::MinScaledValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MinScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinScaledValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61896,25 +63896,28 @@ - (void)subscribeAttributeMaxScaledValueWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::MaxScaledValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::MaxScaledValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxScaledValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61966,7 +63969,7 @@ - (void)subscribeAttributeScaledToleranceWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -61978,11 +63981,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -62034,7 +64039,7 @@ - (void)subscribeAttributeScaleWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -62046,11 +64051,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -62104,25 +64111,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62176,25 +64187,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62246,25 +64261,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRPressureMeasurementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = PressureMeasurement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRPressureMeasurementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRPressureMeasurementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = PressureMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRPressureMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRPressureMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRPressureMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62316,7 +64334,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -62328,11 +64346,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -62385,7 +64405,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -62397,11 +64417,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::PressureMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -62472,25 +64494,28 @@ - (void)subscribeAttributeMeasuredValueWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FlowMeasurement::Attributes::MeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FlowMeasurement::Attributes::MeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62542,25 +64567,28 @@ - (void)subscribeAttributeMinMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FlowMeasurement::Attributes::MinMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FlowMeasurement::Attributes::MinMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62612,25 +64640,28 @@ - (void)subscribeAttributeMaxMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FlowMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FlowMeasurement::Attributes::MaxMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62681,7 +64712,7 @@ - (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -62693,11 +64724,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -62751,25 +64784,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FlowMeasurement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FlowMeasurement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62823,25 +64860,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFlowMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FlowMeasurement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFlowMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFlowMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FlowMeasurement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFlowMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFlowMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFlowMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62893,25 +64933,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFlowMeasurementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = FlowMeasurement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRFlowMeasurementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRFlowMeasurementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = FlowMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRFlowMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFlowMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRFlowMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62963,7 +65006,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -62975,11 +65018,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63032,7 +65077,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63044,11 +65089,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::FlowMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63119,25 +65166,28 @@ - (void)subscribeAttributeMeasuredValueWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = RelativeHumidityMeasurement::Attributes::MeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = RelativeHumidityMeasurement::Attributes::MeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63189,25 +65239,28 @@ - (void)subscribeAttributeMinMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63259,25 +65312,28 @@ - (void)subscribeAttributeMaxMeasuredValueWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63328,7 +65384,7 @@ - (void)subscribeAttributeToleranceWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63340,11 +65396,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63400,27 +65458,31 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRRelativeHumidityMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = RelativeHumidityMeasurement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn - = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRRelativeHumidityMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRRelativeHumidityMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRRelativeHumidityMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = RelativeHumidityMeasurement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRRelativeHumidityMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRRelativeHumidityMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63476,25 +65538,31 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRRelativeHumidityMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = RelativeHumidityMeasurement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - - chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRRelativeHumidityMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + __block MTRRelativeHumidityMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRRelativeHumidityMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = RelativeHumidityMeasurement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + + chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRRelativeHumidityMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRRelativeHumidityMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63547,25 +65615,29 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = RelativeHumidityMeasurement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = RelativeHumidityMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63617,7 +65689,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63629,11 +65701,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63686,7 +65760,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63698,11 +65772,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::RelativeHumidityMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63772,7 +65848,7 @@ - (void)subscribeAttributeOccupancyWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63784,11 +65860,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63842,7 +65920,7 @@ - (void)subscribeAttributeOccupancySensorTypeWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63854,11 +65932,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -63913,7 +65993,7 @@ - (void)subscribeAttributeOccupancySensorTypeBitmapWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -63925,11 +66005,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64025,7 +66107,7 @@ - (void)subscribeAttributePirOccupiedToUnoccupiedDelayWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64037,11 +66119,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64137,7 +66221,7 @@ - (void)subscribeAttributePirUnoccupiedToOccupiedDelayWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64149,11 +66233,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64249,7 +66335,7 @@ - (void)subscribeAttributePirUnoccupiedToOccupiedThresholdWithMinInterval:(NSNum minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64261,11 +66347,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64361,7 +66449,7 @@ - (void)subscribeAttributeUltrasonicOccupiedToUnoccupiedDelayWithMinInterval:(NS minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64373,11 +66461,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64473,7 +66563,7 @@ - (void)subscribeAttributeUltrasonicUnoccupiedToOccupiedDelayWithMinInterval:(NS minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64485,11 +66575,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64585,7 +66677,7 @@ - (void)subscribeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithMinInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64597,11 +66689,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64697,7 +66791,7 @@ - (void)subscribeAttributePhysicalContactOccupiedToUnoccupiedDelayWithMinInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64709,11 +66803,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64810,7 +66906,7 @@ - (void)subscribeAttributePhysicalContactUnoccupiedToOccupiedDelayWithMinInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64822,11 +66918,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64923,7 +67021,7 @@ - (void)subscribeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithMinInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -64935,11 +67033,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -64995,25 +67095,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OccupancySensing::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OccupancySensing::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65067,25 +67171,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OccupancySensing::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OccupancySensing::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65137,25 +67245,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROccupancySensingAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = OccupancySensing::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROccupancySensingAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROccupancySensingAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = OccupancySensing::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROccupancySensingAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROccupancySensingAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROccupancySensingAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65207,7 +67318,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -65219,11 +67330,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -65276,7 +67389,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -65288,11 +67401,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::OccupancySensingCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -65362,25 +67477,28 @@ - (void)subscribeAttributeMACAddressWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WakeOnLan::Attributes::MACAddress::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WakeOnLan::Attributes::MACAddress::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMACAddressWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65432,25 +67550,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWakeOnLanGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WakeOnLan::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWakeOnLanGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWakeOnLanGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WakeOnLan::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWakeOnLanGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWakeOnLanGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWakeOnLanGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65504,25 +67625,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWakeOnLanAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WakeOnLan::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWakeOnLanAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWakeOnLanAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WakeOnLan::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWakeOnLanAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWakeOnLanAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWakeOnLanAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65574,25 +67698,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRWakeOnLanAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = WakeOnLan::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRWakeOnLanAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRWakeOnLanAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = WakeOnLan::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRWakeOnLanAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRWakeOnLanAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRWakeOnLanAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65644,7 +67771,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -65656,11 +67783,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -65713,7 +67842,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -65725,11 +67854,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::WakeOnLanCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -65880,25 +68011,28 @@ - (void)subscribeAttributeChannelListWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRChannelChannelListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Channel::Attributes::ChannelList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRChannelChannelListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRChannelChannelListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Channel::Attributes::ChannelList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRChannelChannelListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRChannelChannelListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRChannelChannelListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65949,25 +68083,28 @@ - (void)subscribeAttributeLineupWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRChannelLineupStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Channel::Attributes::Lineup::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRChannelLineupStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRChannelLineupStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Channel::Attributes::Lineup::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRChannelLineupStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRChannelLineupStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRChannelLineupStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLineupWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66019,25 +68156,28 @@ - (void)subscribeAttributeCurrentChannelWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRChannelCurrentChannelStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Channel::Attributes::CurrentChannel::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRChannelCurrentChannelStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRChannelCurrentChannelStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Channel::Attributes::CurrentChannel::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRChannelCurrentChannelStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRChannelCurrentChannelStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRChannelCurrentChannelStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentChannelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66091,25 +68231,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRChannelGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Channel::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRChannelGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRChannelGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Channel::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRChannelGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRChannelGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRChannelGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66163,25 +68306,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRChannelAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Channel::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRChannelAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRChannelAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Channel::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRChannelAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRChannelAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRChannelAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66233,25 +68379,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRChannelAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = Channel::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRChannelAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRChannelAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = Channel::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRChannelAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRChannelAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRChannelAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66302,7 +68451,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -66314,11 +68463,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -66371,7 +68522,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -66383,11 +68534,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -66486,25 +68639,28 @@ - (void)subscribeAttributeTargetListWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTargetNavigatorTargetListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TargetNavigator::Attributes::TargetList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTargetNavigatorTargetListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTargetNavigatorTargetListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TargetNavigator::Attributes::TargetList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTargetNavigatorTargetListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTargetNavigatorTargetListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTargetNavigatorTargetListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTargetListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66556,7 +68712,7 @@ - (void)subscribeAttributeCurrentTargetWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -66568,11 +68724,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -66627,25 +68785,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TargetNavigator::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TargetNavigator::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66699,25 +68861,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTargetNavigatorAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TargetNavigator::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTargetNavigatorAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTargetNavigatorAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TargetNavigator::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTargetNavigatorAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTargetNavigatorAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTargetNavigatorAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66769,25 +68934,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTargetNavigatorAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TargetNavigator::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTargetNavigatorAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTargetNavigatorAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TargetNavigator::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTargetNavigatorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTargetNavigatorAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTargetNavigatorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66839,7 +69007,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -66851,11 +69019,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -66908,7 +69078,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -66920,11 +69090,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -67301,25 +69473,28 @@ - (void)subscribeAttributeCurrentStateWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaPlaybackClusterPlaybackStateEnumAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::CurrentState::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaPlaybackClusterPlaybackStateEnumAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaPlaybackClusterPlaybackStateEnumAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::CurrentState::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaPlaybackClusterPlaybackStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaPlaybackClusterPlaybackStateEnumAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaPlaybackClusterPlaybackStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67371,25 +69546,28 @@ - (void)subscribeAttributeStartTimeWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::StartTime::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::StartTime::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartTimeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67439,25 +69617,28 @@ - (void)subscribeAttributeDurationWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::Duration::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::Duration::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDurationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67508,25 +69689,28 @@ - (void)subscribeAttributeSampledPositionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaPlaybackSampledPositionStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::SampledPosition::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaPlaybackSampledPositionStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaPlaybackSampledPositionStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::SampledPosition::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaPlaybackSampledPositionStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaPlaybackSampledPositionStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaPlaybackSampledPositionStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSampledPositionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67579,7 +69763,7 @@ - (void)subscribeAttributePlaybackSpeedWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFloatAttributeCallbackSubscriptionBridge( + __block MTRFloatAttributeCallbackSubscriptionBridge * callbackBridge = new MTRFloatAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -67591,11 +69775,13 @@ new MTRFloatAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFloatAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -67648,25 +69834,28 @@ - (void)subscribeAttributeSeekRangeEndWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::SeekRangeEnd::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::SeekRangeEnd::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSeekRangeEndWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67718,25 +69907,28 @@ - (void)subscribeAttributeSeekRangeStartWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::SeekRangeStart::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::SeekRangeStart::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSeekRangeStartWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67789,25 +69981,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaPlaybackGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaPlaybackGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaPlaybackGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaPlaybackGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaPlaybackGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaPlaybackGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67861,25 +70056,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaPlaybackAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaPlaybackAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaPlaybackAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaPlaybackAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaPlaybackAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaPlaybackAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67931,25 +70129,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaPlaybackAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaPlayback::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaPlaybackAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaPlaybackAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaPlayback::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaPlaybackAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaPlaybackAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaPlaybackAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68001,7 +70202,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -68013,11 +70214,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -68070,7 +70273,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -68082,11 +70285,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -68273,25 +70478,28 @@ - (void)subscribeAttributeInputListWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaInputInputListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaInput::Attributes::InputList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaInputInputListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaInputInputListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaInput::Attributes::InputList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaInputInputListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaInputInputListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaInputInputListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeInputListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68341,7 +70549,7 @@ - (void)subscribeAttributeCurrentInputWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -68353,11 +70561,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -68412,25 +70622,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaInputGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaInput::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaInputGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaInputGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaInput::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaInputGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaInputGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaInputGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68484,25 +70697,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaInputAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaInput::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaInputAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaInputAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaInput::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaInputAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaInputAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaInputAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68554,25 +70770,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRMediaInputAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = MediaInput::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRMediaInputAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRMediaInputAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = MediaInput::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRMediaInputAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRMediaInputAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRMediaInputAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68624,7 +70843,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -68636,11 +70855,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -68693,7 +70914,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -68705,11 +70926,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -68811,25 +71034,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLowPowerGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLowPowerGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLowPowerGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLowPowerGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLowPowerGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLowPowerGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68883,25 +71109,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLowPowerAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLowPowerAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLowPowerAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLowPowerAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLowPowerAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLowPowerAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68953,25 +71182,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRLowPowerAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRLowPowerAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRLowPowerAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRLowPowerAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRLowPowerAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRLowPowerAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69023,7 +71255,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -69035,11 +71267,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -69092,7 +71326,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -69104,11 +71338,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -69205,25 +71441,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRKeypadInputGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRKeypadInputGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRKeypadInputGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRKeypadInputGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRKeypadInputGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRKeypadInputGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69277,25 +71516,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRKeypadInputAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRKeypadInputAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRKeypadInputAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRKeypadInputAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRKeypadInputAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRKeypadInputAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69347,25 +71589,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRKeypadInputAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRKeypadInputAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRKeypadInputAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRKeypadInputAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRKeypadInputAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRKeypadInputAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69417,7 +71662,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -69429,11 +71674,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -69486,7 +71733,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -69498,11 +71745,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -69776,25 +72025,28 @@ - (void)subscribeAttributeAcceptHeaderWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRContentLauncherAcceptHeaderListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRContentLauncherAcceptHeaderListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRContentLauncherAcceptHeaderListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRContentLauncherAcceptHeaderListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRContentLauncherAcceptHeaderListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRContentLauncherAcceptHeaderListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptHeaderWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69889,7 +72141,7 @@ - (void)subscribeAttributeSupportedStreamingProtocolsWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -69901,11 +72153,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -69960,25 +72214,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70032,25 +72290,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRContentLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRContentLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRContentLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRContentLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRContentLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRContentLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70102,25 +72363,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRContentLauncherAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRContentLauncherAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRContentLauncherAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRContentLauncherAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRContentLauncherAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRContentLauncherAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70172,7 +72436,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -70184,11 +72448,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -70241,7 +72507,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -70253,11 +72519,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -70384,25 +72652,28 @@ - (void)subscribeAttributeOutputListWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAudioOutputOutputListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAudioOutputOutputListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAudioOutputOutputListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAudioOutputOutputListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAudioOutputOutputListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAudioOutputOutputListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOutputListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70454,7 +72725,7 @@ - (void)subscribeAttributeCurrentOutputWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -70466,11 +72737,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -70525,25 +72798,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAudioOutputGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAudioOutputGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAudioOutputGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAudioOutputGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAudioOutputGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAudioOutputGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70597,25 +72873,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAudioOutputAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAudioOutputAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAudioOutputAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAudioOutputAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAudioOutputAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAudioOutputAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70667,25 +72946,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAudioOutputAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAudioOutputAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAudioOutputAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAudioOutputAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAudioOutputAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAudioOutputAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70737,7 +73019,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -70749,11 +73031,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -70806,7 +73090,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -70818,11 +73102,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -70974,25 +73260,28 @@ - (void)subscribeAttributeCatalogListWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationLauncherCatalogListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationLauncherCatalogListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationLauncherCatalogListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationLauncherCatalogListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationLauncherCatalogListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationLauncherCatalogListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCatalogListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71095,25 +73384,28 @@ - (void)subscribeAttributeCurrentAppWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationLauncherCurrentAppStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationLauncherCurrentAppStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationLauncherCurrentAppStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationLauncherCurrentAppStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationLauncherCurrentAppStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationLauncherCurrentAppStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentAppWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71167,25 +73459,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71239,25 +73535,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71309,25 +73609,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationLauncherAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationLauncherAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationLauncherAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationLauncherAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationLauncherAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationLauncherAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71379,7 +73682,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -71391,11 +73694,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -71448,7 +73753,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -71460,11 +73765,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -71534,25 +73841,28 @@ - (void)subscribeAttributeVendorNameWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71602,7 +73912,7 @@ - (void)subscribeAttributeVendorIDWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRVendorIdAttributeCallbackSubscriptionBridge( + __block MTRVendorIdAttributeCallbackSubscriptionBridge * callbackBridge = new MTRVendorIdAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -71614,11 +73924,13 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -71671,25 +73983,28 @@ - (void)subscribeAttributeApplicationNameWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeApplicationNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71740,7 +74055,7 @@ - (void)subscribeAttributeProductIDWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -71752,11 +74067,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -71810,25 +74127,28 @@ - (void)subscribeAttributeApplicationWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationBasicApplicationStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationBasicApplicationStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationBasicApplicationStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationBasicApplicationStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationBasicApplicationStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationBasicApplicationStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeApplicationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71880,25 +74200,29 @@ - (void)subscribeAttributeStatusWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71950,25 +74274,28 @@ - (void)subscribeAttributeApplicationVersionWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeApplicationVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72020,25 +74347,28 @@ - (void)subscribeAttributeAllowedVendorListWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationBasicAllowedVendorListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationBasicAllowedVendorListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationBasicAllowedVendorListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationBasicAllowedVendorListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationBasicAllowedVendorListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationBasicAllowedVendorListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAllowedVendorListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72092,25 +74422,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72164,25 +74498,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72234,25 +74572,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRApplicationBasicAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRApplicationBasicAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRApplicationBasicAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRApplicationBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRApplicationBasicAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRApplicationBasicAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72304,7 +74645,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -72316,11 +74657,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -72373,7 +74716,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -72385,11 +74728,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ApplicationBasicCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -72554,25 +74899,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccountLoginGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccountLoginGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccountLoginGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccountLoginGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccountLoginGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccountLoginGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72626,25 +74974,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccountLoginAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccountLoginAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccountLoginAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccountLoginAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccountLoginAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccountLoginAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72696,25 +75047,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRAccountLoginAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRAccountLoginAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRAccountLoginAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRAccountLoginAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRAccountLoginAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRAccountLoginAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72766,7 +75120,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -72778,11 +75132,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -72835,7 +75191,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -72847,11 +75203,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -72983,7 +75341,7 @@ - (void)subscribeAttributeMeasurementTypeWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -72995,11 +75353,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73052,7 +75412,7 @@ - (void)subscribeAttributeDcVoltageWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73064,11 +75424,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73120,7 +75482,7 @@ - (void)subscribeAttributeDcVoltageMinWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73132,11 +75494,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73189,7 +75553,7 @@ - (void)subscribeAttributeDcVoltageMaxWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73201,11 +75565,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73258,7 +75624,7 @@ - (void)subscribeAttributeDcCurrentWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73270,11 +75636,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73326,7 +75694,7 @@ - (void)subscribeAttributeDcCurrentMinWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73338,11 +75706,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73395,7 +75765,7 @@ - (void)subscribeAttributeDcCurrentMaxWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73407,11 +75777,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73463,7 +75835,7 @@ - (void)subscribeAttributeDcPowerWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73475,11 +75847,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73531,7 +75905,7 @@ - (void)subscribeAttributeDcPowerMinWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73543,11 +75917,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73599,7 +75975,7 @@ - (void)subscribeAttributeDcPowerMaxWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73611,11 +75987,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73669,7 +76047,7 @@ - (void)subscribeAttributeDcVoltageMultiplierWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73681,11 +76059,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73739,7 +76119,7 @@ - (void)subscribeAttributeDcVoltageDivisorWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73751,11 +76131,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73810,7 +76192,7 @@ - (void)subscribeAttributeDcCurrentMultiplierWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73822,11 +76204,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73880,7 +76264,7 @@ - (void)subscribeAttributeDcCurrentDivisorWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73892,11 +76276,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -73950,7 +76336,7 @@ - (void)subscribeAttributeDcPowerMultiplierWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -73962,11 +76348,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74020,7 +76408,7 @@ - (void)subscribeAttributeDcPowerDivisorWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74032,11 +76420,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74089,7 +76479,7 @@ - (void)subscribeAttributeAcFrequencyWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74101,11 +76491,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74159,7 +76551,7 @@ - (void)subscribeAttributeAcFrequencyMinWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74171,11 +76563,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74229,7 +76623,7 @@ - (void)subscribeAttributeAcFrequencyMaxWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74241,11 +76635,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74299,7 +76695,7 @@ - (void)subscribeAttributeNeutralCurrentWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74311,11 +76707,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74369,7 +76767,7 @@ - (void)subscribeAttributeTotalActivePowerWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32sAttributeCallbackSubscriptionBridge( + __block MTRInt32sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74381,11 +76779,13 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74439,7 +76839,7 @@ - (void)subscribeAttributeTotalReactivePowerWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32sAttributeCallbackSubscriptionBridge( + __block MTRInt32sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74451,11 +76851,13 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74509,7 +76911,7 @@ - (void)subscribeAttributeTotalApparentPowerWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74521,11 +76923,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74580,7 +76984,7 @@ - (void)subscribeAttributeMeasured1stHarmonicCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74592,11 +76996,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74651,7 +77057,7 @@ - (void)subscribeAttributeMeasured3rdHarmonicCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74663,11 +77069,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74722,7 +77130,7 @@ - (void)subscribeAttributeMeasured5thHarmonicCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74734,11 +77142,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74793,7 +77203,7 @@ - (void)subscribeAttributeMeasured7thHarmonicCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74805,11 +77215,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74864,7 +77276,7 @@ - (void)subscribeAttributeMeasured9thHarmonicCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74876,11 +77288,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -74935,7 +77349,7 @@ - (void)subscribeAttributeMeasured11thHarmonicCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -74947,11 +77361,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75006,7 +77422,7 @@ - (void)subscribeAttributeMeasuredPhase1stHarmonicCurrentWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75018,11 +77434,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75077,7 +77495,7 @@ - (void)subscribeAttributeMeasuredPhase3rdHarmonicCurrentWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75089,11 +77507,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75148,7 +77568,7 @@ - (void)subscribeAttributeMeasuredPhase5thHarmonicCurrentWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75160,11 +77580,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75219,7 +77641,7 @@ - (void)subscribeAttributeMeasuredPhase7thHarmonicCurrentWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75231,11 +77653,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75290,7 +77714,7 @@ - (void)subscribeAttributeMeasuredPhase9thHarmonicCurrentWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75302,11 +77726,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75361,7 +77787,7 @@ - (void)subscribeAttributeMeasuredPhase11thHarmonicCurrentWithMinInterval:(NSNum minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75373,11 +77799,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75432,7 +77860,7 @@ - (void)subscribeAttributeAcFrequencyMultiplierWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75444,11 +77872,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75502,7 +77932,7 @@ - (void)subscribeAttributeAcFrequencyDivisorWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75514,11 +77944,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75572,7 +78004,7 @@ - (void)subscribeAttributePowerMultiplierWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75584,11 +78016,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75641,7 +78075,7 @@ - (void)subscribeAttributePowerDivisorWithMinInterval:(NSNumber * _Nonnull)minIn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75653,11 +78087,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75712,7 +78148,7 @@ - (void)subscribeAttributeHarmonicCurrentMultiplierWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75724,11 +78160,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75783,7 +78221,7 @@ - (void)subscribeAttributePhaseHarmonicCurrentMultiplierWithMinInterval:(NSNumbe minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75795,11 +78233,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75854,7 +78294,7 @@ - (void)subscribeAttributeInstantaneousVoltageWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75866,11 +78306,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75925,7 +78367,7 @@ - (void)subscribeAttributeInstantaneousLineCurrentWithMinInterval:(NSNumber * _N minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -75937,11 +78379,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -75996,7 +78440,7 @@ - (void)subscribeAttributeInstantaneousActiveCurrentWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76008,11 +78452,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76067,7 +78513,7 @@ - (void)subscribeAttributeInstantaneousReactiveCurrentWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76079,11 +78525,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76137,7 +78585,7 @@ - (void)subscribeAttributeInstantaneousPowerWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76149,11 +78597,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76206,7 +78656,7 @@ - (void)subscribeAttributeRmsVoltageWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76218,11 +78668,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76275,7 +78727,7 @@ - (void)subscribeAttributeRmsVoltageMinWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76287,11 +78739,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76345,7 +78799,7 @@ - (void)subscribeAttributeRmsVoltageMaxWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76357,11 +78811,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76414,7 +78870,7 @@ - (void)subscribeAttributeRmsCurrentWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76426,11 +78882,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76483,7 +78941,7 @@ - (void)subscribeAttributeRmsCurrentMinWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76495,11 +78953,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76553,7 +79013,7 @@ - (void)subscribeAttributeRmsCurrentMaxWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76565,11 +79025,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76622,7 +79084,7 @@ - (void)subscribeAttributeActivePowerWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76634,11 +79096,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76692,7 +79156,7 @@ - (void)subscribeAttributeActivePowerMinWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76704,11 +79168,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76762,7 +79228,7 @@ - (void)subscribeAttributeActivePowerMaxWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76774,11 +79240,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76832,7 +79300,7 @@ - (void)subscribeAttributeReactivePowerWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76844,11 +79312,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76902,7 +79372,7 @@ - (void)subscribeAttributeApparentPowerWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76914,11 +79384,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -76971,7 +79443,7 @@ - (void)subscribeAttributePowerFactorWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -76983,11 +79455,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77083,7 +79557,7 @@ - (void)subscribeAttributeAverageRmsVoltageMeasurementPeriodWithMinInterval:(NSN minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77095,11 +79569,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77195,7 +79671,7 @@ - (void)subscribeAttributeAverageRmsUnderVoltageCounterWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77207,11 +79683,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77307,7 +79785,7 @@ - (void)subscribeAttributeRmsExtremeOverVoltagePeriodWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77319,11 +79797,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77419,7 +79899,7 @@ - (void)subscribeAttributeRmsExtremeUnderVoltagePeriodWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77431,11 +79911,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77528,7 +80010,7 @@ - (void)subscribeAttributeRmsVoltageSagPeriodWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77540,11 +80022,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77638,7 +80122,7 @@ - (void)subscribeAttributeRmsVoltageSwellPeriodWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77650,11 +80134,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77709,7 +80195,7 @@ - (void)subscribeAttributeAcVoltageMultiplierWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77721,11 +80207,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77779,7 +80267,7 @@ - (void)subscribeAttributeAcVoltageDivisorWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77791,11 +80279,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77850,7 +80340,7 @@ - (void)subscribeAttributeAcCurrentMultiplierWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77862,11 +80352,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77920,7 +80412,7 @@ - (void)subscribeAttributeAcCurrentDivisorWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -77932,11 +80424,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -77990,7 +80484,7 @@ - (void)subscribeAttributeAcPowerMultiplierWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78002,11 +80496,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78060,7 +80556,7 @@ - (void)subscribeAttributeAcPowerDivisorWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78072,11 +80568,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78168,7 +80666,7 @@ - (void)subscribeAttributeOverloadAlarmsMaskWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78180,11 +80678,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78238,7 +80738,7 @@ - (void)subscribeAttributeVoltageOverloadWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78250,11 +80750,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78308,7 +80810,7 @@ - (void)subscribeAttributeCurrentOverloadWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78320,11 +80822,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78417,7 +80921,7 @@ - (void)subscribeAttributeAcOverloadAlarmsMaskWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78429,11 +80933,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78487,7 +80993,7 @@ - (void)subscribeAttributeAcVoltageOverloadWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78499,11 +81005,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78557,7 +81065,7 @@ - (void)subscribeAttributeAcCurrentOverloadWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78569,11 +81077,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78628,7 +81138,7 @@ - (void)subscribeAttributeAcActivePowerOverloadWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78640,11 +81150,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78699,7 +81211,7 @@ - (void)subscribeAttributeAcReactivePowerOverloadWithMinInterval:(NSNumber * _No minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78711,11 +81223,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78770,7 +81284,7 @@ - (void)subscribeAttributeAverageRmsOverVoltageWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78782,11 +81296,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78841,7 +81357,7 @@ - (void)subscribeAttributeAverageRmsUnderVoltageWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78853,11 +81369,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78912,7 +81430,7 @@ - (void)subscribeAttributeRmsExtremeOverVoltageWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78924,11 +81442,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -78983,7 +81503,7 @@ - (void)subscribeAttributeRmsExtremeUnderVoltageWithMinInterval:(NSNumber * _Non minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -78995,11 +81515,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79053,7 +81575,7 @@ - (void)subscribeAttributeRmsVoltageSagWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79065,11 +81587,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79123,7 +81647,7 @@ - (void)subscribeAttributeRmsVoltageSwellWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79135,11 +81659,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79193,7 +81719,7 @@ - (void)subscribeAttributeLineCurrentPhaseBWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79205,11 +81731,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79264,7 +81792,7 @@ - (void)subscribeAttributeActiveCurrentPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79276,11 +81804,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79335,7 +81865,7 @@ - (void)subscribeAttributeReactiveCurrentPhaseBWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79347,11 +81877,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79405,7 +81937,7 @@ - (void)subscribeAttributeRmsVoltagePhaseBWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79417,11 +81949,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79476,7 +82010,7 @@ - (void)subscribeAttributeRmsVoltageMinPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79488,11 +82022,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79547,7 +82083,7 @@ - (void)subscribeAttributeRmsVoltageMaxPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79559,11 +82095,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79617,7 +82155,7 @@ - (void)subscribeAttributeRmsCurrentPhaseBWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79629,11 +82167,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79688,7 +82228,7 @@ - (void)subscribeAttributeRmsCurrentMinPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79700,11 +82240,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79759,7 +82301,7 @@ - (void)subscribeAttributeRmsCurrentMaxPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79771,11 +82313,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79829,7 +82373,7 @@ - (void)subscribeAttributeActivePowerPhaseBWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79841,11 +82385,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79900,7 +82446,7 @@ - (void)subscribeAttributeActivePowerMinPhaseBWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79912,11 +82458,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -79971,7 +82519,7 @@ - (void)subscribeAttributeActivePowerMaxPhaseBWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -79983,11 +82531,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80042,7 +82592,7 @@ - (void)subscribeAttributeReactivePowerPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80054,11 +82604,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80113,7 +82665,7 @@ - (void)subscribeAttributeApparentPowerPhaseBWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80125,11 +82677,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80183,7 +82737,7 @@ - (void)subscribeAttributePowerFactorPhaseBWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80195,11 +82749,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80254,7 +82810,7 @@ - (void)subscribeAttributeAverageRmsVoltageMeasurementPeriodPhaseBWithMinInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80266,11 +82822,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80326,7 +82884,7 @@ - (void)subscribeAttributeAverageRmsOverVoltageCounterPhaseBWithMinInterval:(NSN minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80338,11 +82896,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80397,7 +82957,7 @@ - (void)subscribeAttributeAverageRmsUnderVoltageCounterPhaseBWithMinInterval:(NS minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80409,11 +82969,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80468,7 +83030,7 @@ - (void)subscribeAttributeRmsExtremeOverVoltagePeriodPhaseBWithMinInterval:(NSNu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80480,11 +83042,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80539,7 +83103,7 @@ - (void)subscribeAttributeRmsExtremeUnderVoltagePeriodPhaseBWithMinInterval:(NSN minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80551,11 +83115,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80610,7 +83176,7 @@ - (void)subscribeAttributeRmsVoltageSagPeriodPhaseBWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80622,11 +83188,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80681,7 +83249,7 @@ - (void)subscribeAttributeRmsVoltageSwellPeriodPhaseBWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80693,11 +83261,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80751,7 +83321,7 @@ - (void)subscribeAttributeLineCurrentPhaseCWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80763,11 +83333,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80822,7 +83394,7 @@ - (void)subscribeAttributeActiveCurrentPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80834,11 +83406,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80893,7 +83467,7 @@ - (void)subscribeAttributeReactiveCurrentPhaseCWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80905,11 +83479,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -80963,7 +83539,7 @@ - (void)subscribeAttributeRmsVoltagePhaseCWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80975,11 +83551,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81034,7 +83612,7 @@ - (void)subscribeAttributeRmsVoltageMinPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81046,11 +83624,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81105,7 +83685,7 @@ - (void)subscribeAttributeRmsVoltageMaxPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81117,11 +83697,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81175,7 +83757,7 @@ - (void)subscribeAttributeRmsCurrentPhaseCWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81187,11 +83769,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81246,7 +83830,7 @@ - (void)subscribeAttributeRmsCurrentMinPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81258,11 +83842,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81317,7 +83903,7 @@ - (void)subscribeAttributeRmsCurrentMaxPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81329,11 +83915,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81387,7 +83975,7 @@ - (void)subscribeAttributeActivePowerPhaseCWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81399,11 +83987,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81458,7 +84048,7 @@ - (void)subscribeAttributeActivePowerMinPhaseCWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81470,11 +84060,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81529,7 +84121,7 @@ - (void)subscribeAttributeActivePowerMaxPhaseCWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81541,11 +84133,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81600,7 +84194,7 @@ - (void)subscribeAttributeReactivePowerPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81612,11 +84206,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81671,7 +84267,7 @@ - (void)subscribeAttributeApparentPowerPhaseCWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81683,11 +84279,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81741,7 +84339,7 @@ - (void)subscribeAttributePowerFactorPhaseCWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81753,11 +84351,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81812,7 +84412,7 @@ - (void)subscribeAttributeAverageRmsVoltageMeasurementPeriodPhaseCWithMinInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81824,11 +84424,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81884,7 +84486,7 @@ - (void)subscribeAttributeAverageRmsOverVoltageCounterPhaseCWithMinInterval:(NSN minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81896,11 +84498,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -81955,7 +84559,7 @@ - (void)subscribeAttributeAverageRmsUnderVoltageCounterPhaseCWithMinInterval:(NS minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81967,11 +84571,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -82026,7 +84632,7 @@ - (void)subscribeAttributeRmsExtremeOverVoltagePeriodPhaseCWithMinInterval:(NSNu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -82038,11 +84644,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -82097,7 +84705,7 @@ - (void)subscribeAttributeRmsExtremeUnderVoltagePeriodPhaseCWithMinInterval:(NSN minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -82109,11 +84717,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -82168,7 +84778,7 @@ - (void)subscribeAttributeRmsVoltageSagPeriodPhaseCWithMinInterval:(NSNumber * _ minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -82180,11 +84790,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -82239,7 +84851,7 @@ - (void)subscribeAttributeRmsVoltageSwellPeriodPhaseCWithMinInterval:(NSNumber * minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -82251,11 +84863,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -82310,25 +84924,29 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ElectricalMeasurement::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ElectricalMeasurement::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -82382,25 +85000,29 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ElectricalMeasurement::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ElectricalMeasurement::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -82452,25 +85074,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = ElectricalMeasurement::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ElectricalMeasurement::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRElectricalMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -82522,7 +85147,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -82534,11 +85159,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -82591,7 +85218,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -82603,11 +85230,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -84030,7 +86659,7 @@ - (void)subscribeAttributeBooleanWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -84042,11 +86671,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -84135,25 +86766,28 @@ - (void)subscribeAttributeBitmap8WithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterBitmap8AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::Bitmap8::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterBitmap8AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterBitmap8AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::Bitmap8::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterBitmap8AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterBitmap8AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterBitmap8AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap8WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84241,25 +86875,28 @@ - (void)subscribeAttributeBitmap16WithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterBitmap16AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::Bitmap16::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterBitmap16AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterBitmap16AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::Bitmap16::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterBitmap16AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterBitmap16AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterBitmap16AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap16WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84347,25 +86984,28 @@ - (void)subscribeAttributeBitmap32WithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterBitmap32AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::Bitmap32::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterBitmap32AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterBitmap32AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::Bitmap32::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterBitmap32AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterBitmap32AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterBitmap32AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap32WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84453,25 +87093,28 @@ - (void)subscribeAttributeBitmap64WithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterBitmap64AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::Bitmap64::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterBitmap64AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterBitmap64AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::Bitmap64::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterBitmap64AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterBitmap64AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterBitmap64AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap64WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84558,7 +87201,7 @@ - (void)subscribeAttributeInt8uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -84570,11 +87213,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -84663,7 +87308,7 @@ - (void)subscribeAttributeInt16uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -84675,11 +87320,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -84768,7 +87415,7 @@ - (void)subscribeAttributeInt24uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -84780,11 +87427,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -84873,7 +87522,7 @@ - (void)subscribeAttributeInt32uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -84885,11 +87534,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -84978,7 +87629,7 @@ - (void)subscribeAttributeInt40uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -84990,11 +87641,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85083,7 +87736,7 @@ - (void)subscribeAttributeInt48uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85095,11 +87748,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85188,7 +87843,7 @@ - (void)subscribeAttributeInt56uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85200,11 +87855,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85293,7 +87950,7 @@ - (void)subscribeAttributeInt64uWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85305,11 +87962,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85398,7 +88057,7 @@ - (void)subscribeAttributeInt8sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85410,11 +88069,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85503,7 +88164,7 @@ - (void)subscribeAttributeInt16sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85515,11 +88176,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85608,7 +88271,7 @@ - (void)subscribeAttributeInt24sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32sAttributeCallbackSubscriptionBridge( + __block MTRInt32sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85620,11 +88283,13 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85713,7 +88378,7 @@ - (void)subscribeAttributeInt32sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32sAttributeCallbackSubscriptionBridge( + __block MTRInt32sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85725,11 +88390,13 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85818,7 +88485,7 @@ - (void)subscribeAttributeInt40sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64sAttributeCallbackSubscriptionBridge( + __block MTRInt64sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85830,11 +88497,13 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -85923,7 +88592,7 @@ - (void)subscribeAttributeInt48sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64sAttributeCallbackSubscriptionBridge( + __block MTRInt64sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -85935,11 +88604,13 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86028,7 +88699,7 @@ - (void)subscribeAttributeInt56sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64sAttributeCallbackSubscriptionBridge( + __block MTRInt64sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -86040,11 +88711,13 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86133,7 +88806,7 @@ - (void)subscribeAttributeInt64sWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64sAttributeCallbackSubscriptionBridge( + __block MTRInt64sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -86145,11 +88818,13 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86238,7 +88913,7 @@ - (void)subscribeAttributeEnum8WithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -86250,11 +88925,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86343,7 +89020,7 @@ - (void)subscribeAttributeEnum16WithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -86355,11 +89032,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86449,7 +89128,7 @@ - (void)subscribeAttributeFloatSingleWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRFloatAttributeCallbackSubscriptionBridge( + __block MTRFloatAttributeCallbackSubscriptionBridge * callbackBridge = new MTRFloatAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -86461,11 +89140,13 @@ new MTRFloatAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRFloatAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86556,7 +89237,7 @@ - (void)subscribeAttributeFloatDoubleWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRDoubleAttributeCallbackSubscriptionBridge( + __block MTRDoubleAttributeCallbackSubscriptionBridge * callbackBridge = new MTRDoubleAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -86568,11 +89249,13 @@ new MTRDoubleAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRDoubleAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRDoubleAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -86663,25 +89346,28 @@ - (void)subscribeAttributeOctetStringWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::OctetString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::OctetString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -86790,25 +89476,28 @@ - (void)subscribeAttributeListInt8uWithMinInterval:(NSNumber * _Nonnull)minInter minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterListInt8uListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::ListInt8u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterListInt8uListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterListInt8uListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::ListInt8u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterListInt8uListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterListInt8uListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterListInt8uListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListInt8uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -86918,25 +89607,28 @@ - (void)subscribeAttributeListOctetStringWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterListOctetStringListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::ListOctetString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterListOctetStringListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterListOctetStringListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::ListOctetString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterListOctetStringListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterListOctetStringListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterListOctetStringListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87050,25 +89742,28 @@ - (void)subscribeAttributeListStructOctetStringWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterListStructOctetStringListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::ListStructOctetString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterListStructOctetStringListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterListStructOctetStringListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::ListStructOctetString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterListStructOctetStringListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterListStructOctetStringListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterListStructOctetStringListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListStructOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87159,25 +89854,28 @@ - (void)subscribeAttributeLongOctetStringWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTROctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::LongOctetString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTROctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTROctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::LongOctetString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTROctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTROctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTROctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLongOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87266,25 +89964,28 @@ - (void)subscribeAttributeCharStringWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::CharString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::CharString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCharStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87373,25 +90074,28 @@ - (void)subscribeAttributeLongCharStringWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::LongCharString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::LongCharString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLongCharStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87479,7 +90183,7 @@ - (void)subscribeAttributeEpochUsWithMinInterval:(NSNumber * _Nonnull)minInterva minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt64uAttributeCallbackSubscriptionBridge( + __block MTRInt64uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt64uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -87491,11 +90195,13 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -87584,7 +90290,7 @@ - (void)subscribeAttributeEpochSWithMinInterval:(NSNumber * _Nonnull)minInterval minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -87596,11 +90302,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -87690,7 +90398,7 @@ - (void)subscribeAttributeVendorIdWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRVendorIdAttributeCallbackSubscriptionBridge( + __block MTRVendorIdAttributeCallbackSubscriptionBridge * callbackBridge = new MTRVendorIdAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -87702,11 +90410,13 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -87994,25 +90704,29 @@ - (void)subscribeAttributeListNullablesAndOptionalsStructWithMinInterval:(NSNumb minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, - nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListNullablesAndOptionalsStructWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88102,25 +90816,28 @@ - (void)subscribeAttributeEnumAttrWithMinInterval:(NSNumber * _Nonnull)minInterv minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::EnumAttr::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::EnumAttr::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEnumAttrWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88220,25 +90937,28 @@ - (void)subscribeAttributeStructAttrWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterStructAttrStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::StructAttr::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterStructAttrStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterStructAttrStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::StructAttr::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterStructAttrStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterStructAttrStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterStructAttrStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStructAttrWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88330,7 +91050,7 @@ - (void)subscribeAttributeRangeRestrictedInt8uWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -88342,11 +91062,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -88439,7 +91161,7 @@ - (void)subscribeAttributeRangeRestrictedInt8sWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8sAttributeCallbackSubscriptionBridge( + __block MTRInt8sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -88451,11 +91173,13 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -88549,7 +91273,7 @@ - (void)subscribeAttributeRangeRestrictedInt16uWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -88561,11 +91285,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -88659,7 +91385,7 @@ - (void)subscribeAttributeRangeRestrictedInt16sWithMinInterval:(NSNumber * _Nonn minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16sAttributeCallbackSubscriptionBridge( + __block MTRInt16sAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16sAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -88671,11 +91397,13 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -88789,25 +91517,28 @@ - (void)subscribeAttributeListLongOctetStringWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterListLongOctetStringListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::ListLongOctetString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterListLongOctetStringListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterListLongOctetStringListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::ListLongOctetString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterListLongOctetStringListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterListLongOctetStringListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterListLongOctetStringListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListLongOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88977,25 +91708,28 @@ - (void)subscribeAttributeListFabricScopedWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterListFabricScopedListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::ListFabricScoped::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterListFabricScopedListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterListFabricScopedListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::ListFabricScoped::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterListFabricScopedListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterListFabricScopedListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterListFabricScopedListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListFabricScopedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89086,7 +91820,7 @@ - (void)subscribeAttributeTimedWriteBooleanWithMinInterval:(NSNumber * _Nonnull) minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -89098,11 +91832,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -89195,7 +91931,7 @@ - (void)subscribeAttributeGeneralErrorBooleanWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -89207,11 +91943,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -89304,7 +92042,7 @@ - (void)subscribeAttributeClusterErrorBooleanWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -89316,11 +92054,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -89411,7 +92151,7 @@ - (void)subscribeAttributeUnsupportedWithMinInterval:(NSNumber * _Nonnull)minInt minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRBooleanAttributeCallbackSubscriptionBridge( + __block MTRBooleanAttributeCallbackSubscriptionBridge * callbackBridge = new MTRBooleanAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -89423,11 +92163,13 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -89524,25 +92266,28 @@ - (void)subscribeAttributeNullableBooleanWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableBooleanAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableBoolean::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableBooleanAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableBooleanAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableBoolean::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBooleanWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89637,25 +92382,28 @@ - (void)subscribeAttributeNullableBitmap8WithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterNullableBitmap8AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableBitmap8::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterNullableBitmap8AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterNullableBitmap8AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableBitmap8::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterNullableBitmap8AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterNullableBitmap8AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterNullableBitmap8AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap8WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89751,25 +92499,28 @@ - (void)subscribeAttributeNullableBitmap16WithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterNullableBitmap16AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableBitmap16::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterNullableBitmap16AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterNullableBitmap16AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableBitmap16::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterNullableBitmap16AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterNullableBitmap16AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterNullableBitmap16AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap16WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89865,25 +92616,28 @@ - (void)subscribeAttributeNullableBitmap32WithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterNullableBitmap32AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableBitmap32::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterNullableBitmap32AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterNullableBitmap32AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableBitmap32::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterNullableBitmap32AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterNullableBitmap32AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterNullableBitmap32AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap32WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89979,25 +92733,28 @@ - (void)subscribeAttributeNullableBitmap64WithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterNullableBitmap64AttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableBitmap64::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterNullableBitmap64AttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterNullableBitmap64AttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableBitmap64::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterNullableBitmap64AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterNullableBitmap64AttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterNullableBitmap64AttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap64WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90093,25 +92850,28 @@ - (void)subscribeAttributeNullableInt8uWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt8u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt8u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt8uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90206,25 +92966,28 @@ - (void)subscribeAttributeNullableInt16uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt16u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt16u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt16uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90319,25 +93082,28 @@ - (void)subscribeAttributeNullableInt24uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt24u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt24u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt24uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90432,25 +93198,28 @@ - (void)subscribeAttributeNullableInt32uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt32u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt32u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt32uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90545,25 +93314,28 @@ - (void)subscribeAttributeNullableInt40uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt40u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt40u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt40uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90658,25 +93430,28 @@ - (void)subscribeAttributeNullableInt48uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt48u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt48u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt48uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90771,25 +93546,28 @@ - (void)subscribeAttributeNullableInt56uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt56u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt56u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt56uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90884,25 +93662,28 @@ - (void)subscribeAttributeNullableInt64uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt64u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt64u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt64uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90997,25 +93778,28 @@ - (void)subscribeAttributeNullableInt8sWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt8s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt8s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt8sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91110,25 +93894,28 @@ - (void)subscribeAttributeNullableInt16sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt16s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt16s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt16sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91223,25 +94010,28 @@ - (void)subscribeAttributeNullableInt24sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt24s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt24s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt24sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91336,25 +94126,28 @@ - (void)subscribeAttributeNullableInt32sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt32sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt32s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt32sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt32sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt32s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt32sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91449,25 +94242,28 @@ - (void)subscribeAttributeNullableInt40sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt40s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt40s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt40sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91562,25 +94358,28 @@ - (void)subscribeAttributeNullableInt48sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt48s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt48s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt48sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91675,25 +94474,28 @@ - (void)subscribeAttributeNullableInt56sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt56s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt56s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt56sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91788,25 +94590,28 @@ - (void)subscribeAttributeNullableInt64sWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt64sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableInt64s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt64sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt64sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableInt64s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt64sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91901,25 +94706,28 @@ - (void)subscribeAttributeNullableEnum8WithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableEnum8::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableEnum8::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableEnum8WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92014,25 +94822,28 @@ - (void)subscribeAttributeNullableEnum16WithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableEnum16::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableEnum16::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableEnum16WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92128,25 +94939,28 @@ - (void)subscribeAttributeNullableFloatSingleWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableFloatAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableFloatSingle::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableFloatAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableFloatAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableFloatSingle::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableFloatAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableFloatSingleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92242,25 +95056,28 @@ - (void)subscribeAttributeNullableFloatDoubleWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableDoubleAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableFloatDouble::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableDoubleAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableDoubleAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableFloatDouble::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableDoubleAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableDoubleAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableDoubleAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableFloatDoubleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92356,25 +95173,28 @@ - (void)subscribeAttributeNullableOctetStringWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableOctetString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableOctetStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableOctetStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableOctetString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableOctetStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableOctetStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92469,25 +95289,28 @@ - (void)subscribeAttributeNullableCharStringWithMinInterval:(NSNumber * _Nonnull minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableCharStringAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableCharString::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableCharStringAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableCharStringAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableCharString::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableCharStringAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableCharStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92582,25 +95405,28 @@ - (void)subscribeAttributeNullableEnumAttrWithMinInterval:(NSNumber * _Nonnull)m minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableEnumAttr::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableEnumAttr::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableTestClusterClusterSimpleEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableEnumAttrWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92706,25 +95532,28 @@ - (void)subscribeAttributeNullableStructWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterNullableStructStructAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableStruct::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterNullableStructStructAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterNullableStructStructAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableStruct::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterNullableStructStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterNullableStructStructAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterNullableStructStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableStructWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92824,25 +95653,28 @@ - (void)subscribeAttributeNullableRangeRestrictedInt8uWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt8u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt8u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt8uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92941,25 +95773,28 @@ - (void)subscribeAttributeNullableRangeRestrictedInt8sWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt8sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt8s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt8sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt8sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt8s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt8sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93058,25 +95893,28 @@ - (void)subscribeAttributeNullableRangeRestrictedInt16uWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16uAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt16u::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16uAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt16u::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt16uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93175,25 +96013,28 @@ - (void)subscribeAttributeNullableRangeRestrictedInt16sWithMinInterval:(NSNumber minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRNullableInt16sAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt16s::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRNullableInt16sAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRNullableInt16sAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::NullableRangeRestrictedInt16s::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRNullableInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRNullableInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt16sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93283,7 +96124,7 @@ - (void)subscribeAttributeWriteOnlyInt8uWithMinInterval:(NSNumber * _Nonnull)min minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt8uAttributeCallbackSubscriptionBridge( + __block MTRInt8uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -93295,11 +96136,13 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -93354,25 +96197,28 @@ - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnu minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterGeneratedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::GeneratedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterGeneratedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterGeneratedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::GeneratedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93426,25 +96272,28 @@ - (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnul minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterAcceptedCommandListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::AcceptedCommandList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterAcceptedCommandListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterAcceptedCommandListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::AcceptedCommandList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93496,25 +96345,28 @@ - (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minI minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge( - self.callbackQueue, self.device, reportHandler, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { - if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { - // We don't support disabling auto-resubscribe. - return CHIP_ERROR_INVALID_ARGUMENT; - } - using TypeInfo = TestCluster::Attributes::AttributeList::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); + __block MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge * callbackBridge + = new MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge( + self.callbackQueue, self.device, reportHandler, + ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = TestCluster::Attributes::AttributeList::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); - chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); - return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, - [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, - params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - }, - subscriptionEstablishedHandler); + chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + MTRTestClusterAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93566,7 +96418,7 @@ - (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInte minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt32uAttributeCallbackSubscriptionBridge( + __block MTRInt32uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt32uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -93578,11 +96430,13 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); } @@ -93635,7 +96489,7 @@ - (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)mi minInterval = [minInterval copy]; maxInterval = [maxInterval copy]; params = [params copy]; - new MTRInt16uAttributeCallbackSubscriptionBridge( + __block MTRInt16uAttributeCallbackSubscriptionBridge * callbackBridge = new MTRInt16uAttributeCallbackSubscriptionBridge( self.callbackQueue, self.device, reportHandler, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -93647,11 +96501,13 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( auto failureFn = Callback::FromCancelable(failure); chip::Controller::TestClusterCluster cppCluster(exchangeManager, session, self->_endpoint); + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; return cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], - params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue], + chip::NullOptional, [innerCallbackBridge](void) { delete innerCallbackBridge; }); }, subscriptionEstablishedHandler); }