From 9d869a8b403dc426a17944336d4b577abb1f62c3 Mon Sep 17 00:00:00 2001 From: Song Guo Date: Tue, 9 Jan 2024 07:36:39 +0000 Subject: [PATCH 1/2] [icd] create callback to indicate an alive subscription --- src/app/ReadClient.cpp | 1 + src/app/ReadClient.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index bbc1c68a4b87b8..f89c8bee528fa9 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -617,6 +617,7 @@ CHIP_ERROR ReadClient::ProcessReportData(System::PacketBufferHandle && aPayload, // a subscription and have a valid value for mMaxInterval which the function // relies on. // + mpCallback.RefreshLiveness(*this); err = RefreshLivenessCheckTimer(); } } diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index 3d66f5deab02cb..38f44db9763b4b 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -83,6 +83,15 @@ class ReadClient : public Messaging::ExchangeDelegate virtual ~Callback() = default; + /** + * Used to notify a (maybe empty) report data is received from peer and the subscription and the peer is alive. + * + * This object MUST continue to exist after this call is completed. The application shall wait until it + * receives an OnDone call to destroy the object. + * + */ + virtual void RefreshLiveness(const ReadClient& apReadClient) {} + /** * Used to signal the commencement of processing of the first attribute or event report received in a given exchange. * From 2765cba3fd33ba03da6f44b0a2f862928506921c Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 9 Jan 2024 15:19:21 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- src/app/ReadClient.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index 38f44db9763b4b..ebe4de89988f7e 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -90,7 +90,7 @@ class ReadClient : public Messaging::ExchangeDelegate * receives an OnDone call to destroy the object. * */ - virtual void RefreshLiveness(const ReadClient& apReadClient) {} + virtual void RefreshLiveness(const ReadClient & apReadClient) {} /** * Used to signal the commencement of processing of the first attribute or event report received in a given exchange.