diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 750ab648cb7bfa..69cd3ec386b551 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -78,6 +78,13 @@ @interface MTRDeviceControllerFactoryParams () @end +class MTRApplicationCallback : public app::ReadHandler::ApplicationCallback { + CHIP_ERROR OnSubscriptionRequested(app::ReadHandler & readHandler, Transport::SecureSession & secureSession) override + { + return readHandler.SetMaxReportingInterval(kSubscriptionMaxIntervalPublisherLimit); + } +}; + MTR_DIRECT_MEMBERS @interface MTRDeviceControllerFactory () - (void)preWarmCommissioningSessionDone; @@ -90,6 +97,7 @@ @implementation MTRDeviceControllerFactory { Credentials::IgnoreCertificateValidityPeriodPolicy _certificateValidityPolicy; Crypto::RawKeySessionKeystore _sessionKeystore; + MTRApplicationCallback _applicationCallback; // We use TestPersistentStorageDelegate just to get an in-memory store to back // our group data provider impl. We initialize this store correctly on every // controller startup, so don't need to actually persist it. @@ -239,6 +247,8 @@ - (void)cleanupStartupObjects // Make sure the deinit order here is the reverse of the init order in // startControllerFactory: + app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); + _certificationDeclarationCertificates = nil; _productAttestationAuthorityCertificates = nil; @@ -366,6 +376,8 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam _productAttestationAuthorityCertificates = [startupParams.productAttestationAuthorityCertificates copy]; _certificationDeclarationCertificates = [startupParams.certificationDeclarationCertificates copy]; + app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&_applicationCallback); + { chip::Controller::FactoryInitParams params; if (startupParams.port != nil) {