Skip to content

Commit

Permalink
time synchronization cluster XML update (#26332)
Browse files Browse the repository at this point in the history
* update time sync cluster XML based on updated spec

added attribute access interface handled attributes

GNSS

Co-authored-by: Boris Zbarsky <[email protected]>

TrustedTimeSource is optional with TSC feature

Co-authored-by: Boris Zbarsky <[email protected]>

SetUTCTime

Co-authored-by: Boris Zbarsky <[email protected]>

SetTrustedTimeSource is optional

Co-authored-by: Boris Zbarsky <[email protected]>

UTCTime

Co-authored-by: Boris Zbarsky <[email protected]>

TimeZoneDatabase default 2 (None)
MissingTrustedTimeSource is optional

regenerate code

update default values

* bring back section removed by rebase

Signed-off-by: Fesseha <[email protected]>

---------

Signed-off-by: Fesseha <[email protected]>
  • Loading branch information
fessehaeve authored and pull[bot] committed Feb 5, 2024
1 parent d64b6bc commit 3245018
Show file tree
Hide file tree
Showing 25 changed files with 2,130 additions and 564 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,74 @@ limitations under the License.
<configurator>
<domain name="CHIP"/>

<bitmap name="TimeSynchronizationFeature" type="BITMAP32">
<cluster code="0x0038"/>
<field name="TimeZone" mask="0x1"/>
<field name="NTPClient" mask="0x2"/>
<field name="NTPServer" mask="0x4"/>
<field name="TimeSyncClient" mask="0x8"/>
</bitmap>

<!-- NOTE: This type is not defined as an enum in the spec, but the Status Codes section
of this cluster defines these status codes, and we're choosing to represent them as an enum. -->
<enum name="StatusCode" type="ENUM8">
<cluster code="0x0038"/>
<item name="TimeNotAccepted" value="0x02"/>
</enum>

<enum name="GranularityEnum" type="ENUM8">
<cluster code="0x0038"/>
<item name="NoTimeGranularity" value="0x00"/>
<item name="MinutesGranularity" value="0x01"/>
<item name="SecondsGranularity" value="0x02"/>
<item name="MillisecondsGranularity" value="0x03"/>
<item name="MicrosecondsGranularity" value="0x04"/>
<item name="NoTimeGranularity" value="0x00"/>
<item name="MinutesGranularity" value="0x01"/>
<item name="SecondsGranularity" value="0x02"/>
<item name="MillisecondsGranularity" value="0x03"/>
<item name="MicrosecondsGranularity" value="0x04"/>
</enum>

<enum name="TimeSourceEnum" type="ENUM8">
<cluster code="0x0038"/>
<item name="None" value="0x00"/>
<item name="Unknown" value="0x01"/>
<item name="Admin" value="0x02"/>
<item name="NodeTimeCluster" value="0x03"/>
<item name="NonFabricSntp" value="0x04"/>
<item name="NonFabricNtp" value="0x05"/>
<item name="FabricSntp" value="0x06"/>
<item name="FabricNtp" value="0x07"/>
<item name="MixedNtp" value="0x08"/>
<item name="NonFabricSntpNts" value="0x09"/>
<item name="NonFabricNtpNts" value="0x0A"/>
<item name="FabricSntpNts" value="0x0B"/>
<item name="FabricNtpNts" value="0x0C"/>
<item name="MixedNtpNts" value="0x0D"/>
<item name="CloudSource" value="0x0E"/>
<item name="Ptp" value="0x0F"/>
<item name="Gnss" value="0x10"/>
<item name="None" value="0x00"/>
<item name="Unknown" value="0x01"/>
<item name="Admin" value="0x02"/>
<item name="NodeTimeCluster" value="0x03"/>
<item name="NonMatterSNTP" value="0x04"/>
<item name="NonMatterNTP" value="0x05"/>
<item name="MatterSNTP" value="0x06"/>
<item name="MatterNTP" value="0x07"/>
<item name="MixedNTP" value="0x08"/>
<item name="NonMatterSNTPNTS" value="0x09"/>
<item name="NonMatterNTPNTS" value="0x0A"/>
<item name="MatterSNTPNTS" value="0x0B"/>
<item name="MatterNTPNTS" value="0x0C"/>
<item name="MixedNTPNTS" value="0x0D"/>
<item name="CloudSource" value="0x0E"/>
<item name="PTP" value="0x0F"/>
<item name="GNSS" value="0x10"/>
</enum>

<enum name="TimeZoneDatabaseEnum" type="ENUM8">
<cluster code="0x0038"/>
<item name="Full" value="0x00"/>
<item name="Partial" value="0x01"/>
<item name="None" value="0x02"/>
</enum>

<struct name="TrustedTimeSourceStruct">
<cluster code="0x0038"/>
<item fieldId="0" name="FabricIndex" type="fabric_idx"/>
<item fieldId="1" name="NodeID" type="node_id"/>
<item fieldId="2" name="Endpoint" type="endpoint_no"/>
</struct>

<struct name="FabricScopedTrustedTimeSourceStruct">
<cluster code="0x0038"/>
<item fieldId="0" name="NodeID" type="node_id"/>
<item fieldId="1" name="Endpoint" type="endpoint_no"/>
</struct>

<struct name="TimeZoneStruct">
<cluster code="0x0038"/>
<item fieldId="0" name="Offset" type="INT32S"/>
<item fieldId="0" name="Offset" type="INT32S" min="-43200" max="50400"/>
<item fieldId="1" name="ValidAt" type="epoch_us"/>
<item fieldId="2" name="Name" type="CHAR_STRING" length="64" optional="true"/>
</struct>
Expand All @@ -58,7 +93,7 @@ limitations under the License.
<cluster code="0x0038"/>
<item fieldId="0" name="Offset" type="INT32S"/>
<item fieldId="1" name="ValidStarting" type="epoch_us"/>
<item fieldId="2" name="ValidUntil" type="epoch_us"/>
<item fieldId="2" name="ValidUntil" type="epoch_us" isNullable="true"/>
</struct>

<cluster>
Expand All @@ -68,42 +103,81 @@ limitations under the License.
<define>TIME_SYNCHRONIZATION_CLUSTER</define>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>Accurate time is required for a number of reasons, including scheduling, display and validating
security materials.</description>
<description>Accurate time is required for a number of reasons, including scheduling, display and validating security materials.</description>
<!-- Base data types -->
<attribute side="server" code="0x0000" define="UTC_TIME" type="epoch_us" isNullable="true" optional="false">UTCTime</attribute>
<attribute side="server" code="0x0001" define="GRANULARITY" type="GranularityEnum" default="0x00" optional="false">Granularity</attribute>
<attribute side="server" code="0x0002" define="TIME_SOURCE" type="TimeSourceEnum" default="0x00" optional="true">TimeSource</attribute>
<attribute side="server" code="0x0003" define="TRUSTED_TIME_NODE_ID" type="node_id" writable="true" isNullable="true" optional="false">
<description>TrustedTimeNodeId</description>
<access op="read" privilege="view"/>
<access op="write" privilege="administer"/>
</attribute>
<attribute side="server" code="0x0004" define="DEFAULT_NTP" type="CHAR_STRING" length="128" writable="true" isNullable="true" optional="true">
<description>DefaultNtp</description>
<access op="read" privilege="view"/>
<access op="write" privilege="administer"/>
</attribute>
<attribute side="server" code="0x0005" define="TIME_ZONE" type="ARRAY" entryType="TimeZoneStruct" min="1" max="2" writable="true" optional="true">
<description>TimeZone</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0006" define="DST_OFFSET" type="ARRAY" entryType="DSTOffsetStruct" max="20" writable="true" optional="true">
<description>DSTOffset</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0007" define="LOCAL_TIME" type="epoch_us" default="0x00" isNullable="true" optional="true">LocalTime</attribute>
<attribute side="server" code="0x0008" define="TIME_ZONE_DATABASE" type="boolean" default="0" optional="true">TimeZoneDatabase</attribute>
<attribute side="server" code="0x0009" define="NTP_SERVER_PORT" type="INT16U" isNullable="true" optional="true">NtpServerPort</attribute>

<!-- Test Commands -->
<command source="client" code="0x00" name="SetUtcTime" optional="false">
<description>Upon receipt of this command, the server MAY update its UTCTime Attribute to match the time specified in the command</description>
<arg name="UtcTime" type="epoch_us"/>
<arg name="Granularity" type="GranularityEnum"/>
<arg name="TimeSource" type="TimeSourceEnum" optional="true"/>
</command>
<attribute side="server" code="0x0003" define="TRUSTED_TIME_SOURCE" type="TrustedTimeSourceStruct" isNullable="true" optional="true">TrustedTimeSource</attribute>
<attribute side="server" code="0x0004" define="DEFAULT_NTP" type="CHAR_STRING" length="128" isNullable="true" optional="true">DefaultNTP</attribute>
<attribute side="server" code="0x0005" define="TIME_ZONE" type="ARRAY" entryType="TimeZoneStruct" optional="true">TimeZone</attribute>
<attribute side="server" code="0x0006" define="DST_OFFSET" type="ARRAY" entryType="DSTOffsetStruct" optional="true">DSTOffset</attribute>
<attribute side="server" code="0x0007" define="LOCAL_TIME" type="epoch_us" default="0xFFFFFFFFFFFFFFFF" isNullable="true" optional="true">LocalTime</attribute>
<attribute side="server" code="0x0008" define="TIME_ZONE_DATABASE" type="TimeZoneDatabaseEnum" default="2" optional="true">TimeZoneDatabase</attribute>
<attribute side="server" code="0x0009" define="NTP_SERVER_AVAILABLE" type="boolean" default="false" optional="true">NTPServerAvailable</attribute>
<attribute side="server" code="0x000A" define="TIME_ZONE_LIST_MAX_SIZE" type="INT8U" min="1" max="2" optional="true">TimeZoneListMaxSize</attribute>
<attribute side="server" code="0x000B" define="DST_OFFSET_LIST_MAX_SIZE" type="INT8U" min="1" optional="true">DSTOffsetListMaxSize</attribute>
<attribute side="server" code="0x000C" define="SUPPORTS_DNS_RESOLVE" type="boolean" default="false" optional="true">SupportsDNSResolve</attribute>

<command source="client" code="0x00" name="SetUTCTime" optional="false">
<description>This command MAY be issued by Administrator to set the time.</description>
<arg name="UTCTime" type="epoch_us"/>
<arg name="Granularity" type="GranularityEnum"/>
<arg name="TimeSource" type="TimeSourceEnum" optional="true"/>
<access op="invoke" privilege="administer"/>
</command>

<command source="client" code="0x01" name="SetTrustedTimeSource" isFabricScoped="true" optional="true">
<description>This command SHALL set TrustedTimeSource.</description>
<arg name="TrustedTimeSource" type="FabricScopedTrustedTimeSourceStruct" isNullable="true"/>
<access op="invoke" privilege="administer"/>
</command>

<command source="client" code="0x02" name="SetTimeZone" response="SetTimeZoneResponse" optional="true">
<description>This command SHALL set TimeZone.</description>
<arg name="TimeZone" type="TimeZoneStruct" array="true"/>
<access op="invoke" privilege="manage"/>
</command>

<command source="server" code="0x03" name="SetTimeZoneResponse" optional="true">
<description>Response to SetTimeZone.</description>
<arg name="DSTOffsetRequired" type="boolean"/>
</command>

<command source="client" code="0x04" name="SetDSTOffset" optional="true">
<description>This command SHALL set DSTOffset.</description>
<arg name="DSTOffset" type="DSTOffsetStruct" array="true"/>
<access op="invoke" privilege="manage"/>
</command>

<command source="client" code="0x05" name="SetDefaultNTP" optional="true">
<description>This command is used to set DefaultNTP.</description>
<arg name="DefaultNTP" type="CHAR_STRING" length="128" isNullable="true"/>
<access op="invoke" privilege="administer"/>
</command>

<event code="0x0000" name="DSTTableEmpty" priority="info" side="server" optional="true">
<description>This event SHALL be generated when the server stops applying the current DSTOffset and there are no entries in the list with a larger ValidStarting time.</description>
</event>

<event code="0x0001" name="DSTStatus" priority="info" side="server" optional="true">
<description>This event SHALL be generated when the server starts or stops applying a DST offset.</description>
<field id="0" name="DSTOffsetActive" type="boolean" />
</event>

<event code="0x0002" name="TimeZoneStatus" priority="info" side="server" optional="true">
<description>This event SHALL be generated when the server changes its time zone offset or name.</description>
<field id="0" name="Offset" type="INT32S"/>
<field id="1" name="Name" type="CHAR_STRING" length="64" optional="true"/>
</event>

<event code="0x0003" name="TimeFailure" priority="info" side="server" optional="false">
<description>This event SHALL be generated if the node has attempted to update its time, but was unable to find a good time from any source.</description>
</event>

<event code="0x0004" name="MissingTrustedTimeSource" priority="info" side="server" optional="true">
<description>This event SHALL be generated if the node attempts to update its time and finds that the TrustedTimeSource is null, or the specified peer cannot be reached.</description>
</event>

</cluster>
</configurator>
10 changes: 9 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,15 @@
"Channel": ["Lineup", "CurrentChannel"],
"Media Playback": ["SampledPosition"],
"Application Launcher": ["CurrentApp"],
"Application Basic": ["Application"]
"Application Basic": ["Application"],
"Time Synchronization": [
"TrustedTimeSource",
"DefaultNTP",
"TimeZone",
"DSTOffset",
"UTCTime",
"LocalTime"
]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
10 changes: 9 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,15 @@
"Channel": ["Lineup", "CurrentChannel"],
"Media Playback": ["SampledPosition"],
"Application Launcher": ["CurrentApp"],
"Application Basic": ["Application"]
"Application Basic": ["Application"],
"Time Synchronization": [
"TrustedTimeSource",
"DefaultNTP",
"TimeZone",
"DSTOffset",
"UTCTime",
"LocalTime"
]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
Loading

0 comments on commit 3245018

Please sign in to comment.