@@ -136,9 +136,10 @@ uint32_t ICDManager::StayActiveRequest(uint32_t stayActiveDuration)
136136}
137137
138138#if CHIP_CONFIG_ENABLE_ICD_CIP
139- void ICDManager::SendCheckInMsgs ()
139+ void ICDManager::SendCheckInMsgs (Optional<Access::SubjectDescriptor> specificSubject )
140140{
141141#if !(CONFIG_BUILD_FOR_HOST_UNIT_TEST)
142+ VerifyOrDie (SupportsFeature (Feature::kCheckInProtocolSupport ));
142143 VerifyOrDie (mStorage != nullptr );
143144 VerifyOrDie (mFabricTable != nullptr );
144145
@@ -173,7 +174,13 @@ void ICDManager::SendCheckInMsgs()
173174 continue ;
174175 }
175176
176- if (!ShouldCheckInMsgsBeSentAtActiveModeFunction (entry.fabricIndex , entry.monitoredSubject ))
177+ if (specificSubject.HasValue () && !ShouldSendCheckInMessageForSpecificSubject (entry, specificSubject.Value ()))
178+ {
179+ continue ;
180+ }
181+
182+ if (!specificSubject.HasValue () &&
183+ !ShouldCheckInMsgsBeSentAtActiveModeFunction (entry.fabricIndex , entry.monitoredSubject ))
177184 {
178185 continue ;
179186 }
@@ -209,6 +216,24 @@ void ICDManager::SendCheckInMsgs()
209216#endif // !(CONFIG_BUILD_FOR_HOST_UNIT_TEST)
210217}
211218
219+ bool ICDManager::ShouldSendCheckInMessageForSpecificSubject (const ICDMonitoringEntry & entry,
220+ const Access::SubjectDescriptor & specificSubject)
221+ {
222+ if (specificSubject.fabricIndex != entry.fabricIndex )
223+ {
224+ return false ;
225+ }
226+
227+ if (specificSubject.cats .CheckSubjectAgainstCATs (entry.monitoredSubject ) || entry.monitoredSubject == specificSubject.subject )
228+ {
229+ ChipLogProgress (AppServer, " Proceed to send Check-In msg for specific subject: " ChipLogFormatX64,
230+ ChipLogValueX64 (specificSubject.subject ));
231+ return true ;
232+ }
233+
234+ return false ;
235+ }
236+
212237bool ICDManager::CheckInMessagesWouldBeSent (const std::function<ShouldCheckInMsgsBeSentFunction> & shouldCheckInMsgsBeSentFunction)
213238{
214239 VerifyOrReturnValue (shouldCheckInMsgsBeSentFunction, false );
@@ -479,10 +504,7 @@ void ICDManager::UpdateOperationState(OperationalState state)
479504 }
480505
481506#if CHIP_CONFIG_ENABLE_ICD_CIP
482- if (SupportsFeature (Feature::kCheckInProtocolSupport ))
483- {
484- SendCheckInMsgs ();
485- }
507+ SendCheckInMsgs ();
486508#endif // CHIP_CONFIG_ENABLE_ICD_CIP
487509
488510 postObserverEvent (ObserverEventType::EnterActiveMode);
@@ -661,6 +683,14 @@ void ICDManager::OnSubscriptionReport()
661683 this ->UpdateOperationState (OperationalState::ActiveMode);
662684}
663685
686+ #if CHIP_CONFIG_ENABLE_ICD_SERVER && CHIP_CONFIG_ENABLE_ICD_CIP && CHIP_CONFIG_ENABLE_ICD_CHECK_IN_ON_REPORT_TIMEOUT
687+ void ICDManager::OnSendCheckIn (const Access::SubjectDescriptor & subject)
688+ {
689+ ChipLogProgress (AppServer, " Received OnSendCheckIn for subject: " ChipLogFormatX64, ChipLogValueX64 (subject.subject ));
690+ SendCheckInMsgs (MakeOptional (subject));
691+ }
692+ #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && CHIP_CONFIG_ENABLE_ICD_CIP && CHIP_CONFIG_ENABLE_ICD_CHECK_IN_ON_REPORT_TIMEOUT
693+
664694void ICDManager::ExtendActiveMode (Milliseconds16 extendDuration)
665695{
666696 DeviceLayer::SystemLayer ().ExtendTimerTo (extendDuration, OnActiveModeDone, this );
0 commit comments