Skip to content

Commit

Permalink
Allow initializing ReadClient without exchange manager if it's not ne…
Browse files Browse the repository at this point in the history
…eded. (#27978)
  • Loading branch information
bzbarsky-apple authored Jul 19, 2023
1 parent b10de46 commit cc34bd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ReadClient::ReadClient(InteractionModelEngine * apImEngine, Messaging::ExchangeM
mpCallback(apCallback), mOnConnectedCallback(HandleDeviceConnected, this),
mOnConnectionFailureCallback(HandleDeviceConnectionFailure, this)
{
// Error if already initialized.
mpExchangeMgr = apExchangeMgr;
mpCallback = apCallback;
mInteractionType = aInteractionType;
Expand Down Expand Up @@ -1094,6 +1093,7 @@ void ReadClient::HandleDeviceConnected(void * context, Messaging::ExchangeManage

ChipLogProgress(DataManagement, "HandleDeviceConnected");
_this->mReadPrepareParams.mSessionHolder.Grab(sessionHandle);
_this->mpExchangeMgr = &exchangeMgr;

auto err = _this->SendSubscribeRequest(_this->mReadPrepareParams);
if (err != CHIP_NO_ERROR)
Expand Down
4 changes: 3 additions & 1 deletion src/app/ReadClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ class ReadClient : public Messaging::ExchangeDelegate
* this object will cease to function correctly since it depends on the engine for a number of critical functions.
*
* @param[in] apImEngine A valid pointer to the IM engine.
* @param[in] apExchangeMgr A pointer to the ExchangeManager object.
* @param[in] apExchangeMgr A pointer to the ExchangeManager object. Allowed to be null
* if the version of SendAutoResubscribeRequest that takes a
* ScopedNodeId is used.
* @param[in] apCallback Callback set by application.
* @param[in] aInteractionType Type of interaction (read or subscribe)
*
Expand Down

0 comments on commit cc34bd9

Please sign in to comment.