Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
harsha-rajendran committed Mar 9, 2022
1 parent 62714f3 commit 1c2295a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ CHIP_ERROR ExtendedOTARequestorDriver::GetUserConsentSubject(chip::ota::UserCons
else
{
ChipLogError(SoftwareUpdate, "ExtendedOTARequestorDriver::GetUserConsentSubject: mLastProvider is empty");
return CHIP_ERROR_INTERNAL;
}

// TODO: As we cannot use the src/app/Server.h in here so, figure out a way to get the node id.
Expand Down
13 changes: 2 additions & 11 deletions src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,25 +342,16 @@ bool GenericOTARequestorDriver::DetermineProviderLocation(ProviderLocation::Type
}
}

// If no suitable candidate found, return in the following order:
// - first element of the default providers list OR
// - the last used provider OR
// - error (no suitable candidate)
// If no suitable candidate found, return the first element of the default providers list or an error
iterator = mRequestor->GetDefaultOTAProviderListIterator();
if (iterator.Next())
{
providerLocation = iterator.GetValue();
return true;
}
else if (mLastUsedProvider.HasValue())
{
providerLocation = mLastUsedProvider.Value();
return true;
}
else
{
ChipLogError(SoftwareUpdate,
"GenericOTARequestorDriver::DetermineProviderLocation: No suitable OTA Provider candidate found");
ChipLogError(SoftwareUpdate, "No suitable OTA Provider candidate found");
return false;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ota-requestor/GenericOTARequestorDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class GenericOTARequestorDriver : public OTARequestorDriver
uint32_t mPeriodicQueryTimeInterval = (24 * 60 * 60); // Timeout for querying providers on the default OTA provider list

using ProviderLocationType = app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type;
chip::Optional<ProviderLocationType> mLastUsedProvider; // Provider location used for the last query or update
Optional<ProviderLocationType> mLastUsedProvider; // Provider location used for the last query or update
};

} // namespace DeviceLayer
Expand Down

0 comments on commit 1c2295a

Please sign in to comment.