From 803f9a68f494d5cd848fa8187ae755a93a5334cd 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 | 6 +- src/controller/CHIPCluster.h | 11 +- src/controller/ReadInteraction.h | 23 +- src/controller/tests/data_model/TestRead.cpp | 26 +- .../CHIP/templates/MTRBaseClusters-src.zapt | 5 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 26401 +++++++++------- 6 files changed, 14903 insertions(+), 11569 deletions(-) diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index 0219bb309c1963..c3cec00c7c086c 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -64,11 +64,11 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Run iOS Build Debug - timeout-minutes: 30 + timeout-minutes: 40 working-directory: src/darwin/Framework run: xcodebuild -target "Matter" -sdk iphoneos - name: Run iOS Build Release - timeout-minutes: 30 + timeout-minutes: 40 working-directory: src/darwin/Framework run: xcodebuild -target "Matter" -sdk iphoneos -configuration Release - name: Clean Build @@ -78,7 +78,7 @@ jobs: run: defaults delete com.apple.dt.xctest.tool continue-on-error: true - name: Run macOS Build - timeout-minutes: 40 + timeout-minutes: 50 # 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..d875d8923052ce 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 { @@ -261,12 +262,13 @@ class DLL_EXPORT ClusterBase SubscribeAttribute(void * context, ReadResponseSuccessCallback reportCb, ReadResponseFailureCallback failureCb, uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds, SubscriptionEstablishedCallback subscriptionEstablishedCb = nullptr, - ResubscriptionAttemptCallback resubscriptionAttemptCb = nullptr, bool aIsFabricFiltered = true, + ResubscriptionAttemptCallback resubscriptionAttemptCb = nullptr, + SubscriptionOnDoneCallback subscriptionDoneCb = nullptr, bool aIsFabricFiltered = true, bool aKeepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) { return SubscribeAttribute( context, AttributeInfo::GetClusterId(), AttributeInfo::GetAttributeId(), reportCb, failureCb, minIntervalFloorSeconds, - maxIntervalCeilingSeconds, subscriptionEstablishedCb, resubscriptionAttemptCb, aIsFabricFiltered, + maxIntervalCeilingSeconds, subscriptionEstablishedCb, resubscriptionAttemptCb, subscriptionDoneCb, aIsFabricFiltered, aKeepPreviousSubscriptions, aDataVersion); } @@ -275,7 +277,8 @@ class DLL_EXPORT ClusterBase ReadResponseSuccessCallback reportCb, ReadResponseFailureCallback failureCb, uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds, SubscriptionEstablishedCallback subscriptionEstablishedCb = nullptr, - ResubscriptionAttemptCallback resubscriptionAttemptCb = nullptr, bool aIsFabricFiltered = true, + ResubscriptionAttemptCallback resubscriptionAttemptCb = nullptr, + SubscriptionOnDoneCallback subscriptionDoneCb = nullptr, bool aIsFabricFiltered = true, bool aKeepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) { @@ -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); + subscriptionDoneCb, aIsFabricFiltered, aKeepPreviousSubscriptions, aDataVersion); } /** diff --git a/src/controller/ReadInteraction.h b/src/controller/ReadInteraction.h index cc4838cfafad45..075fbb57cd6d27 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) + typename detail::SubscriptionOnDoneCallback onDoneCb = nullptr, bool fabricFiltered = true, + bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) { 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; @@ -184,13 +196,14 @@ CHIP_ERROR SubscribeAttribute( typename TypedReadAttributeCallback::OnSubscriptionEstablishedCallbackType onSubscriptionEstablishedCb = nullptr, typename TypedReadAttributeCallback::OnResubscriptionAttemptCallbackType - onResubscriptionAttemptCb = nullptr, - bool fabricFiltered = true, bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) + onResubscriptionAttemptCb = nullptr, + typename detail::SubscriptionOnDoneCallback onDoneCb = nullptr, bool fabricFiltered = true, + bool keepPreviousSubscriptions = false, const Optional & aDataVersion = NullOptional) { return SubscribeAttribute( exchangeMgr, sessionHandle, endpointId, AttributeTypeInfo::GetClusterId(), AttributeTypeInfo::GetAttributeId(), onReportCb, onErrorCb, aMinIntervalFloorSeconds, aMaxIntervalCeilingSeconds, onSubscriptionEstablishedCb, onResubscriptionAttemptCb, - fabricFiltered, keepPreviousSubscriptions, aDataVersion); + onDoneCb, fabricFiltered, keepPreviousSubscriptions, aDataVersion); } namespace detail { diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index 3da6e03ccdb905..a1d2fd594d31b5 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -1723,7 +1723,7 @@ void TestReadInteraction::TestReadHandler_MultipleSubscriptions(nlTestSuite * ap NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 20, - onSubscriptionEstablishedCb, nullptr, false, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, false, true) == CHIP_NO_ERROR); } // There are too many messages and the test (gcc_debug, which includes many sanity checks) will be quite slow. Note: report @@ -1787,7 +1787,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionAppRejection(nlTestSuite * NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, - onSubscriptionEstablishedCb, nullptr, false, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, false, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -1860,7 +1860,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest1(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 5, 5, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -1935,7 +1935,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest2(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2010,7 +2010,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest3(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2076,7 +2076,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest4(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2150,7 +2150,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest5(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2225,7 +2225,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest6(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2299,7 +2299,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest7(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2364,7 +2364,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest8(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); @@ -2428,7 +2428,7 @@ void TestReadInteraction::TestReadHandler_SubscriptionReportingIntervalsTest9(nl NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 5, 4, - onSubscriptionEstablishedCb, nullptr, true) == CHIP_ERROR_INVALID_ARGUMENT); + onSubscriptionEstablishedCb, nullptr, nullptr, true) == CHIP_ERROR_INVALID_ARGUMENT); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -2533,7 +2533,7 @@ void TestReadInteraction::SubscribeThenReadHelper(nlTestSuite * apSuite, TestCon NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &aCtx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, - onSubscriptionEstablishedCb, nullptr, false, true) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, false, true) == CHIP_NO_ERROR); } aCtx.DrainAndServiceIO(); @@ -2632,7 +2632,7 @@ void TestReadInteraction::TestReadHandler_MultipleSubscriptionsWithDataVersionFi NL_TEST_ASSERT(apSuite, Controller::SubscribeAttribute( &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, - onSubscriptionEstablishedCb, nullptr, false, true, dataVersion) == CHIP_NO_ERROR); + onSubscriptionEstablishedCb, nullptr, nullptr, false, true, dataVersion) == CHIP_NO_ERROR); } // There are too many messages and the test (gcc_debug, which includes many sanity checks) will be quite slow. Note: report diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index c32c72be7e9b8c..8debf99372d3a2 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,7 +205,9 @@ 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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue] ); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 8f5fec474c7a2b..4bdef47449b7ed 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,9 +186,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -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,9 +257,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -313,25 +318,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -385,25 +394,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -455,25 +468,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -525,7 +542,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,9 +554,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -594,7 +613,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,9 +625,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -862,7 +883,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,9 +895,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -933,25 +956,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -1005,25 +1032,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -1075,25 +1106,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -1144,7 +1179,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,9 +1191,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -1213,7 +1250,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,9 +1262,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -1721,7 +1760,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,9 +1772,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -1789,7 +1830,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,9 +1842,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -1858,7 +1901,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,9 +1913,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -1927,7 +1972,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,9 +1984,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -1995,7 +2042,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,9 +2054,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -2065,25 +2114,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastConfiguredByWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2136,25 +2189,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2208,25 +2265,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2278,25 +2339,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -2347,7 +2412,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,9 +2424,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -2416,7 +2483,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,9 +2495,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -2681,7 +2750,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,9 +2762,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -2750,7 +2821,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,9 +2833,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -2856,7 +2929,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,9 +2941,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -2962,7 +3037,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,9 +3049,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -3074,25 +3151,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpOnOffWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3146,25 +3227,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3218,25 +3303,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3288,25 +3377,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3357,7 +3450,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,9 +3462,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -3426,7 +3521,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,9 +3533,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -3512,7 +3609,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,9 +3621,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -3619,7 +3718,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,9 +3730,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -3691,25 +3792,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3765,25 +3873,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3836,25 +3951,30 @@ - (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); - - 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); + __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); + MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROnOffSwitchConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -3906,7 +4026,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,9 +4038,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -3975,7 +4097,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,9 +4109,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4362,25 +4486,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -4432,7 +4560,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,9 +4572,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4501,7 +4631,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,9 +4643,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4569,7 +4701,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,9 +4713,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4638,7 +4772,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,9 +4784,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4707,7 +4843,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,9 +4855,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4776,7 +4914,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,9 +4926,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4882,7 +5022,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,9 +5034,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -4990,7 +5132,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,9 +5144,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -5101,25 +5245,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOnLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5213,25 +5361,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOnTransitionTimeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5326,25 +5478,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOffTransitionTimeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5439,25 +5595,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDefaultMoveRateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5553,25 +5713,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpCurrentLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5624,25 +5788,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5696,25 +5864,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5766,25 +5938,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -5836,7 +6012,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,9 +6024,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -5905,7 +6083,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,9 +6095,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6029,25 +6209,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveTextWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6135,25 +6318,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6242,25 +6428,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeInactiveTextWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6349,7 +6538,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,9 +6550,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6418,7 +6609,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,9 +6621,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6524,7 +6717,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,9 +6729,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6631,7 +6826,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,9 +6838,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6700,7 +6897,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,9 +6909,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6770,7 +6969,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,9 +6981,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -6841,25 +7042,30 @@ - (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); - - 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); + __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); + MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRBinaryInputBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6913,25 +7119,30 @@ - (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); - - 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); + __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); + MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRBinaryInputBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -6983,25 +7194,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7053,7 +7268,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,9 +7280,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -7122,7 +7339,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,9 +7351,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -7208,25 +7427,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDeviceListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7277,25 +7500,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeServerListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7345,25 +7572,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeClientListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7413,25 +7644,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartsListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7483,25 +7718,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7555,25 +7794,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7625,25 +7868,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7695,7 +7942,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,9 +7954,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -7764,7 +8013,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,9 +8025,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -7927,25 +8178,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBindingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -7997,25 +8252,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8069,25 +8328,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8139,25 +8402,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8208,7 +8475,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,9 +8487,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -8277,7 +8546,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,9 +8558,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -8501,25 +8772,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAclWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8631,25 +8906,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeExtensionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8702,7 +8981,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,9 +8993,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -8773,7 +9054,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,9 +9066,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -8844,7 +9127,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,9 +9139,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -8915,25 +9200,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -8987,25 +9276,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9057,25 +9350,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9127,7 +9424,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,9 +9436,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -9196,7 +9495,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,9 +9507,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -9664,25 +9965,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActionListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9732,25 +10037,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEndpointListsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9801,25 +10110,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSetupURLWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9871,25 +10183,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -9943,25 +10259,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10013,25 +10333,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10082,7 +10406,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,9 +10418,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -10151,7 +10477,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,9 +10489,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -10269,7 +10597,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,9 +10609,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -10338,25 +10668,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10406,7 +10739,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,9 +10751,11 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( 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], - MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -10474,25 +10809,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10543,7 +10881,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,9 +10893,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -10649,25 +10989,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNodeLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10755,25 +11098,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10824,7 +11170,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,9 +11182,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -10895,25 +11243,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeHardwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -10965,7 +11316,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,9 +11328,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -11036,25 +11389,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSoftwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11106,25 +11462,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeManufacturingDateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11175,25 +11534,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11243,25 +11605,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductURLWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11311,25 +11676,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11380,25 +11748,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSerialNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11489,7 +11860,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,9 +11872,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -11558,7 +11931,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,9 +11943,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -11626,25 +12001,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUniqueIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11695,25 +12073,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCapabilityMinimaWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11767,25 +12149,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11839,25 +12225,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11909,25 +12299,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -11978,7 +12372,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,9 +12384,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -12047,7 +12443,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,9 +12455,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -12257,25 +12655,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12331,25 +12736,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12402,25 +12814,30 @@ - (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); - - 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); + __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); + MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateProviderAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12472,7 +12889,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,9 +12901,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -12541,7 +12960,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,9 +12972,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -12729,25 +13150,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDefaultOtaProvidersWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12801,7 +13229,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,9 +13241,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -12872,27 +13302,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUpdateStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -12947,25 +13382,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUpdateStateProgressWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13019,25 +13458,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13093,25 +13539,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13164,25 +13617,30 @@ - (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); - - 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); + __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); + MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROtaSoftwareUpdateRequestorAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13234,7 +13692,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,9 +13704,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -13303,7 +13763,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,9 +13775,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -13427,25 +13889,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveLocaleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13497,25 +13962,30 @@ - (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); - - 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); + __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); + MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRLocalizationConfigurationSupportedLocalesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedLocalesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13570,25 +14040,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13644,25 +14121,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13715,25 +14199,30 @@ - (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); - - 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); + __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); + MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRLocalizationConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -13785,7 +14274,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,9 +14286,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -13854,7 +14345,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,9 +14357,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -13978,25 +14471,30 @@ - (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); - - 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); + __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); + MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationClusterHourFormatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeHourFormatWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14086,25 +14584,30 @@ - (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); - - 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); + __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); + MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationClusterCalendarTypeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveCalendarTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14159,25 +14662,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedCalendarTypesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14232,25 +14742,30 @@ - (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); - - 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); + __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); + MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14304,25 +14819,30 @@ - (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); - - 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); + __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); + MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14374,25 +14894,30 @@ - (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); - - 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); + __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); + MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTimeFormatLocalizationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14444,7 +14969,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,9 +14981,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -14513,7 +15040,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,9 +15052,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -14638,25 +15167,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTemperatureUnitWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14710,25 +15243,30 @@ - (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); - - 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); + __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); + MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRUnitLocalizationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14782,25 +15320,30 @@ - (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); - - 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); + __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); + MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRUnitLocalizationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14852,25 +15395,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -14922,7 +15469,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,9 +15481,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -14991,7 +15540,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,9 +15552,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -15076,25 +15627,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSourcesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15148,25 +15703,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15222,25 +15784,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15293,25 +15862,30 @@ - (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); - - 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); + __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); + MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRPowerSourceConfigurationAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15363,7 +15937,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,9 +15949,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -15432,7 +16008,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,9 +16020,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -15517,25 +16095,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15585,7 +16167,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,9 +16179,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -15653,25 +16237,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15724,25 +16311,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredAssessedInputVoltageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15795,25 +16386,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredAssessedInputFrequencyWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15865,25 +16460,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredCurrentTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -15937,25 +16536,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiredAssessedCurrentWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16008,7 +16611,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,9 +16623,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -16079,7 +16684,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,9 +16696,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -16148,7 +16755,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,9 +16767,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -16218,25 +16827,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveWiredFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16288,25 +16901,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatVoltageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16358,25 +16975,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatPercentRemainingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16428,25 +17049,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatTimeRemainingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16498,25 +17123,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatChargeLevelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16570,7 +17199,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,9 +17211,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -16640,25 +17271,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatReplaceabilityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16710,7 +17345,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,9 +17357,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -16779,25 +17416,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveBatFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16851,25 +17492,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatReplacementDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -16922,7 +17566,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,9 +17578,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -16992,25 +17638,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatANSIDesignationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17062,25 +17711,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatIECDesignationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17133,7 +17785,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,9 +17797,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -17202,7 +17856,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,9 +17868,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -17271,7 +17927,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,9 +17939,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -17341,25 +17999,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatChargeStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17413,25 +18075,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatTimeToFullChargeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17484,7 +18150,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,9 +18162,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -17554,25 +18222,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBatChargingCurrentWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17625,25 +18297,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveBatChargeFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17697,25 +18373,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17769,25 +18449,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17839,25 +18523,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -17909,7 +18597,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,9 +18609,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -17978,7 +18668,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,9 +18680,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -18189,7 +18881,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,9 +18893,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -18261,25 +18955,32 @@ 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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBasicCommissioningInfoWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18335,25 +19036,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRegulatoryConfigWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18408,25 +19116,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocationCapabilityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18481,7 +19196,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,9 +19208,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -18552,25 +19269,30 @@ - (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); - - 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); + __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); + MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18624,25 +19346,30 @@ - (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); - - 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); + __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); + MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18694,25 +19421,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -18764,7 +19495,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,9 +19507,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -18833,7 +19566,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,9 +19578,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -19105,7 +19840,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,9 +19852,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -19173,25 +19910,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNetworksWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19243,7 +19984,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,9 +19996,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -19314,7 +20057,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,9 +20069,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -19422,7 +20167,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,9 +20179,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -19495,27 +20242,34 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastNetworkingStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19569,25 +20323,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastNetworkIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19640,25 +20398,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLastConnectErrorValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19711,25 +20473,30 @@ - (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); - - 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); + __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); + MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRNetworkCommissioningGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19783,25 +20550,30 @@ - (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); - - 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); + __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); + MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRNetworkCommissioningAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19853,25 +20625,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -19923,7 +20699,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,9 +20711,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -19992,7 +20770,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,9 +20782,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20108,25 +20888,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20180,25 +20964,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20250,25 +21038,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20320,7 +21112,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,9 +21124,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20389,7 +21183,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,9 +21195,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20505,25 +21301,30 @@ - (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); - - 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); + __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); + MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsNetworkInterfacesListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNetworkInterfacesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20575,7 +21376,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,9 +21388,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20643,7 +21446,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,9 +21458,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20713,7 +21518,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,9 +21530,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20782,7 +21589,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,9 +21601,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -20853,25 +21662,30 @@ - (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); - - 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); + __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); + MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsActiveHardwareFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveHardwareFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20924,25 +21738,30 @@ - (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); - - 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); + __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); + MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsActiveRadioFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveRadioFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -20996,25 +21815,30 @@ - (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); - - 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); + __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); + MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsActiveNetworkFaultsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveNetworkFaultsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21068,7 +21892,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,9 +21904,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -21139,25 +21965,30 @@ - (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); - - 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); + __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); + MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21211,25 +22042,30 @@ - (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); - - 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); + __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); + MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGeneralDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21281,25 +22117,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21351,7 +22191,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,9 +22203,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -21420,7 +22262,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,9 +22274,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -21537,25 +22381,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeThreadMetricsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21608,7 +22456,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,9 +22468,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -21678,7 +22528,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,9 +22540,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -21749,7 +22601,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,9 +22613,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -21820,25 +22674,30 @@ - (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); - - 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); + __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); + MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRSoftwareDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21892,25 +22751,30 @@ - (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); - - 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); + __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); + MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRSoftwareDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -21962,25 +22826,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22032,7 +22900,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,9 +22912,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -22101,7 +22971,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,9 +22983,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -22217,25 +23089,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22286,25 +23162,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRoutingRoleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22357,25 +23240,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNetworkNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22425,25 +23312,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePanIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22494,25 +23385,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeExtendedPanIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22564,25 +23459,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeshLocalPrefixWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22633,7 +23532,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,9 +23544,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -22703,25 +23604,30 @@ - (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); - - 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); + __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); + MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsNeighborTableListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNeighborTableListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22774,25 +23680,30 @@ - (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); - - 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); + __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); + MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsRouteTableListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRouteTableListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22844,25 +23755,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartitionIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22913,25 +23828,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWeightingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -22981,25 +23900,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDataVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -23051,25 +23974,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStableDataVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -23121,25 +24048,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLeaderRouterIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -23191,7 +24122,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,9 +24134,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23261,7 +24194,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,9 +24206,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23331,7 +24266,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,9 +24278,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23401,7 +24338,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,9 +24350,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23471,7 +24410,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,9 +24422,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23542,7 +24483,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,9 +24495,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23613,7 +24556,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,9 +24568,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23683,7 +24628,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,9 +24640,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23752,7 +24699,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,9 +24711,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23822,7 +24771,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,9 +24783,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23892,7 +24843,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,9 +24855,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -23963,7 +24916,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,9 +24928,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24032,7 +24987,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,9 +24999,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24103,7 +25060,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,9 +25072,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24172,7 +25131,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,9 +25143,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24242,7 +25203,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,9 +25215,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24312,7 +25275,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,9 +25287,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24383,7 +25348,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,9 +25360,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24452,7 +25419,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,9 +25431,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24521,7 +25490,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,9 +25502,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24592,7 +25563,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,9 +25575,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24663,7 +25636,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,9 +25648,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24733,7 +25708,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,9 +25720,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24803,7 +25780,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,9 +25792,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24874,7 +25853,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,9 +25865,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -24943,7 +25924,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,9 +25936,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25013,7 +25996,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,9 +26008,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25083,7 +26068,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,9 +26080,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25152,7 +26139,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,9 +26151,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25222,7 +26211,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,9 +26223,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25292,7 +26283,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,9 +26295,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25363,7 +26356,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,9 +26368,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25432,7 +26427,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,9 +26439,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25503,7 +26500,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,9 +26512,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25574,7 +26573,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,9 +26585,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25644,7 +26645,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,9 +26657,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25714,7 +26717,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,9 +26729,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25785,7 +26790,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,9 +26802,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25856,7 +26863,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,9 +26875,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25926,7 +26935,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,9 +26947,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -25996,7 +27007,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,9 +27019,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -26066,7 +27079,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,9 +27091,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -26136,25 +27151,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveTimestampWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26206,25 +27225,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePendingTimestampWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26274,25 +27297,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDelayWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26344,25 +27371,30 @@ - (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); - - 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); + __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); + MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsSecurityPolicyStructAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSecurityPolicyWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26415,25 +27447,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelPage0MaskWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26492,27 +27528,34 @@ 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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void) @@ -26573,27 +27616,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeActiveNetworkFaultsListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26649,25 +27697,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26723,25 +27778,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26794,25 +27856,30 @@ - (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); - - 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); + __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); + MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRThreadNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -26864,7 +27931,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,9 +27943,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -26933,7 +28002,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,9 +28014,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -27049,25 +28120,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBssidWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27118,25 +28193,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSecurityTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27191,27 +28273,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWiFiVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27265,25 +28352,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27333,25 +28424,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeRssiWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27402,25 +28497,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBeaconLostCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27472,25 +28571,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBeaconRxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27543,25 +28646,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketMulticastRxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27614,25 +28721,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketMulticastTxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27685,25 +28796,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketUnicastRxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27756,25 +28871,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePacketUnicastTxCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27826,25 +28945,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentMaxRateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27895,25 +29018,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOverrunCountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -27966,25 +29093,30 @@ - (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); - - 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); + __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); + MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRWiFiNetworkDiagnosticsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28038,25 +29170,30 @@ - (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); - - 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); + __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); + MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRWiFiNetworkDiagnosticsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28108,25 +29245,30 @@ - (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); - - 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); + __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); + MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28178,7 +29320,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,9 +29332,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28247,7 +29391,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,9 +29403,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28365,27 +29511,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePHYRateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28437,25 +29588,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFullDuplexWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28506,7 +29661,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,9 +29673,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28576,7 +29733,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,9 +29745,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28645,7 +29804,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,9 +29816,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28714,7 +29875,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,9 +29887,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28783,7 +29946,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,9 +29958,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28853,25 +30018,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCarrierDetectWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -28923,7 +30092,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,9 +30104,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -28995,25 +30166,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29069,25 +30247,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29140,25 +30325,30 @@ - (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); - - 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); + __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); + MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTREthernetNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29210,7 +30400,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,9 +30412,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -29279,7 +30471,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,9 +30483,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -29365,25 +30559,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29433,7 +30630,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,9 +30642,11 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( 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], - MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -29501,25 +30700,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29608,25 +30810,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNodeLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29677,7 +30882,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,9 +30894,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -29748,25 +30955,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeHardwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29818,7 +31028,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,9 +31040,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -29889,25 +31101,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSoftwareVersionStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -29959,25 +31174,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeManufacturingDateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30028,25 +31246,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePartNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30096,25 +31317,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductURLWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30164,25 +31388,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeProductLabelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30233,25 +31460,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSerialNumberWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30302,7 +31532,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,9 +31544,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -30370,25 +31602,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUniqueIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30440,25 +31675,30 @@ - (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); - - 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); + __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); + MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRBridgedDeviceBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30512,25 +31752,30 @@ - (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); - - 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); + __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); + MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRBridgedDeviceBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30582,25 +31827,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -30652,7 +31901,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,9 +31913,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -30721,7 +31972,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,9 +31984,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -30808,7 +32061,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,9 +32073,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -30878,7 +32133,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,9 +32145,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -30948,7 +32205,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,9 +32217,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -31019,25 +32278,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31091,25 +32354,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31161,25 +32428,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31230,7 +32501,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,9 +32513,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -31299,7 +32572,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,9 +32584,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -31487,27 +32762,34 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeWindowStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31562,25 +32844,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAdminFabricIndexWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31632,25 +32918,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAdminVendorIdWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31704,25 +32994,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31778,25 +33075,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31849,25 +33153,30 @@ - (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); - - 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); + __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); + MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRAdministratorCommissioningAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -31919,7 +33228,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,9 +33240,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -31988,7 +33299,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,9 +33311,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -32295,25 +33608,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNOCsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32366,25 +33683,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFabricsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32436,7 +33757,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,9 +33769,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -32507,7 +33830,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,9 +33842,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -32579,25 +33904,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTrustedRootCertificatesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32651,7 +33983,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,9 +33995,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -32722,25 +34056,30 @@ - (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); - - 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); + __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); + MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROperationalCredentialsGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32794,25 +34133,30 @@ - (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); - - 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); + __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); + MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROperationalCredentialsAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32864,25 +34208,30 @@ - (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); - - 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); + __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); + MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROperationalCredentialsAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -32934,7 +34283,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,9 +34295,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -33003,7 +34354,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,9 +34366,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -33318,25 +34671,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGroupKeyMapWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33389,25 +34746,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGroupTableWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33459,7 +34820,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,9 +34832,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -33530,7 +34893,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,9 +34905,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -33601,25 +34966,30 @@ - (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); - - 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); + __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); + MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGroupKeyManagementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33673,25 +35043,30 @@ - (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); - - 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); + __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); + MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRGroupKeyManagementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33743,25 +35118,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -33813,7 +35192,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,9 +35204,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -33882,7 +35263,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,9 +35275,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -33968,25 +35351,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLabelListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34038,25 +35425,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34110,25 +35501,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34180,25 +35575,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34250,7 +35649,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,9 +35661,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -34319,7 +35720,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,9 +35732,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -34465,25 +35868,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLabelListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34535,25 +35942,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34607,25 +36018,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34677,25 +36092,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -34747,7 +36166,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,9 +36178,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -34816,7 +36237,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,9 +36249,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -34902,7 +36325,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,9 +36337,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -34972,25 +36397,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35044,25 +36473,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35114,25 +36547,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35184,7 +36621,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,9 +36633,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -35253,7 +36692,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,9 +36704,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -35367,25 +36808,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDescriptionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35437,25 +36881,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStandardNamespaceWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35507,25 +36955,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedModesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35577,7 +37029,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,9 +37041,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -35689,25 +37143,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35800,25 +37258,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOnModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35870,25 +37332,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -35942,25 +37408,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36012,25 +37482,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36082,7 +37556,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,9 +37568,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -36151,7 +37627,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,9 +37639,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -36840,25 +38318,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLockStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36909,25 +38391,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLockTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -36979,7 +38465,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,9 +38477,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37048,25 +38536,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDoorStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -37156,7 +38648,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,9 +38660,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37264,7 +38758,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,9 +38770,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37371,7 +38867,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,9 +38879,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37441,7 +38939,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,9 +38951,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37512,7 +39012,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,9 +39024,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37583,7 +39085,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,9 +39097,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37654,7 +39158,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,9 +39170,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37726,7 +39232,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,9 +39244,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37798,7 +39306,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,9 +39318,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37868,7 +39378,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,9 +39390,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -37938,7 +39450,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,9 +39462,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38008,7 +39522,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,9 +39534,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38078,7 +39594,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,9 +39606,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38149,25 +39667,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCredentialRulesSupportWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38221,7 +39743,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,9 +39755,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38328,25 +39852,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLanguageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38434,7 +39961,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,9 +39973,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38542,7 +40071,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,9 +40083,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38649,7 +40180,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,9 +40192,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -38757,25 +40290,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOperatingModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38829,25 +40366,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSupportedOperatingModesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -38901,25 +40442,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDefaultConfigurationRegisterWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -39012,7 +40557,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,9 +40569,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39122,7 +40669,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,9 +40681,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39232,7 +40781,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,9 +40793,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39344,7 +40895,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,9 +40907,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39456,25 +41009,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocalProgrammingFeaturesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -39566,7 +41123,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,9 +41135,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39678,7 +41237,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,9 +41249,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39786,7 +41347,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,9 +41359,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -39898,7 +41461,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,9 +41473,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -40007,7 +41572,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,9 +41584,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -40078,25 +41645,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40150,25 +41721,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40220,25 +41795,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40290,7 +41869,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,9 +41881,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -40359,7 +41940,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,9 +41952,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -40649,25 +42232,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40720,7 +42307,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,9 +42319,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -40791,7 +42380,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,9 +42392,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -40862,25 +42453,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionLiftWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -40933,25 +42528,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionTiltWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41004,7 +42603,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,9 +42615,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -41075,7 +42676,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,9 +42688,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -41144,25 +42747,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeConfigStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41216,25 +42823,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionLiftPercentageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41287,25 +42898,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionTiltPercentageWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41357,25 +42972,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOperationalStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41429,25 +43048,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTargetPositionLiftPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41500,25 +43123,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTargetPositionTiltPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41570,25 +43197,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEndProductTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41642,25 +43273,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionLiftPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41713,25 +43348,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentPositionTiltPercent100thsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -41784,7 +43423,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,9 +43435,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -41855,7 +43496,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,9 +43508,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -41926,7 +43569,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,9 +43581,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -41997,7 +43642,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,9 +43654,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -42103,25 +43750,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42171,25 +43822,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSafetyStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42243,25 +43898,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42315,25 +43974,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42385,25 +44048,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -42455,7 +44122,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,9 +44134,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -42524,7 +44193,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,9 +44205,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -42670,7 +44341,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,9 +44353,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -42741,7 +44414,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,9 +44426,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -42812,7 +44487,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,9 +44499,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -42920,7 +44597,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,9 +44609,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43028,7 +44707,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,9 +44719,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43140,7 +44821,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,9 +44833,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43252,7 +44935,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,9 +44947,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43360,7 +45045,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,9 +45057,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43468,7 +45155,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,9 +45167,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43538,7 +45227,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,9 +45239,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43609,25 +45300,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -43681,25 +45376,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -43751,25 +45450,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -43821,7 +45524,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,9 +45536,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43890,7 +45595,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,9 +45607,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -43976,25 +45683,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44045,25 +45756,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44112,25 +45827,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxFlowWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44181,25 +45900,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44251,25 +45974,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44321,25 +46048,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinCompPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44391,25 +46122,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxCompPressureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44461,25 +46196,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44531,25 +46270,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44600,25 +46343,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstFlowWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44669,25 +46416,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstFlowWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44738,25 +46489,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinConstTempWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44807,25 +46562,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxConstTempWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44876,25 +46635,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePumpStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -44949,27 +46712,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEffectiveOperationModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45025,25 +46793,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEffectiveControlModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45096,25 +46871,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCapacityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45163,25 +46942,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSpeedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45277,25 +47060,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLifetimeRunningHoursWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45345,25 +47132,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePowerWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45461,25 +47252,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLifetimeEnergyConsumedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45571,27 +47366,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOperationModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45683,25 +47483,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeControlModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45758,27 +47565,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45834,25 +47646,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45905,25 +47724,30 @@ - (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); - - 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); + __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); + MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRPumpConfigurationAndControlAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -45975,7 +47799,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,9 +47811,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46044,7 +47870,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,9 +47882,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46285,25 +48113,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLocalTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -46355,25 +48187,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOutdoorTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -46424,7 +48260,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,9 +48272,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46494,7 +48332,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,9 +48344,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46565,7 +48405,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,9 +48417,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46636,7 +48478,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,9 +48490,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46707,7 +48551,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,9 +48563,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46777,7 +48623,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,9 +48635,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46847,7 +48695,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,9 +48707,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -46959,7 +48809,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,9 +48821,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47071,7 +48923,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,9 +48935,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47183,7 +49037,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,9 +49049,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47295,7 +49151,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,9 +49163,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47407,7 +49265,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,9 +49277,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47519,7 +49379,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,9 +49391,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47628,7 +49490,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,9 +49502,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47737,7 +49601,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,9 +49613,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47846,7 +49712,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,9 +49724,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -47955,7 +49823,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,9 +49835,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48064,7 +49934,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,9 +49946,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48172,7 +50044,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,9 +50056,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48284,25 +50158,30 @@ - (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); - - 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); + __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); + MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRThermostatClusterThermostatControlSequenceAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeControlSequenceOfOperationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -48392,7 +50271,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,9 +50283,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48462,7 +50343,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,9 +50355,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48531,7 +50414,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,9 +50426,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48602,7 +50487,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,9 +50499,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48673,7 +50560,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,9 +50572,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48785,7 +50674,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,9 +50686,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -48902,25 +50793,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTemperatureSetpointHoldDurationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49014,7 +50909,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,9 +50921,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -49085,7 +50982,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,9 +50994,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -49156,7 +51055,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,9 +51067,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -49227,25 +51128,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSetpointChangeAmountWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49298,7 +51203,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,9 +51215,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -49411,25 +51318,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOccupiedSetbackWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49481,25 +51392,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOccupiedSetbackMinWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49551,25 +51466,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOccupiedSetbackMaxWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49664,25 +51583,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUnoccupiedSetbackWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49735,25 +51658,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUnoccupiedSetbackMinWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49806,25 +51733,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeUnoccupiedSetbackMaxWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -49914,7 +51845,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,9 +51857,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50020,7 +51953,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,9 +51965,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50126,7 +52061,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,9 +52073,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50233,7 +52170,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,9 +52182,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50341,7 +52280,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,9 +52292,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50448,7 +52389,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,9 +52401,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50556,7 +52499,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,9 +52511,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50626,25 +52571,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeACCoilTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -50734,7 +52683,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,9 +52695,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -50805,25 +52756,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -50877,25 +52832,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -50947,25 +52906,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51017,7 +52980,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,9 +52992,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51086,7 +53051,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,9 +53063,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51209,25 +53176,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFanModeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51317,25 +53288,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeFanModeSequenceWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51431,25 +53406,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePercentSettingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51501,7 +53480,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,9 +53492,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51570,7 +53551,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,9 +53563,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51681,25 +53664,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSpeedSettingWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -51750,7 +53737,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,9 +53749,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51819,7 +53808,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,9 +53820,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51926,7 +53917,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,9 +53929,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -51995,7 +53988,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,9 +54000,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52102,7 +54097,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,9 +54109,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52173,25 +54170,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52245,25 +54246,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52315,25 +54320,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52385,7 +54394,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,9 +54406,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52454,7 +54465,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,9 +54477,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52581,7 +54594,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,9 +54606,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52689,7 +54704,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,9 +54716,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52801,7 +54818,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,9 +54830,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -52874,27 +54893,34 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -52952,27 +54978,34 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -53028,27 +55061,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -53101,7 +55139,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,9 +55151,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -53170,7 +55210,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,9 +55222,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -53859,7 +55901,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,9 +55913,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -53928,7 +55972,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,9 +55984,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -53998,7 +56044,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,9 +56056,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54067,7 +56115,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,9 +56127,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54135,7 +56185,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,9 +56197,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54204,7 +56256,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,9 +56268,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54274,25 +56328,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCompensationTextWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -54345,7 +56402,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,9 +56414,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54414,7 +56473,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,9 +56485,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54519,7 +56580,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,9 +56592,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54588,25 +56651,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNumberOfPrimariesWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -54657,7 +56724,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,9 +56736,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54725,7 +56794,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,9 +56806,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54794,25 +56865,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary1IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -54863,7 +56938,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,9 +56950,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -54931,7 +57008,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,9 +57020,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55000,25 +57079,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary2IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55069,7 +57152,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,9 +57164,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55137,7 +57222,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,9 +57234,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55206,25 +57293,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary3IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55275,7 +57366,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,9 +57378,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55343,7 +57436,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,9 +57448,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55412,25 +57507,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary4IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55481,7 +57580,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,9 +57592,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55549,7 +57650,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,9 +57662,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55618,25 +57721,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary5IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55687,7 +57794,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,9 +57806,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55755,7 +57864,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,9 +57876,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -55824,25 +57935,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributePrimary6IntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -55931,7 +58046,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,9 +58058,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56038,7 +58155,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,9 +58167,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56145,7 +58264,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,9 +58276,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56252,7 +58373,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,9 +58385,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56367,25 +58490,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeColorPointRIntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -56474,7 +58601,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,9 +58613,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56581,7 +58710,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,9 +58722,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56696,25 +58827,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeColorPointGIntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -56803,7 +58938,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,9 +58950,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56910,7 +59047,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,9 +59059,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57025,25 +59164,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeColorPointBIntensityWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -57095,7 +59238,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,9 +59250,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57165,7 +59310,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,9 +59322,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57235,7 +59382,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,9 +59394,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57305,7 +59454,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,9 +59466,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57375,7 +59526,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,9 +59538,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57446,7 +59599,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,9 +59611,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57517,7 +59672,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,9 +59684,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57587,7 +59744,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,9 +59756,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57658,7 +59817,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,9 +59829,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57729,7 +59890,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,9 +59902,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57800,7 +59963,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,9 +59975,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -57917,25 +60082,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartUpColorTemperatureMiredsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -57988,25 +60157,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58060,25 +60233,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58130,25 +60307,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58200,7 +60381,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,9 +60393,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58269,7 +60452,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,9 +60464,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58356,7 +60541,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,9 +60553,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58426,7 +60613,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,9 +60625,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58496,7 +60685,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,9 +60697,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58603,7 +60794,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,9 +60806,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58709,7 +60902,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,9 +60914,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -58825,25 +61020,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeIntrinsicBalanceFactorWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -58942,25 +61141,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBallastFactorAdjustmentWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59011,7 +61214,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,9 +61226,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -59118,25 +61323,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59225,25 +61433,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampManufacturerWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59338,25 +61549,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampRatedHoursWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59451,25 +61666,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampBurnHoursWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59559,7 +61778,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,9 +61790,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -59676,25 +61897,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLampBurnHoursTripPointWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59747,25 +61972,30 @@ - (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); - - 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); + __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); + MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRBallastConfigurationGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59819,25 +62049,30 @@ - (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); - - 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); + __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); + MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRBallastConfigurationAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59889,25 +62124,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -59959,7 +62198,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,9 +62210,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -60028,7 +62269,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,9 +62281,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -60115,25 +62358,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60185,25 +62432,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60255,25 +62506,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60324,7 +62579,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,9 +62591,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -60393,25 +62650,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLightSensorTypeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60464,25 +62725,30 @@ - (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); - - 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); + __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); + MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRIlluminanceMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60536,25 +62802,30 @@ - (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); - - 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); + __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); + MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRIlluminanceMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60606,25 +62877,30 @@ - (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); - - 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); + __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); + MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRIlluminanceMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60676,7 +62952,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,9 +62964,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -60745,7 +63023,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,9 +63035,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -60832,25 +63112,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60902,25 +63186,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -60972,25 +63260,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61041,7 +63333,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,9 +63345,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -61111,25 +63405,30 @@ - (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); - - 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); + __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); + MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTemperatureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61183,25 +63482,30 @@ - (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); - - 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); + __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); + MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTemperatureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61253,25 +63557,30 @@ - (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); - - 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); + __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); + MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTemperatureMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61323,7 +63632,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,9 +63644,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -61392,7 +63703,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,9 +63715,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -61479,25 +63792,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61549,25 +63866,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61619,25 +63940,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61688,7 +64013,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,9 +64025,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -61756,25 +64083,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeScaledValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61826,25 +64157,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinScaledValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61896,25 +64231,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxScaledValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -61966,7 +64305,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,9 +64317,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -62034,7 +64375,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,9 +64387,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -62104,25 +64447,30 @@ - (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); - - 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); + __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); + MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRPressureMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62176,25 +64524,30 @@ - (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); - - 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); + __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); + MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRPressureMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62246,25 +64599,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62316,7 +64673,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,9 +64685,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -62385,7 +64744,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,9 +64756,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -62472,25 +64833,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62542,25 +64907,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62612,25 +64981,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62681,7 +65054,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,9 +65066,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -62751,25 +65126,30 @@ - (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); - - 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); + __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); + MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRFlowMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62823,25 +65203,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62893,25 +65277,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -62963,7 +65351,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,9 +65363,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63032,7 +65422,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,9 +65434,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63119,25 +65511,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63189,25 +65585,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMinMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63259,25 +65659,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMaxMeasuredValueWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63328,7 +65732,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,9 +65744,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63400,27 +65806,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63476,25 +65887,32 @@ - (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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63547,25 +65965,30 @@ - (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); - - 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); + __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); + MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRRelativeHumidityMeasurementAttributeListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -63617,7 +66040,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,9 +66052,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63686,7 +66111,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,9 +66123,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63772,7 +66199,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,9 +66211,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63842,7 +66271,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,9 +66283,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -63913,7 +66344,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,9 +66356,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64025,7 +66458,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,9 +66470,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64137,7 +66572,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,9 +66584,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64249,7 +66686,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,9 +66698,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64361,7 +66800,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,9 +66812,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64473,7 +66914,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,9 +66926,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64585,7 +67028,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,9 +67040,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64697,7 +67142,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,9 +67154,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64810,7 +67257,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,9 +67269,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64923,7 +67372,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,9 +67384,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -64995,25 +67446,30 @@ - (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); - - 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); + __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); + MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROccupancySensingGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65067,25 +67523,30 @@ - (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); - - 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); + __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); + MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTROccupancySensingAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65137,25 +67598,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65207,7 +67672,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,9 +67684,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -65276,7 +67743,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,9 +67755,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -65362,25 +67831,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeMACAddressWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65432,25 +67904,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65504,25 +67980,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65574,25 +68054,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65644,7 +68128,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,9 +68140,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -65713,7 +68199,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,9 +68211,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -65880,25 +68368,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeChannelListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -65949,25 +68441,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLineupWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66019,25 +68515,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentChannelWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66091,25 +68591,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66163,25 +68667,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66233,25 +68741,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66302,7 +68814,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,9 +68826,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -66371,7 +68885,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,9 +68897,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -66486,25 +69002,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeTargetListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66556,7 +69076,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,9 +69088,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -66627,25 +69149,30 @@ - (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); - - 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); + __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); + MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTargetNavigatorGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66699,25 +69226,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66769,25 +69300,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -66839,7 +69374,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,9 +69386,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -66908,7 +69445,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,9 +69457,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -67301,25 +69840,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentStateWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67371,25 +69914,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStartTimeWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67439,25 +69986,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeDurationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67508,25 +70059,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSampledPositionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67579,7 +70134,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,9 +70146,11 @@ new MTRFloatAttributeCallbackSubscriptionBridge( 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], - MTRFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRFloatAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -67648,25 +70205,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSeekRangeEndWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67718,25 +70279,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeSeekRangeStartWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67789,25 +70354,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67861,25 +70430,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -67931,25 +70504,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68001,7 +70578,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,9 +70590,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -68070,7 +70649,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,9 +70661,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -68273,25 +70854,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeInputListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68341,7 +70926,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,9 +70938,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -68412,25 +70999,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68484,25 +71075,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68554,25 +71149,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68624,7 +71223,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,9 +71235,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -68693,7 +71294,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,9 +71306,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -68811,25 +71414,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68883,25 +71490,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -68953,25 +71564,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69023,7 +71638,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,9 +71650,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -69092,7 +71709,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,9 +71721,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -69205,25 +71824,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69277,25 +71900,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69347,25 +71974,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69417,7 +72048,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,9 +72060,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -69486,7 +72119,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,9 +72131,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -69776,25 +72411,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptHeaderWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -69889,7 +72528,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,9 +72540,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -69960,25 +72601,30 @@ - (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); - - 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); + __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); + MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRContentLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70032,25 +72678,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70102,25 +72752,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70172,7 +72826,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,9 +72838,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -70241,7 +72897,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,9 +72909,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -70384,25 +73042,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOutputListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70454,7 +73116,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,9 +73128,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -70525,25 +73189,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70597,25 +73265,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70667,25 +73339,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -70737,7 +73413,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,9 +73425,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -70806,7 +73484,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,9 +73496,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -70974,25 +73654,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCatalogListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71095,25 +73779,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCurrentAppWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71167,25 +73855,30 @@ - (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); - - 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); + __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); + MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRApplicationLauncherGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71239,25 +73932,30 @@ - (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); - - 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); + __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); + MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRApplicationLauncherAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71309,25 +74007,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71379,7 +74081,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,9 +74093,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -71448,7 +74152,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,9 +74164,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -71534,25 +74240,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71602,7 +74311,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,9 +74323,11 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( 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], - MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -71671,25 +74382,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeApplicationNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71740,7 +74454,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,9 +74466,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -71810,25 +74526,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeApplicationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71880,25 +74600,30 @@ - (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); - - 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); + __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); + MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRApplicationBasicClusterApplicationStatusEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -71950,25 +74675,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeApplicationVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72020,25 +74748,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAllowedVendorListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72092,25 +74824,30 @@ - (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); - - 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); + __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); + MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRApplicationBasicGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72164,25 +74901,30 @@ - (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); - - 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); + __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); + MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRApplicationBasicAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72234,25 +74976,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72304,7 +75050,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,9 +75062,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -72373,7 +75121,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,9 +75133,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -72554,25 +75304,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72626,25 +75380,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72696,25 +75454,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -72766,7 +75528,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,9 +75540,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -72835,7 +75599,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,9 +75611,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -72983,7 +75749,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,9 +75761,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73052,7 +75820,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,9 +75832,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73120,7 +75890,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,9 +75902,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73189,7 +75961,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,9 +75973,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73258,7 +76032,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,9 +76044,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73326,7 +76102,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,9 +76114,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73395,7 +76173,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,9 +76185,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73463,7 +76243,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,9 +76255,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73531,7 +76313,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,9 +76325,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73599,7 +76383,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,9 +76395,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73669,7 +76455,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,9 +76467,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73739,7 +76527,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,9 +76539,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73810,7 +76600,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,9 +76612,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73880,7 +76672,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,9 +76684,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -73950,7 +76744,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,9 +76756,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74020,7 +76816,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,9 +76828,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74089,7 +76887,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,9 +76899,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74159,7 +76959,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,9 +76971,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74229,7 +77031,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,9 +77043,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74299,7 +77103,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,9 +77115,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74369,7 +77175,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,9 +77187,11 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( 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], - MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74439,7 +77247,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,9 +77259,11 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( 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], - MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74509,7 +77319,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,9 +77331,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74580,7 +77392,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,9 +77404,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74651,7 +77465,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,9 +77477,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74722,7 +77538,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,9 +77550,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74793,7 +77611,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,9 +77623,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74864,7 +77684,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,9 +77696,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -74935,7 +77757,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,9 +77769,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75006,7 +77830,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,9 +77842,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75077,7 +77903,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,9 +77915,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75148,7 +77976,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,9 +77988,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75219,7 +78049,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,9 +78061,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75290,7 +78122,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,9 +78134,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75361,7 +78195,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,9 +78207,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75432,7 +78268,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,9 +78280,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75502,7 +78340,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,9 +78352,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75572,7 +78412,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,9 +78424,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75641,7 +78483,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,9 +78495,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75712,7 +78556,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,9 +78568,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75783,7 +78629,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,9 +78641,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75854,7 +78702,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,9 +78714,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75925,7 +78775,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,9 +78787,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -75996,7 +78848,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,9 +78860,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76067,7 +78921,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,9 +78933,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76137,7 +78993,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,9 +79005,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76206,7 +79064,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,9 +79076,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76275,7 +79135,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,9 +79147,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76345,7 +79207,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,9 +79219,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76414,7 +79278,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,9 +79290,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76483,7 +79349,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,9 +79361,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76553,7 +79421,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,9 +79433,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76622,7 +79492,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,9 +79504,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76692,7 +79564,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,9 +79576,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76762,7 +79636,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,9 +79648,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76832,7 +79708,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,9 +79720,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76902,7 +79780,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,9 +79792,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -76971,7 +79851,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,9 +79863,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77083,7 +79965,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,9 +79977,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77195,7 +80079,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,9 +80091,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77307,7 +80193,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,9 +80205,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77419,7 +80307,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,9 +80319,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77528,7 +80418,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,9 +80430,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77638,7 +80530,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,9 +80542,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77709,7 +80603,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,9 +80615,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77779,7 +80675,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,9 +80687,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77850,7 +80748,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,9 +80760,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77920,7 +80820,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,9 +80832,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -77990,7 +80892,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,9 +80904,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78060,7 +80964,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,9 +80976,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78168,7 +81074,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,9 +81086,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78238,7 +81146,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,9 +81158,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78308,7 +81218,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,9 +81230,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78417,7 +81329,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,9 +81341,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78487,7 +81401,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,9 +81413,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78557,7 +81473,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,9 +81485,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78628,7 +81546,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,9 +81558,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78699,7 +81619,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,9 +81631,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78770,7 +81692,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,9 +81704,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78841,7 +81765,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,9 +81777,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78912,7 +81838,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,9 +81850,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -78983,7 +81911,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,9 +81923,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79053,7 +81983,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,9 +81995,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79123,7 +82055,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,9 +82067,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79193,7 +82127,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,9 +82139,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79264,7 +82200,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,9 +82212,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79335,7 +82273,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,9 +82285,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79405,7 +82345,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,9 +82357,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79476,7 +82418,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,9 +82430,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79547,7 +82491,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,9 +82503,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79617,7 +82563,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,9 +82575,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79688,7 +82636,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,9 +82648,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79759,7 +82709,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,9 +82721,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79829,7 +82781,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,9 +82793,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79900,7 +82854,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,9 +82866,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -79971,7 +82927,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,9 +82939,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80042,7 +83000,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,9 +83012,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80113,7 +83073,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,9 +83085,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80183,7 +83145,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,9 +83157,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80254,7 +83218,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,9 +83230,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80326,7 +83292,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,9 +83304,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80397,7 +83365,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,9 +83377,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80468,7 +83438,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,9 +83450,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80539,7 +83511,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,9 +83523,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80610,7 +83584,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,9 +83596,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80681,7 +83657,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,9 +83669,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80751,7 +83729,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,9 +83741,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80822,7 +83802,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,9 +83814,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80893,7 +83875,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,9 +83887,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80963,7 +83947,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,9 +83959,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81034,7 +84020,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,9 +84032,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81105,7 +84093,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,9 +84105,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81175,7 +84165,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,9 +84177,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81246,7 +84238,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,9 +84250,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81317,7 +84311,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,9 +84323,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81387,7 +84383,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,9 +84395,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81458,7 +84456,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,9 +84468,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81529,7 +84529,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,9 +84541,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81600,7 +84602,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,9 +84614,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81671,7 +84675,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,9 +84687,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81741,7 +84747,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,9 +84759,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81812,7 +84820,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,9 +84832,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81884,7 +84894,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,9 +84906,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81955,7 +84967,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,9 +84979,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -82026,7 +85040,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,9 +85052,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -82097,7 +85113,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,9 +85125,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -82168,7 +85186,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,9 +85198,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -82239,7 +85259,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,9 +85271,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -82310,25 +85332,30 @@ - (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); - - 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); + __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); + MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRElectricalMeasurementGeneratedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -82382,25 +85409,30 @@ - (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); - - 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); + __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); + MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRElectricalMeasurementAcceptedCommandListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -82452,25 +85484,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -82522,7 +85558,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,9 +85570,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -82591,7 +85629,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,9 +85641,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -84030,7 +87070,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,9 +87082,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -84135,25 +87177,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap8WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84241,25 +87287,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap16WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84347,25 +87397,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap32WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84453,25 +87507,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeBitmap64WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -84558,7 +87616,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,9 +87628,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -84663,7 +87723,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,9 +87735,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -84768,7 +87830,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,9 +87842,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -84873,7 +87937,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,9 +87949,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -84978,7 +88044,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,9 +88056,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85083,7 +88151,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,9 +88163,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85188,7 +88258,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,9 +88270,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85293,7 +88365,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,9 +88377,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85398,7 +88472,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,9 +88484,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85503,7 +88579,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,9 +88591,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85608,7 +88686,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,9 +88698,11 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( 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], - MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85713,7 +88793,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,9 +88805,11 @@ new MTRInt32sAttributeCallbackSubscriptionBridge( 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], - MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85818,7 +88900,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,9 +88912,11 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( 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], - MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -85923,7 +89007,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,9 +89019,11 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( 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], - MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86028,7 +89114,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,9 +89126,11 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( 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], - MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86133,7 +89221,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,9 +89233,11 @@ new MTRInt64sAttributeCallbackSubscriptionBridge( 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], - MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86238,7 +89328,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,9 +89340,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86343,7 +89435,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,9 +89447,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86449,7 +89543,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,9 +89555,11 @@ new MTRFloatAttributeCallbackSubscriptionBridge( 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], - MTRFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRFloatAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRFloatAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86556,7 +89652,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,9 +89664,11 @@ new MTRDoubleAttributeCallbackSubscriptionBridge( 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], - MTRDoubleAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRDoubleAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRDoubleAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -86663,25 +89761,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -86790,25 +89891,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListInt8uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -86918,25 +90023,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87050,25 +90159,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListStructOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87159,25 +90272,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLongOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87266,25 +90382,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeCharStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87373,25 +90492,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, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeLongCharStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -87479,7 +90601,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,9 +90613,11 @@ new MTRInt64uAttributeCallbackSubscriptionBridge( 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], - MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt64uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt64uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -87584,7 +90708,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,9 +90720,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -87690,7 +90816,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,9 +90828,11 @@ new MTRVendorIdAttributeCallbackSubscriptionBridge( 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], - MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRVendorIdAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRVendorIdAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -87994,25 +91122,30 @@ - (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); - - 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); + __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); + MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge * innerCallbackBridge + = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], + MTRTestClusterListNullablesAndOptionalsStructListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + nil, [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListNullablesAndOptionalsStructWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88102,25 +91235,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeEnumAttrWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88220,25 +91357,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeStructAttrWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88330,7 +91471,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,9 +91483,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -88439,7 +91582,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,9 +91594,11 @@ new MTRInt8sAttributeCallbackSubscriptionBridge( 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], - MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -88549,7 +91694,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,9 +91706,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -88659,7 +91806,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,9 +91818,11 @@ new MTRInt16sAttributeCallbackSubscriptionBridge( 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], - MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16sAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16sAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -88789,25 +91938,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListLongOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -88977,25 +92130,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeListFabricScopedWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89086,7 +92243,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,9 +92255,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -89195,7 +92354,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,9 +92366,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -89304,7 +92465,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,9 +92477,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -89411,7 +92574,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,9 +92586,11 @@ new MTRBooleanAttributeCallbackSubscriptionBridge( 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], - MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRBooleanAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -89524,25 +92689,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBooleanWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89637,25 +92806,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap8WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89751,25 +92924,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap16WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89865,25 +93042,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap32WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -89979,25 +93160,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableBitmap64WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90093,25 +93278,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt8uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90206,25 +93395,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt16uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90319,25 +93512,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt24uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90432,25 +93629,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt32uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90545,25 +93746,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt40uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90658,25 +93863,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt48uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90771,25 +93980,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt56uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90884,25 +94097,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt64uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -90997,25 +94214,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt8sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91110,25 +94331,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt16sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91223,25 +94448,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt24sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91336,25 +94565,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt32sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91449,25 +94682,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt40sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91562,25 +94799,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt48sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91675,25 +94916,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt56sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91788,25 +95033,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableInt64sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -91901,25 +95150,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableEnum8WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92014,25 +95267,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableEnum16WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92128,25 +95385,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableFloatSingleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92242,25 +95503,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableFloatDoubleWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92356,25 +95621,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableOctetStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92469,25 +95738,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableCharStringWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92582,25 +95855,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableEnumAttrWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92706,25 +95983,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableStructWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92824,25 +96105,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt8uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -92941,25 +96226,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt8sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93058,25 +96347,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt16uWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93175,25 +96468,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeNullableRangeRestrictedInt16sWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93283,7 +96580,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,9 +96592,11 @@ new MTRInt8uAttributeCallbackSubscriptionBridge( 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], - MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt8uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -93354,25 +96653,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93426,25 +96729,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93496,25 +96803,29 @@ - (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, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); } + (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer @@ -93566,7 +96877,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,9 +96889,11 @@ new MTRInt32uAttributeCallbackSubscriptionBridge( 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], - MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt32uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -93635,7 +96948,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,9 +96960,11 @@ new MTRInt16uAttributeCallbackSubscriptionBridge( 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], - MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + MTRInt16uAttributeCallbackSubscriptionBridge * innerCallbackBridge = callbackBridge; + return cppCluster.SubscribeAttribute( + successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], + [maxInterval unsignedShortValue], MTRInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + [innerCallbackBridge](void) { delete innerCallbackBridge; }, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); },