Skip to content

Commit

Permalink
Address review comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Nov 1, 2022
1 parent ab70e46 commit a999e49
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ - (void)setDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queu

_weakDelegate = [MTRWeakReference weakReferenceWithObject:delegate];
_delegateQueue = queue;
[self subscribeWithMinInterval:0];
[self setupSubscription];

os_unfair_lock_unlock(&self->_lock);
}
Expand Down Expand Up @@ -286,7 +286,7 @@ - (void)_handleEventReport:(NSArray<NSDictionary<NSString *, id> *> *)eventRepor
os_unfair_lock_unlock(&self->_lock);
}

- (void)subscribeWithMinInterval:(uint16_t)minInterval
- (void)setupSubscription
{
// for now just subscribe once
if (_subscriptionActive) {
Expand All @@ -312,7 +312,7 @@ - (void)subscribeWithMinInterval:(uint16_t)minInterval
eventPath->mIsUrgentEvent = true;
ReadPrepareParams readParams(session.Value());

readParams.mMinIntervalFloorSeconds = minInterval;
readParams.mMinIntervalFloorSeconds = 0;
// Select a max interval based on the device's claimed idle sleep interval.
auto idleSleepInterval = std::chrono::duration_cast<System::Clock::Seconds32>(
session.Value()->GetRemoteMRPConfig().mIdleRetransTimeout);
Expand All @@ -322,7 +322,7 @@ - (void)subscribeWithMinInterval:(uint16_t)minInterval
if (idleSleepInterval.count() > MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX) {
idleSleepInterval = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX);
}
readParams.mMaxIntervalCeilingSeconds = idleSleepInterval.count();
readParams.mMaxIntervalCeilingSeconds = static_cast<uint16_t>(idleSleepInterval.count());

readParams.mpAttributePathParamsList = attributePath.get();
readParams.mAttributePathParamsListSize = 1;
Expand Down

0 comments on commit a999e49

Please sign in to comment.