Skip to content

Commit

Permalink
TimeSource is optional. Therefore, do not error when it cannot be set. (
Browse files Browse the repository at this point in the history
  • Loading branch information
fessehaeve authored and pull[bot] committed Jan 9, 2024
1 parent d37fe97 commit 1716017
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,9 @@ void TimeSynchronizationServer::OnTimeSyncCompletionFn(TimeSourceEnum timeSource
}
return;
}
mGranularity = granularity;
if (EMBER_ZCL_STATUS_SUCCESS != TimeSource::Set(kRootEndpointId, timeSource))
mGranularity = granularity;
EmberAfStatus status = TimeSource::Set(kRootEndpointId, timeSource);
if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE))
{
ChipLogError(Zcl, "Writing TimeSource failed.");
}
Expand All @@ -405,7 +406,8 @@ void TimeSynchronizationServer::OnFallbackNTPCompletionFn(bool timeSyncSuccessfu
{
mGranularity = GranularityEnum::kMillisecondsGranularity;
// Non-matter SNTP because we know it's external and there's only one source
if (EMBER_ZCL_STATUS_SUCCESS != TimeSource::Set(kRootEndpointId, TimeSourceEnum::kNonMatterSNTP))
EmberAfStatus status = TimeSource::Set(kRootEndpointId, TimeSourceEnum::kNonMatterSNTP);
if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE))
{
ChipLogError(Zcl, "Writing TimeSource failed.");
}
Expand Down Expand Up @@ -789,8 +791,9 @@ CHIP_ERROR TimeSynchronizationServer::SetUTCTime(EndpointId ep, uint64_t utcTime
ChipLogError(Zcl, "Error setting UTC time on the device");
return err;
}
mGranularity = granularity;
if (EMBER_ZCL_STATUS_SUCCESS != TimeSource::Set(ep, source))
mGranularity = granularity;
EmberAfStatus status = TimeSource::Set(ep, source);
if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE))
{
ChipLogError(Zcl, "Writing TimeSource failed.");
return CHIP_IM_GLOBAL_STATUS(Failure);
Expand Down

0 comments on commit 1716017

Please sign in to comment.