Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Apr 20, 2022
1 parent 4158c45 commit 71f7795
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ using namespace ::chip::DeviceLayer;
// Used to indicate that an IP address has been added to the QRCode
#define EXAMPLE_VENDOR_TAG_IP 1

const char * TAG = "all-clusters-app";
const uint32_t delayNotifySeconds = 10;
const char * TAG = "all-clusters-app";
const uint32_t delayConfirmImageSec = 10;

static DeviceCallbacks EchoCallbacks;

Expand Down Expand Up @@ -115,7 +115,7 @@ static void InitOTARequestor(void)
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.DelayNotifyUpdateAppliedAction(delayNotifySeconds);
gRequestorUser.SetDelayConfirmCurrentImageSec(delayConfirmImageSec);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
#endif
}
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ OTAImageProcessorImpl gImageProcessor;

LEDWidget AppLED;

static const char * TAG = "light-app";
const uint32_t delayNotifySeconds = 10;
static const char * TAG = "light-app";
const uint32_t delayConfirmImageSec = 10;

static DeviceCallbacks EchoCallbacks;
namespace {
Expand All @@ -81,7 +81,7 @@ static void InitOTARequestor(void)
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.DelayNotifyUpdateAppliedAction(delayNotifySeconds);
gRequestorUser.SetDelayConfirmCurrentImageSec(delayConfirmImageSec);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
#endif
}
Expand Down
6 changes: 3 additions & 3 deletions examples/ota-requestor-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ using namespace ::chip::DeviceManager;
using namespace ::chip::DeviceLayer;

namespace {
const char * TAG = "ota-requester-app";
const uint32_t delayNotifySeconds = 10;
const char * TAG = "ota-requester-app";
const uint32_t delayConfirmImageSec = 10;
static DeviceCallbacks EchoCallbacks;

DefaultOTARequestor gRequestorCore;
Expand Down Expand Up @@ -79,7 +79,7 @@ static void InitServer(intptr_t context)
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.DelayNotifyUpdateAppliedAction(delayNotifySeconds);
gRequestorUser.SetDelayConfirmCurrentImageSec(delayConfirmImageSec);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
}

Expand Down
10 changes: 5 additions & 5 deletions src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ using namespace app::Clusters::OtaSoftwareUpdateRequestor::Structs;
constexpr uint32_t kDelayQueryUponCommissioningSec = 30; // Delay before sending the initial image query after commissioning
constexpr uint32_t kImmediateStartDelaySec = 1; // Delay before sending a query in response to UrgentUpdateAvailable
constexpr System::Clock::Seconds32 kDefaultDelayedActionTime = System::Clock::Seconds32(120);
System::Clock::Seconds32 mDelayNotifyUpdateAppliedSeconds =
System::Clock::Seconds32(0); // Delay before sending notify update applied command
System::Clock::Seconds32 mDelayConfirmCurrentImageSec =
System::Clock::Seconds32(0); // Delay before confirming current image (in seconds)

DefaultOTARequestorDriver * ToDriver(void * context)
{
Expand All @@ -58,9 +58,9 @@ DefaultOTARequestorDriver * ToDriver(void * context)

} // namespace

void GenericOTARequestorDriver::DelayNotifyUpdateAppliedAction(uint32_t seconds)
void GenericOTARequestorDriver::SetDelayConfirmCurrentImageSec(uint32_t seconds)
{
mDelayNotifyUpdateAppliedSeconds = System::Clock::Seconds32(seconds);
mDelayConfirmCurrentImageSec = System::Clock::Seconds32(seconds);
}

void GenericOTARequestorDriver::Init(OTARequestorInterface * requestor, OTAImageProcessorInterface * processor)
Expand All @@ -72,7 +72,7 @@ void GenericOTARequestorDriver::Init(OTARequestorInterface * requestor, OTAImage
if (mImageProcessor->IsFirstImageRun())
{
ScheduleDelayedAction(
mDelayNotifyUpdateAppliedSeconds,
mDelayConfirmCurrentImageSec,
[](System::Layer *, void * context) {
CHIP_ERROR error = ToDriver(context)->mImageProcessor->ConfirmCurrentImage();
if (error != CHIP_NO_ERROR)
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ota-requestor/DefaultOTARequestorDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DefaultOTARequestorDriver : public OTARequestorDriver
app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason announcementReason) override;
void SendQueryImage() override;
bool GetNextProviderLocation(ProviderLocationType & providerLocation, bool & listExhausted) override;
void DelayNotifyUpdateAppliedAction(uint32_t seconds);
void SetDelayConfirmCurrentImageSec(uint32_t seconds);

protected:
void StartPeriodicQueryTimer();
Expand Down

0 comments on commit 71f7795

Please sign in to comment.