Skip to content

Commit

Permalink
Added required #ifdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadb-amazon committed Sep 26, 2023
1 parent 5e8a144 commit eef7887
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ class CommissionerDiscoveryDelegateImpl : public chip::Controller::DeviceDiscove
// commissioners
chip::DeviceLayer::SystemLayer().CancelTimer(ReportSleepingCommissioners, this);
if (mCachedTargetVideoPlayerInfos != nullptr && mCachedTargetVideoPlayerInfos[0].IsInitialized()) {
chip::DeviceLayer::SystemLayer().StartTimer(
chip::System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC * 1000), ReportSleepingCommissioners,
this);
#ifdef CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC
chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(
#ifdef CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC
CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC
#else
0
#endif
* 1000),
ReportSleepingCommissioners, this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ class TargetVideoPlayerInfo
void SetLastDiscovered(chip::System::Clock::Timestamp lastDiscovered) { mLastDiscovered = lastDiscovered; }
bool WasRecentlyDiscoverable()
{
#ifdef CHIP_DEVICE_CONFIG_STR_CACHE_LAST_DISCOVERED_HOURS
// it was recently discoverable if its mLastDiscovered.count is within
// CHIP_DEVICE_CONFIG_STR_CACHE_LAST_DISCOVERED_HOURS of current time
return mLastDiscovered.count() > chip::System::SystemClock().GetMonotonicMilliseconds64().count() -
CHIP_DEVICE_CONFIG_STR_CACHE_LAST_DISCOVERED_HOURS * 60 * 60 * 1000;
#else
return true;
#endif // CHIP_DEVICE_CONFIG_STR_CACHE_LAST_DISCOVERED_HOURS
}

chip::OperationalDeviceProxy * GetOperationalDeviceProxy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,9 @@ CHIP_ERROR CastingServer::VerifyOrEstablishConnection(TargetVideoPlayerInfo & ta
{
ChipLogProgress(AppServer, "CastingServer::VerifyOrEstablishConnection(): Sending WoL to sleeping VideoPlayer and waiting");
ReturnErrorOnFailure(CastingServer::GetInstance()->SendWakeOnLan(targetVideoPlayerInfo));
#ifdef CHIP_DEVICE_CONFIG_STR_WAKE_UP_DELAY_SEC
usleep(CHIP_DEVICE_CONFIG_STR_WAKE_UP_DELAY_SEC * 1000 * 1000);
#endif // CHIP_DEVICE_CONFIG_STR_WAKE_UP_DELAY_SEC
}

CastingServer::GetInstance()->mActiveTargetVideoPlayerInfo = targetVideoPlayerInfo;
Expand Down

0 comments on commit eef7887

Please sign in to comment.