Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time synchronization cluster #26082

Merged
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
c843519
update time sync cluster XML based on updated spec
fessehaeve May 2, 2023
4c54583
update time sync cluster XML based on updated spec
fessehaeve May 2, 2023
0691f54
added attribute access interface handled attributes
fessehaeve May 2, 2023
fdd9a4c
GNSS
fessehaeve May 3, 2023
c311d21
TrustedTimeSource is optional with TSC feature
fessehaeve May 3, 2023
182aecf
SetUTCTime
fessehaeve May 3, 2023
808d7b3
SetTrustedTimeSource is optional
fessehaeve May 3, 2023
e1b4578
UTCTime
fessehaeve May 3, 2023
652bcb0
TimeZoneDatabase default 2 (None)
fessehaeve May 3, 2023
80ccd23
regenerate code
fessehaeve May 3, 2023
844783e
update default values
fessehaeve May 3, 2023
1367a2f
updated time-synchronization cluster definition based on PR #6352
fessehaeve Mar 22, 2023
df786be
added SupportsDNSResolve attribute and corrected featuremap value
fessehaeve May 4, 2023
7d089a0
code improvements
fessehaeve May 4, 2023
48633d1
truncate span size to actual data when retreiving defaultNTP
fessehaeve May 5, 2023
8c59a50
bring back section removed by rebase
fessehaeve May 8, 2023
2b87054
Merge branch 'pull-request/time-synchronization-xml' into pull-reques…
fessehaeve May 8, 2023
a843dd5
fix CI error do not use 'else' after 'return'
fessehaeve May 8, 2023
4b19983
updated descriptor cluster test to include time sync server
fessehaeve May 8, 2023
f0c5943
added mechanisms to get local time and set utc time from application
fessehaeve May 9, 2023
19cf4f7
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve May 9, 2023
113a7cf
regenerate after merge to master and fix missed server implementation…
fessehaeve May 9, 2023
1c57991
added CI test for time sync cluster
fessehaeve May 11, 2023
6a856d4
improved time zone and dst offset attributes validation,
fessehaeve May 11, 2023
a01af6d
logic to purge expired time zone and dst offset
fessehaeve May 12, 2023
c410517
set default value for time zone attribute
fessehaeve May 17, 2023
627d921
use AttributeAccessInterface for Granularity attribute
fessehaeve May 19, 2023
eb26f18
UTCTime is in chipepoch and not unixepoch
fessehaeve May 23, 2023
f799c32
localtime should be null if dstoffset is empty
fessehaeve May 23, 2023
5d12183
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve May 24, 2023
3c27a07
regen after merge to master
fessehaeve May 24, 2023
561a32d
update feature map attribute name
fessehaeve May 24, 2023
f166702
use static_cast instead
fessehaeve May 24, 2023
80e0e58
cast the whole thing since the operator is causing int usage
fessehaeve May 24, 2023
31a6ab7
timezone always has a default UTC zone
fessehaeve May 24, 2023
db7e060
improved handling of setting empty lists
fessehaeve May 25, 2023
6b580c7
run restyler
fessehaeve May 25, 2023
ff4c60f
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve May 25, 2023
6133fe0
update external hanlded attributes in ZAP files
fessehaeve May 25, 2023
d7468e3
update tests and remove dstoffset sorting on server side
fessehaeve May 25, 2023
06823c0
update yaml test and generate code
fessehaeve May 25, 2023
69065c8
use TLV size estimator
fessehaeve May 26, 2023
462cb33
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve May 26, 2023
ae9b95e
addressed a bunch of PR comments
fessehaeve May 30, 2023
092843a
declare attributes handled by AAI
fessehaeve May 30, 2023
96121b9
Update src/app/clusters/time-synchronization-server/TimeSyncDataProvi…
fessehaeve Jun 1, 2023
df139ef
added mechanism to better track when events shall be emitted
fessehaeve Jun 1, 2023
e2a2f10
address PR comments
fessehaeve Jun 2, 2023
72ade1c
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve Jun 5, 2023
664766e
typo changes
fessehaeve Jun 5, 2023
8dceb9f
Revert parts of "address PR comments"
fessehaeve Jun 5, 2023
1aa9151
clean up time sync persistent storage interface
fessehaeve Jun 5, 2023
43464d7
error if list sizes are not correct
fessehaeve Jun 5, 2023
ed54358
addressed PR comments
fessehaeve Jun 13, 2023
726626e
rename default delegate implementation
fessehaeve Jun 14, 2023
b3d81b7
few more improvements based on PR comments
fessehaeve Jun 14, 2023
5446531
changed time zone stuct, improved tests, fixed local time calculation…
fessehaeve Jun 16, 2023
1c6175d
restyle, use DSTOffsetobj with size element, improved error response …
fessehaeve Jun 20, 2023
a00499d
replace list with span, not sure if it is needed
fessehaeve Jun 20, 2023
f6a6b92
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve Jun 20, 2023
90eefcc
update dstoffset NL test
fessehaeve Jun 20, 2023
a2c6169
cleaned up for loop indexes, catch dst validUntil expiring, nullable …
fessehaeve Jun 22, 2023
aca64c6
disabled darwin time sync SDK test
fessehaeve Jun 23, 2023
f3b4600
change indexer to size_t type
fessehaeve Jun 23, 2023
5b1a0d7
validate NTP addresses in default delegate and few more improvements
fessehaeve Jun 26, 2023
12e9232
fixed few overflow potentials, lots of minor improvements
fessehaeve Jun 27, 2023
98db550
fix uninitialized corner case and update NL tests
fessehaeve Jun 27, 2023
1579179
apply restyle patch
fessehaeve Jun 27, 2023
ab106b8
another restyle patch
fessehaeve Jun 27, 2023
87f9098
return tz and dst lists by reference, fixed based on TC_TIMESYNC results
fessehaeve Jun 28, 2023
c0d7ad7
apply restyler patch
fessehaeve Jun 28, 2023
80afe93
fix readability-else-after-return
fessehaeve Jun 29, 2023
23dd47e
Merge remote-tracking branch 'origin/master' into pull-request/time-s…
fessehaeve Jun 29, 2023
e57c01e
kickout all DST items if they are all in the past
fessehaeve Jun 29, 2023
abb7a80
use const and reference whenever possible
fessehaeve Jun 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
few more improvements based on PR comments
  • Loading branch information
fessehaeve committed Jun 14, 2023
commit b3d81b78061b6d78d6c6f6c83482bfe680f9f609
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ CHIP_ERROR TimeSynchronizationServer::SetDefaultNTP(const DataModel::Nullable<Ch
CHIP_ERROR TimeSynchronizationServer::SetTimeZone(const DataModel::DecodableList<Structs::TimeZoneStruct::Type> & tzL)
{
size_t items;
ReturnErrorOnFailure(tzL.ComputeSize(&items));
VerifyOrReturnError(CHIP_NO_ERROR == tzL.ComputeSize(&items), CHIP_IM_GLOBAL_STATUS(InvalidCommand));

if (items > CHIP_CONFIG_TIME_ZONE_LIST_MAX_SIZE)
{
Expand Down Expand Up @@ -352,7 +352,7 @@ CHIP_ERROR TimeSynchronizationServer::SetTimeZone(const DataModel::DecodableList
if (CHIP_NO_ERROR != newTzL.GetStatus())
{
mTimeSyncDataProvider.LoadTimeZone(mTimeZoneList, mTimeZoneListSize);
return newTzL.GetStatus();
return CHIP_IM_GLOBAL_STATUS(InvalidCommand);
}
if (i == 0)
{
Expand Down Expand Up @@ -382,7 +382,7 @@ CHIP_ERROR TimeSynchronizationServer::SetTimeZone(const DataModel::DecodableList
CHIP_ERROR TimeSynchronizationServer::SetDSTOffset(const DataModel::DecodableList<Structs::DSTOffsetStruct::Type> & dstL)
{
size_t items;
ReturnErrorOnFailure(dstL.ComputeSize(&items));
VerifyOrReturnError(CHIP_NO_ERROR == dstL.ComputeSize(&items), CHIP_IM_GLOBAL_STATUS(InvalidCommand));

if (items > CHIP_CONFIG_DST_OFFSET_LIST_MAX_SIZE)
{
Expand All @@ -401,7 +401,7 @@ CHIP_ERROR TimeSynchronizationServer::SetDSTOffset(const DataModel::DecodableLis
if (CHIP_NO_ERROR != newDstL.GetStatus())
{
mTimeSyncDataProvider.LoadDSTOffset(mDstOffsetList, mDstOffsetListSize);
return newDstL.GetStatus();
return CHIP_IM_GLOBAL_STATUS(InvalidCommand);
}
if (i == 0)
{
Expand Down Expand Up @@ -492,16 +492,22 @@ DataModel::List<Structs::DSTOffsetStruct::Type> TimeSynchronizationServer::GetDS
void TimeSynchronizationServer::ScheduleDelayedAction(System::Clock::Seconds32 delay, System::TimerCompleteCallback action,
void * aAppState)
{
VerifyOrDie(SystemLayer().StartTimer(std::chrono::duration_cast<System::Clock::Timeout>(delay), action, aAppState) ==
CHIP_NO_ERROR);
if (CHIP_NO_ERROR != SystemLayer().StartTimer(std::chrono::duration_cast<System::Clock::Timeout>(delay), action, aAppState))
{
ChipLogError(Zcl, "Time Synchronization failed to schedule timer.");
}
}

CHIP_ERROR TimeSynchronizationServer::SetUTCTime(EndpointId ep, uint64_t utcTime, GranularityEnum granularity,
TimeSourceEnum source)
{
ReturnErrorOnFailure(UpdateUTCTime(utcTime));
mGranularity = granularity;
TimeSource::Set(ep, source);
if (EMBER_ZCL_STATUS_SUCCESS != TimeSource::Set(ep, source))
{
ChipLogError(Zcl, "Writing TimeSource failed.");
return CHIP_IM_GLOBAL_STATUS(Failure);
}
return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -807,6 +813,10 @@ bool emberAfTimeSynchronizationClusterSetTimeZoneCallback(
{
commandObj->AddStatus(commandPath, Status::ResourceExhausted);
}
else if (err == CHIP_IM_GLOBAL_STATUS(InvalidCommand))
{
commandObj->AddStatus(commandPath, Status::InvalidCommand);
}
else
{
commandObj->AddStatus(commandPath, Status::ConstraintError);
Expand Down Expand Up @@ -870,6 +880,10 @@ bool emberAfTimeSynchronizationClusterSetDSTOffsetCallback(
{
commandObj->AddStatus(commandPath, Status::ResourceExhausted);
}
else if (err == CHIP_IM_GLOBAL_STATUS(InvalidCommand))
{
commandObj->AddStatus(commandPath, Status::InvalidCommand);
}
else
{
commandObj->AddStatus(commandPath, Status::ConstraintError);
Expand Down