Skip to content

Commit

Permalink
[OTA] Make requestor use endpoint from AnnounceOTAProvider command
Browse files Browse the repository at this point in the history
  • Loading branch information
carol-apple committed Jan 4, 2022
1 parent b006321 commit d1d576a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/clusters/ota-requestor/OTARequestor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * comm
{
auto & providerNodeId = commandData.providerNodeId;
auto & announcementReason = commandData.announcementReason;
auto & providerEndpoint = commandData.endpoint;

if (commandObj == nullptr || commandObj->GetExchangeContext() == nullptr)
{
Expand All @@ -199,6 +200,7 @@ EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * comm

mProviderNodeId = providerNodeId;
mProviderFabricIndex = commandObj->GetExchangeContext()->GetSessionHandle().GetFabricIndex();
mProviderEndpointId = providerEndpoint;

ChipLogProgress(SoftwareUpdate, "OTA Requestor received AnnounceOTAProvider");
ChipLogDetail(SoftwareUpdate, " FabricIndex: %" PRIu8, mProviderFabricIndex);
Expand All @@ -209,6 +211,7 @@ EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * comm
{
ChipLogDetail(SoftwareUpdate, " MetadataForNode: %zu", commandData.metadataForNode.Value().size());
}
ChipLogDetail(SoftwareUpdate, " Endpoint: %" PRIu16, commandData.endpoint);

// If reason is URGENT_UPDATE_AVAILABLE, we start OTA immediately. Otherwise, respect the timer value set in mOtaStartDelayMs.
// This is done to exemplify what a real-world OTA Requestor might do while also being configurable enough to use as a test app.
Expand Down

0 comments on commit d1d576a

Please sign in to comment.