Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a way to update ReadPrepareParams based on CASE session. (#28078)
Browse files Browse the repository at this point in the history
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.
bzbarsky-apple authored and pull[bot] committed Sep 6, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b7fc8f3 commit 9861641
Showing 4 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/BufferedReadCallback.h
Original file line number Diff line number Diff line change
@@ -113,6 +113,11 @@ class BufferedReadCallback : public ReadClient::Callback
return mCallback.OnUnsolicitedMessageFromPublisher(apReadClient);
}

void OnCASESessionEstablished(const SessionHandle & aSession, ReadPrepareParams & aSubscriptionParams) override
{
return mCallback.OnCASESessionEstablished(aSession, aSubscriptionParams);
}

/*
* Given a reader positioned at a list element, allocate a packet buffer, copy the list item where
* the reader is positioned into that buffer and add it to our buffered list for tracking.
5 changes: 5 additions & 0 deletions src/app/ClusterStateCache.h
Original file line number Diff line number Diff line change
@@ -631,6 +631,11 @@ class ClusterStateCache : protected ReadClient::Callback
return mCallback.OnUnsolicitedMessageFromPublisher(apReadClient);
}

void OnCASESessionEstablished(const SessionHandle & aSession, ReadPrepareParams & aSubscriptionParams) override
{
return mCallback.OnCASESessionEstablished(aSession, aSubscriptionParams);
}

// Commit the pending cluster data version, if there is one.
void CommitPendingDataVersion();

2 changes: 2 additions & 0 deletions src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
@@ -1095,6 +1095,8 @@ void ReadClient::HandleDeviceConnected(void * context, Messaging::ExchangeManage
_this->mReadPrepareParams.mSessionHolder.Grab(sessionHandle);
_this->mpExchangeMgr = &exchangeMgr;

_this->mpCallback.OnCASESessionEstablished(sessionHandle, _this->mReadPrepareParams);

auto err = _this->SendSubscribeRequest(_this->mReadPrepareParams);
if (err != CHIP_NO_ERROR)
{
10 changes: 10 additions & 0 deletions src/app/ReadClient.h
Original file line number Diff line number Diff line change
@@ -249,6 +249,16 @@ class ReadClient : public Messaging::ExchangeDelegate
* @param[in] apReadClient the ReadClient for the subscription.
*/
virtual void OnUnsolicitedMessageFromPublisher(ReadClient * apReadClient) {}

/**
* OnCASESessionEstablished will be called for a subscription ReadClient when
* it finishes setting up a CASE session, as part of either automatic
* re-subscription or doing an initial subscribe based on ScopedNodeId.
*
* The callee is allowed to modify the ReadPrepareParams (e.g. to change
* things like min/max intervals based on the session parameters).
*/
virtual void OnCASESessionEstablished(const SessionHandle & aSession, ReadPrepareParams & aSubscriptionParams) {}
};

enum class InteractionType : uint8_t

0 comments on commit 9861641

Please sign in to comment.