@@ -78,6 +78,18 @@ @interface MTRDeviceControllerFactoryParams ()
7878
7979@end
8080
81+ class MTRApplicationCallback : public app ::ReadHandler::ApplicationCallback {
82+ CHIP_ERROR OnSubscriptionRequested (app::ReadHandler & readHandler, Transport::SecureSession & secureSession) override
83+ {
84+ uint16_t requestedMinInterval = 0 ;
85+ uint16_t requestedMaxInterval = 0 ;
86+ readHandler.GetReportingIntervals (requestedMinInterval, requestedMaxInterval);
87+
88+ uint16_t maximumMaxInterval = std::max (kSubscriptionMaxIntervalPublisherLimit , requestedMaxInterval);
89+ return readHandler.SetMaxReportingInterval (maximumMaxInterval);
90+ }
91+ };
92+
8193MTR_DIRECT_MEMBERS
8294@interface MTRDeviceControllerFactory ()
8395- (void )preWarmCommissioningSessionDone ;
@@ -90,6 +102,7 @@ @implementation MTRDeviceControllerFactory {
90102
91103 Credentials::IgnoreCertificateValidityPeriodPolicy _certificateValidityPolicy;
92104 Crypto::RawKeySessionKeystore _sessionKeystore;
105+ MTRApplicationCallback _applicationCallback;
93106 // We use TestPersistentStorageDelegate just to get an in-memory store to back
94107 // our group data provider impl. We initialize this store correctly on every
95108 // controller startup, so don't need to actually persist it.
@@ -239,6 +252,8 @@ - (void)cleanupStartupObjects
239252
240253 // Make sure the deinit order here is the reverse of the init order in
241254 // startControllerFactory:
255+ app::InteractionModelEngine::GetInstance ()->UnregisterReadHandlerAppCallback ();
256+
242257 _certificationDeclarationCertificates = nil ;
243258 _productAttestationAuthorityCertificates = nil ;
244259
@@ -367,6 +382,8 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam
367382 _productAttestationAuthorityCertificates = [startupParams.productAttestationAuthorityCertificates copy ];
368383 _certificationDeclarationCertificates = [startupParams.certificationDeclarationCertificates copy ];
369384
385+ app::InteractionModelEngine::GetInstance ()->RegisterReadHandlerAppCallback (&_applicationCallback);
386+
370387 {
371388 chip::Controller::FactoryInitParams params;
372389 if (startupParams.port != nil ) {
0 commit comments