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

Add new time types that got addded to the spec. #26547

Merged
merged 2 commits into from
May 16, 2023
Merged
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions scripts/py_matter_idl/matter_idl/generators/types.py
Original file line number Diff line number Diff line change
@@ -199,6 +199,7 @@ def is_struct(self) -> bool:
"endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False),
"epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False),
"epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False),
"elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False),
"event_id": BasicInteger(idl_name="event_id", byte_count=4, is_signed=False),
"event_no": BasicInteger(idl_name="event_no", byte_count=8, is_signed=False),
"fabric_id": BasicInteger(idl_name="fabric_id", byte_count=8, is_signed=False),
@@ -208,8 +209,10 @@ def is_struct(self) -> bool:
"node_id": BasicInteger(idl_name="node_id", byte_count=8, is_signed=False),
"percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False),
"percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False),
"posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False),
"status": BasicInteger(idl_name="status", byte_count=2, is_signed=False),
"systime_us": BasicInteger(idl_name="systime_us", byte_count=8, is_signed=False),
"systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False),
"tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False),
"trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False),
"vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False),
14 changes: 9 additions & 5 deletions src/app/util/ember-compatibility-functions.cpp
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type)
case ZCL_DATA_VER_ATTRIBUTE_TYPE: // Data Version
case ZCL_BITMAP32_ATTRIBUTE_TYPE: // 32-bit bitmap
case ZCL_EPOCH_S_ATTRIBUTE_TYPE: // Epoch Seconds
case ZCL_ELAPSED_S_ATTRIBUTE_TYPE: // Elapsed Seconds
static_assert(std::is_same<chip::ClusterId, uint32_t>::value,
"chip::Cluster is expected to be uint32_t, change this when necessary");
static_assert(std::is_same<chip::AttributeId, uint32_t>::value,
@@ -121,11 +122,14 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type)
"chip::DataVersion is expected to be uint32_t, change this when necessary");
return ZCL_INT32U_ATTRIBUTE_TYPE;

case ZCL_EVENT_NO_ATTRIBUTE_TYPE: // Event Number
case ZCL_FABRIC_ID_ATTRIBUTE_TYPE: // Fabric Id
case ZCL_NODE_ID_ATTRIBUTE_TYPE: // Node Id
case ZCL_BITMAP64_ATTRIBUTE_TYPE: // 64-bit bitmap
case ZCL_EPOCH_US_ATTRIBUTE_TYPE: // Epoch Microseconds
case ZCL_EVENT_NO_ATTRIBUTE_TYPE: // Event Number
case ZCL_FABRIC_ID_ATTRIBUTE_TYPE: // Fabric Id
case ZCL_NODE_ID_ATTRIBUTE_TYPE: // Node Id
case ZCL_BITMAP64_ATTRIBUTE_TYPE: // 64-bit bitmap
case ZCL_EPOCH_US_ATTRIBUTE_TYPE: // Epoch Microseconds
case ZCL_POSIX_MS_ATTRIBUTE_TYPE: // POSIX Milliseconds
case ZCL_SYSTIME_MS_ATTRIBUTE_TYPE: // System time Milliseconds
case ZCL_SYSTIME_US_ATTRIBUTE_TYPE: // System time Microseconds
static_assert(std::is_same<chip::EventNumber, uint64_t>::value,
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
"chip::EventNumber is expected to be uint64_t, change this when necessary");
static_assert(std::is_same<chip::FabricId, uint64_t>::value,
3 changes: 3 additions & 0 deletions src/app/zap-templates/common/override.js
Original file line number Diff line number Diff line change
@@ -76,9 +76,12 @@ function atomicType(arg)
return 'chip::Percent100ths';
case 'epoch_us':
case 'systime_us':
case 'posix_ms':
case 'systime_ms':
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
return 'uint64_t';
case 'epoch_s':
case 'utc':
case 'elapsed_s':
return 'uint32_t';
default:
throw 'not overriding';
9 changes: 9 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/chip-types.xml
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@ limitations under the License.
-->
<configurator>
<atomic>
<!--
The IDs here do not match the spec, but:
(1) They don't really have to (thought it would be nice)
(2) The spec is broken and has the same id for different types (so we
can't match it even if we wanted to).
-->
<type id="0x00" description="No data" name="no_data" size="0" />
<!-- Base Data Types -->
<type id="0x10" description="Boolean" name="boolean" size="1" discrete="true" />
@@ -55,7 +61,10 @@ limitations under the License.
<type id="0xE1" description="Date" name="date" size="4" analog="true" />
<type id="0xE3" description="Epoch Microseconds" name="epoch_us" size="8" analog="true" />
<type id="0xE4" description="Epoch Seconds" name="epoch_s" size="4" analog="true" />
<type id="0xD0" description="Posix Time Milliseconds" name="posix_ms" size="8" analog="true" />
<type id="0xE5" description="System Time Microseconds" name="systime_us" size="8" analog="true" />
<type id="0xD1" description="System Time Milliseconds" name="systime_ms" size="8" analog="true" />
<type id="0xD2" description="Elapsed Time Seconds" name="elapsed_s" size="4" analog="true" />
<type id="0xE6" description="Percentage units 1%" name="percent" size="1" analog="true" />
<type id="0xE7" description="Percentage units 0.01%" name="percent100ths" size="2" analog="true" />
<type id="0xE8" description="Cluster ID" name="cluster_id" size="4" discrete="true" />

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.