Skip to content

Commit

Permalink
More minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjerryjohns committed Jul 25, 2022
1 parent 201b70e commit 56414ef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ CHIP_ERROR ReadClient::ProcessEventReportIBs(TLV::TLVReader & aEventReportIBsRea

//
// Update the event number being tracked in mReadPrepareParams in case
// we want to use it for re-subscriptions later.
// we want to send it in the next SubscribeRequest message to convey
// the event number till which we've already received events for.
//
mReadPrepareParams.mEventNumber.SetValue(header.mEventNumber + 1);

Expand Down Expand Up @@ -737,6 +738,8 @@ CHIP_ERROR ReadClient::RefreshLivenessCheckTimer()
{
CHIP_ERROR err = CHIP_NO_ERROR;

VerifyOrReturnError(mState == ClientState::SubscriptionActive, CHIP_ERROR_INCORRECT_STATE);

CancelLivenessCheckTimer();

System::Clock::Timeout timeout;
Expand Down
18 changes: 11 additions & 7 deletions src/app/ReadClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class ReadClient : public Messaging::ExchangeDelegate
* mpDataVersionFilterList with lifetimes as long as the ReadClient itself and b) free those up later in the call to
* OnDeallocatePaths. Note: At a given time in the system, you can either have a single subscription with re-sub enabled that
* that has mKeepSubscriptions = false, OR, multiple subs with re-sub enabled with mKeepSubscriptions = true. You shall not
* have a mix of both simultaneously. If SendAutoResubscribeRequest is called at all, it guarantees that it will call
* have a mix of both simultaneously. If SendAutoResubscribeRequest is called at all, it guarantees that it will call
* OnDeallocatePaths when OnDone is called. SendAutoResubscribeRequest is the only case that calls OnDeallocatePaths, since
* that's the only case when the consumer moved a ReadParams into the client.
*
Expand Down Expand Up @@ -386,12 +386,16 @@ class ReadClient : public Messaging::ExchangeDelegate
}
#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST

//
// Override the interval at which liveness of the subscription is assessed.
// By default, this is set set to the max interval of the subscription + ACK timeout of the underlying session.
//
// This can be called at any time.
//
/**
* Override the interval at which liveness of the subscription is assessed.
* By default, this is set set to the max interval of the subscription + ACK timeout of the underlying session.
*
* This can be only be called once a subscription has been established and is active. Once called, this will cancel any existing
* liveness timers and schedule a new one.
*
* This can be called from the Callback::OnSubscriptionEstablished callback.
*
*/
void OverrideLivenessTimeout(System::Clock::Timeout aLivenessTimeout);

private:
Expand Down
4 changes: 4 additions & 0 deletions src/controller/python/chip/clusters/Attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ def SetResubscriptionAttemptedCallback(self, callback: Callable[[SubscriptionTra
Sets the callback function that gets invoked anytime a re-subscription is attempted. The callback is expected
to have the following signature:
def Callback(transaction: SubscriptionTransaction, errorEncountered: int, nextResubscribeIntervalMsec: int)
If the callback is an awaitable co-routine, isAsync should be set to True.
'''
if callback is not None:
self._onResubscriptionAttemptedCb = callback
Expand All @@ -517,6 +519,8 @@ def SetResubscriptionSucceededCallback(self, callback: Callback[[SubscriptionTra
Sets the callback function that gets invoked when a re-subscription attempt succeeds. The callback
is expected to have the following signature:
def Callback(transaction: SubscriptionTransaction)
If the callback is an awaitable co-routine, isAsync should be set to True.
'''
if callback is not None:
self._onResubscriptionSucceededCb = callback
Expand Down

0 comments on commit 56414ef

Please sign in to comment.