Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille committed Sep 21, 2023
1 parent 89e9b37 commit 9a52231
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,21 +300,18 @@ void TimeSynchronizationServer::AttemptToGetFallbackNTPTimeFromDelegate()
void TimeSynchronizationServer::OnDeviceConnectedFn(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle)
{
// Connected to our trusted time source, let's read the time.
app::AttributePathParams readPaths[2];
readPaths[0] = app::AttributePathParams(kRootEndpointId, app::Clusters::TimeSynchronization::Id,
app::Clusters::TimeSynchronization::Attributes::UTCTime::Id);
readPaths[1] = app::AttributePathParams(kRootEndpointId, app::Clusters::TimeSynchronization::Id,
app::Clusters::TimeSynchronization::Attributes::Granularity::Id);

app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance();
app::ReadPrepareParams readParams(sessionHandle);
AttributePathParams readPaths[2];
readPaths[0] = AttributePathParams(kRootEndpointId, Id, Attributes::UTCTime::Id);
readPaths[1] = AttributePathParams(kRootEndpointId, Id, Attributes::Granularity::Id);

InteractionModelEngine * engine = InteractionModelEngine::GetInstance();
ReadPrepareParams readParams(sessionHandle);
readParams.mpAttributePathParamsList = readPaths;
readParams.mAttributePathParamsListSize = 2;

mTrustedNodeUtcTime.SetNull();
mTrustedNodeGranularity = GranularityEnum::kNoTimeGranularity;
auto readClient =
chip::Platform::MakeUnique<app::ReadClient>(engine, &exchangeMgr, *this, app::ReadClient::InteractionType::Read);
auto readClient = Platform::MakeUnique<ReadClient>(engine, &exchangeMgr, *this, ReadClient::InteractionType::Read);
if (readClient == nullptr)
{
// This is unlikely to work if we don't have memory, but let's try
Expand Down Expand Up @@ -347,13 +344,13 @@ void TimeSynchronizationServer::OnAttributeData(const ConcreteDataAttributePath
switch (aPath.mAttributeId)
{
case Attributes::UTCTime::Id:
if (chip::app::DataModel::Decode(*apData, mTrustedNodeUtcTime) != CHIP_NO_ERROR)
if (DataModel::Decode(*apData, mTrustedNodeUtcTime) != CHIP_NO_ERROR)
{
mTrustedNodeUtcTime.SetNull();
}
break;
case Attributes::Granularity::Id:
if (chip::app::DataModel::Decode(*apData, mTrustedNodeGranularity) != CHIP_NO_ERROR)
if (DataModel::Decode(*apData, mTrustedNodeGranularity) != CHIP_NO_ERROR)
{
mTrustedNodeGranularity = GranularityEnum::kNoTimeGranularity;
}
Expand All @@ -365,8 +362,6 @@ void TimeSynchronizationServer::OnAttributeData(const ConcreteDataAttributePath

void TimeSynchronizationServer::OnDone(ReadClient * apReadClient)
{
using namespace chip::app::Clusters::TimeSynchronization::Attributes;

if (!mTrustedNodeUtcTime.IsNull() && mTrustedNodeGranularity != GranularityEnum::kNoTimeGranularity)
{
GranularityEnum ourGranularity;
Expand Down

0 comments on commit 9a52231

Please sign in to comment.