Skip to content

Commit

Permalink
add Time Synchronization cluster in all-clusters-app, controller-app …
Browse files Browse the repository at this point in the history
…and light-switch-app zap and regenerate all

remove constraint from a single element attribute

first code commit

initialize timezone and trustedtimesource to 0 and null

added statuscode and changed to fabricIndex

regenerate zap

use time sync server code

set default zap setting to external for complex time sync attributes

add endpoint to trustedtimesourcestruct and set command for it

regenerate

using updated trustedtimesourcestruct

update time sync xml definition

update zap files

regenerate

added persistent data provider for time sync cluster

added new commands based on PR project-chip#6353

added test template for TimeSyncDataProvider

changed command arguments to list type

regenerate

update SetTrustedTimeSource definition

regenerate

use consistent data types of attributes

user CHIP_CONFIG to set size of lists

clean up read handler

adde TSC feature and change attribute ids

include time sync related resource for build

regenerate after changing attribute ids and adding time sync client feature

reorganize code and implement defaultNTP handlers

handle span data the right way
improved overall implementation

change default time zone list size to 1

made settrustedtimesource command to be fabric scoped

update time sync cluster definition based on latest PR merges

regenerate and changes related to attribute names and access

setdefaultntp parameter is nullable

implemented setdefaultntp

changed the id of settimezoneresponse command to the current in spec

removed curly brace that sneaked in to previous commits

ValidUntil of DSTOffsetStruct is nullable

added basic rules of operation in comment/psuedo-code

added DSTOffsetActive predicate for DSTStatus event

fixed clang compiler errors

added skeleton delegate implementation for time sync

use delegate placeholder and implemented events

clean up usage of namespaces

seems like unused code

skleton verifiers for NTP address

moved init from header

removed conflicting generated files
  • Loading branch information
fessehaeve committed Apr 28, 2023
1 parent 2602c09 commit 0832f07
Show file tree
Hide file tree
Showing 75 changed files with 14,908 additions and 428 deletions.
166 changes: 163 additions & 3 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1870,9 +1870,144 @@ server cluster EthernetNetworkDiagnostics = 55 {
command ResetCounts(): DefaultSuccess = 0;
}

/** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices.
Two types of switch devices are supported: latching switch (e.g. rocker switch) and momentary switch (e.g. push button), distinguished with their feature flags.
Interactions with the switch device are exposed as attributes (for the latching switch) and as events (for both types of switches). An interested party MAY subscribe to these attributes/events and thus be informed of the interactions, and can perform actions based on this, for example by sending commands to perform an action such as controlling a light or a window shade. */
server cluster TimeSynchronization = 56 {
enum GranularityEnum : ENUM8 {
kNoTimeGranularity = 0;
kMinutesGranularity = 1;
kSecondsGranularity = 2;
kMillisecondsGranularity = 3;
kMicrosecondsGranularity = 4;
}

enum StatusCode : ENUM8 {
kTimeNotAccepted = 2;
}

enum TimeSourceEnum : ENUM8 {
kNone = 0;
kUnknown = 1;
kAdmin = 2;
kNodeTimeCluster = 3;
kNonMatterSNTP = 4;
kNonMatterNTP = 5;
kMatterSNTP = 6;
kMatterNTP = 7;
kMixedNTP = 8;
kNonMatterSNTPNTS = 9;
kNonMatterNTPNTS = 10;
kMatterSNTPNTS = 11;
kMatterNTPNTS = 12;
kMixedNTPNTS = 13;
kCloudSource = 14;
kPtp = 15;
kGnss = 16;
}

enum TimeZoneDatabaseEnum : ENUM8 {
kFull = 1;
kPartial = 2;
kNone = 3;
}

bitmap TimeSynchronizationFeature : BITMAP32 {
kTimeZone = 0x1;
kNTPClient = 0x2;
kNTPServer = 0x4;
kTimeSyncClient = 0x8;
}

struct TrustedTimeSourceStruct {
fabric_idx fabricIndex = 0;
node_id nodeID = 1;
endpoint_no endpoint = 2;
}

struct TimeZoneStruct {
int32s offset = 0;
epoch_us validAt = 1;
optional char_string<64> name = 2;
}

struct DSTOffsetStruct {
int32s offset = 0;
epoch_us validStarting = 1;
nullable epoch_us validUntil = 2;
}

struct FabricScopedTrustedTimeSourceStruct {
node_id nodeID = 0;
endpoint_no endpoint = 1;
}

info event DSTTableEmpty = 0 {
}

info event DSTStatus = 1 {
boolean DSTOffsetActive = 0;
}

info event TimeZoneStatus = 2 {
INT32S offset = 0;
CHAR_STRING name = 1;
}

info event TimeFailure = 3 {
}

info event MissingTrustedTimeSource = 4 {
}

readonly attribute nullable epoch_us UTCTime = 0;
readonly attribute GranularityEnum granularity = 1;
readonly attribute TimeSourceEnum timeSource = 2;
readonly attribute nullable TrustedTimeSourceStruct trustedTimeSource[] = 3;
readonly attribute nullable char_string<128> defaultNTP = 4;
readonly attribute TimeZoneStruct timeZone[] = 5;
readonly attribute DSTOffsetStruct DSTOffset[] = 6;
readonly attribute nullable epoch_us localTime = 7;
readonly attribute TimeZoneDatabaseEnum timeZoneDatabase = 8;
readonly attribute int8u timeZoneListMaxSize = 10;
readonly attribute int8u DSTOffsetListMaxSize = 11;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct SetUtcTimeRequest {
epoch_us utcTime = 0;
GranularityEnum granularity = 1;
optional TimeSourceEnum timeSource = 2;
}

request struct SetTrustedTimeSourceRequest {
nullable FabricScopedTrustedTimeSourceStruct trustedTimeSource = 0;
}

request struct SetTimeZoneRequest {
TimeZoneStruct timeZone[] = 0;
}

request struct SetDSTOffsetRequest {
DSTOffsetStruct DSTOffset[] = 0;
}

request struct SetDefaultNTPRequest {
nullable CHAR_STRING<128> defaultNTP = 0;
}

response struct SetTimeZoneResponse = 3 {
boolean DSTOffsetRequired = 0;
}

command access(invoke: administer) SetUtcTime(SetUtcTimeRequest): DefaultSuccess = 0;
fabric command access(invoke: administer) SetTrustedTimeSource(SetTrustedTimeSourceRequest): DefaultSuccess = 1;
command access(invoke: manage) SetTimeZone(SetTimeZoneRequest): SetTimeZoneResponse = 2;
command access(invoke: manage) SetDSTOffset(SetDSTOffsetRequest): DefaultSuccess = 4;
command access(invoke: administer) SetDefaultNTP(SetDefaultNTPRequest): DefaultSuccess = 5;
}

server cluster Switch = 59 {
bitmap SwitchFeature : BITMAP32 {
kLatchingSwitch = 0x1;
Expand Down Expand Up @@ -4863,6 +4998,31 @@ endpoint 0 {
ram attribute clusterRevision default = 1;
}

server cluster TimeSynchronization {
emits event DSTTableEmpty;
emits event DSTStatus;
emits event TimeZoneStatus;
emits event TimeFailure;
emits event MissingTrustedTimeSource;
ram attribute UTCTime;
ram attribute granularity;
ram attribute timeSource;
callback attribute trustedTimeSource;
callback attribute defaultNTP;
callback attribute timeZone default = 1;
callback attribute DSTOffset;
ram attribute localTime default = 1;
ram attribute timeZoneDatabase;
ram attribute timeZoneListMaxSize default = 3;
ram attribute DSTOffsetListMaxSize;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 1;
ram attribute clusterRevision default = 1;
}

server cluster AdministratorCommissioning {
callback attribute windowStatus default = 0;
callback attribute adminFabricIndex default = 1;
Expand Down
Loading

0 comments on commit 0832f07

Please sign in to comment.