Skip to content

Commit 1408898

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Add new time types that got addded to the spec. (#26547)
* Add new time types that got addded to the spec. * Address review comment.
1 parent b03bfee commit 1408898

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

scripts/py_matter_idl/matter_idl/generators/types.py

+3
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def is_struct(self) -> bool:
199199
"endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False),
200200
"epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False),
201201
"epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False),
202+
"elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False),
202203
"event_id": BasicInteger(idl_name="event_id", byte_count=4, is_signed=False),
203204
"event_no": BasicInteger(idl_name="event_no", byte_count=8, is_signed=False),
204205
"fabric_id": BasicInteger(idl_name="fabric_id", byte_count=8, is_signed=False),
@@ -208,8 +209,10 @@ def is_struct(self) -> bool:
208209
"node_id": BasicInteger(idl_name="node_id", byte_count=8, is_signed=False),
209210
"percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False),
210211
"percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False),
212+
"posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False),
211213
"status": BasicInteger(idl_name="status", byte_count=2, is_signed=False),
212214
"systime_us": BasicInteger(idl_name="systime_us", byte_count=8, is_signed=False),
215+
"systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False),
213216
"tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False),
214217
"trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False),
215218
"vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False),

src/app/util/ember-compatibility-functions.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type)
103103
case ZCL_DATA_VER_ATTRIBUTE_TYPE: // Data Version
104104
case ZCL_BITMAP32_ATTRIBUTE_TYPE: // 32-bit bitmap
105105
case ZCL_EPOCH_S_ATTRIBUTE_TYPE: // Epoch Seconds
106+
case ZCL_ELAPSED_S_ATTRIBUTE_TYPE: // Elapsed Seconds
106107
static_assert(std::is_same<chip::ClusterId, uint32_t>::value,
107108
"chip::Cluster is expected to be uint32_t, change this when necessary");
108109
static_assert(std::is_same<chip::AttributeId, uint32_t>::value,
@@ -121,11 +122,14 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type)
121122
"chip::DataVersion is expected to be uint32_t, change this when necessary");
122123
return ZCL_INT32U_ATTRIBUTE_TYPE;
123124

124-
case ZCL_EVENT_NO_ATTRIBUTE_TYPE: // Event Number
125-
case ZCL_FABRIC_ID_ATTRIBUTE_TYPE: // Fabric Id
126-
case ZCL_NODE_ID_ATTRIBUTE_TYPE: // Node Id
127-
case ZCL_BITMAP64_ATTRIBUTE_TYPE: // 64-bit bitmap
128-
case ZCL_EPOCH_US_ATTRIBUTE_TYPE: // Epoch Microseconds
125+
case ZCL_EVENT_NO_ATTRIBUTE_TYPE: // Event Number
126+
case ZCL_FABRIC_ID_ATTRIBUTE_TYPE: // Fabric Id
127+
case ZCL_NODE_ID_ATTRIBUTE_TYPE: // Node Id
128+
case ZCL_BITMAP64_ATTRIBUTE_TYPE: // 64-bit bitmap
129+
case ZCL_EPOCH_US_ATTRIBUTE_TYPE: // Epoch Microseconds
130+
case ZCL_POSIX_MS_ATTRIBUTE_TYPE: // POSIX Milliseconds
131+
case ZCL_SYSTIME_MS_ATTRIBUTE_TYPE: // System time Milliseconds
132+
case ZCL_SYSTIME_US_ATTRIBUTE_TYPE: // System time Microseconds
129133
static_assert(std::is_same<chip::EventNumber, uint64_t>::value,
130134
"chip::EventNumber is expected to be uint64_t, change this when necessary");
131135
static_assert(std::is_same<chip::FabricId, uint64_t>::value,

src/app/zap-templates/common/override.js

+3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ function atomicType(arg)
7676
return 'chip::Percent100ths';
7777
case 'epoch_us':
7878
case 'systime_us':
79+
case 'posix_ms':
80+
case 'systime_ms':
7981
return 'uint64_t';
8082
case 'epoch_s':
8183
case 'utc':
84+
case 'elapsed_s':
8285
return 'uint32_t';
8386
default:
8487
throw 'not overriding';

src/app/zap-templates/zcl/data-model/chip/chip-types.xml

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ limitations under the License.
1616
-->
1717
<configurator>
1818
<atomic>
19+
<!--
20+
The IDs here do not match the spec, but:
21+
(1) They don't really have to (thought it would be nice)
22+
(2) The spec is broken and has the same id for different types (so we
23+
can't match it even if we wanted to).
24+
-->
1925
<type id="0x00" description="No data" name="no_data" size="0" />
2026
<!-- Base Data Types -->
2127
<type id="0x10" description="Boolean" name="boolean" size="1" discrete="true" />
@@ -55,7 +61,10 @@ limitations under the License.
5561
<type id="0xE1" description="Date" name="date" size="4" analog="true" />
5662
<type id="0xE3" description="Epoch Microseconds" name="epoch_us" size="8" analog="true" />
5763
<type id="0xE4" description="Epoch Seconds" name="epoch_s" size="4" analog="true" />
64+
<type id="0xD0" description="Posix Time Milliseconds" name="posix_ms" size="8" analog="true" />
5865
<type id="0xE5" description="System Time Microseconds" name="systime_us" size="8" analog="true" />
66+
<type id="0xD1" description="System Time Milliseconds" name="systime_ms" size="8" analog="true" />
67+
<type id="0xD2" description="Elapsed Time Seconds" name="elapsed_s" size="4" analog="true" />
5968
<type id="0xE6" description="Percentage units 1%" name="percent" size="1" analog="true" />
6069
<type id="0xE7" description="Percentage units 0.01%" name="percent100ths" size="2" analog="true" />
6170
<type id="0xE8" description="Cluster ID" name="cluster_id" size="4" discrete="true" />

zzz_generated/app-common/app-common/zap-generated/attribute-size.h

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/app-common/app-common/zap-generated/attribute-type.h

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)