Skip to content

Commit 5941344

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Add a way to update ReadPrepareParams based on CASE session. (#28078)
If the ReadClient is doing the CASE establishment itself, it should give the client a way to modify the ReadPrepareParams based on the session information.
1 parent c8bcbbd commit 5941344

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

src/app/BufferedReadCallback.h

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ class BufferedReadCallback : public ReadClient::Callback
113113
return mCallback.OnUnsolicitedMessageFromPublisher(apReadClient);
114114
}
115115

116+
void OnCASESessionEstablished(const SessionHandle & aSession, ReadPrepareParams & aSubscriptionParams) override
117+
{
118+
return mCallback.OnCASESessionEstablished(aSession, aSubscriptionParams);
119+
}
120+
116121
/*
117122
* Given a reader positioned at a list element, allocate a packet buffer, copy the list item where
118123
* the reader is positioned into that buffer and add it to our buffered list for tracking.

src/app/ClusterStateCache.h

+5
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,11 @@ class ClusterStateCache : protected ReadClient::Callback
631631
return mCallback.OnUnsolicitedMessageFromPublisher(apReadClient);
632632
}
633633

634+
void OnCASESessionEstablished(const SessionHandle & aSession, ReadPrepareParams & aSubscriptionParams) override
635+
{
636+
return mCallback.OnCASESessionEstablished(aSession, aSubscriptionParams);
637+
}
638+
634639
// Commit the pending cluster data version, if there is one.
635640
void CommitPendingDataVersion();
636641

src/app/ReadClient.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,8 @@ void ReadClient::HandleDeviceConnected(void * context, Messaging::ExchangeManage
10951095
_this->mReadPrepareParams.mSessionHolder.Grab(sessionHandle);
10961096
_this->mpExchangeMgr = &exchangeMgr;
10971097

1098+
_this->mpCallback.OnCASESessionEstablished(sessionHandle, _this->mReadPrepareParams);
1099+
10981100
auto err = _this->SendSubscribeRequest(_this->mReadPrepareParams);
10991101
if (err != CHIP_NO_ERROR)
11001102
{

src/app/ReadClient.h

+10
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ class ReadClient : public Messaging::ExchangeDelegate
249249
* @param[in] apReadClient the ReadClient for the subscription.
250250
*/
251251
virtual void OnUnsolicitedMessageFromPublisher(ReadClient * apReadClient) {}
252+
253+
/**
254+
* OnCASESessionEstablished will be called for a subscription ReadClient when
255+
* it finishes setting up a CASE session, as part of either automatic
256+
* re-subscription or doing an initial subscribe based on ScopedNodeId.
257+
*
258+
* The callee is allowed to modify the ReadPrepareParams (e.g. to change
259+
* things like min/max intervals based on the session parameters).
260+
*/
261+
virtual void OnCASESessionEstablished(const SessionHandle & aSession, ReadPrepareParams & aSubscriptionParams) {}
252262
};
253263

254264
enum class InteractionType : uint8_t

0 commit comments

Comments
 (0)