diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 8f65768e7118e3..26c9d6acd3cfee 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -1637,10 +1637,10 @@ limitations under the License. CLIENT_LIST PARTS_LIST - + BINDING - + SCENE_COUNT CURRENT_SCENE CURRENT_GROUP @@ -1660,7 +1660,7 @@ limitations under the License. GetSceneMembership GetSceneMembershipResponse - + GROUP_NAME_SUPPORT AddGroup AddGroupResponse @@ -1674,11 +1674,12 @@ limitations under the License. AddGroupIfIdentifying + - - - - + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml index c5ce83f9049804..5f997a98f68002 100644 --- a/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml @@ -17,6 +17,49 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + General @@ -28,8 +71,39 @@ limitations under the License. Accurate time is required for a number of reasons, including scheduling, display and validating security materials. + UTCTime + Granularity + TimeSource + + TrustedTimeNodeId + + + + + DefaultNtp + + + + + TimeZone + + + + + DstOffset + + + + LocalTime + TimeZoneDatabase + NtpServerPort - + + Upon receipt of this command, the server MAY update its UTCTime Attribute to match the time specified in the command + + + + diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 9a13bd93cad370..b13159384185e8 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -9955,6 +9955,16 @@ class TimeSynchronization(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ + ClusterObjectFieldDescriptor(Label="UTCTime", Tag=0x00000000, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="granularity", Tag=0x00000001, Type=TimeSynchronization.Enums.GranularityEnum), + ClusterObjectFieldDescriptor(Label="timeSource", Tag=0x00000002, Type=typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]), + ClusterObjectFieldDescriptor(Label="trustedTimeNodeId", Tag=0x00000003, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="defaultNtp", Tag=0x00000004, Type=typing.Union[None, Nullable, str]), + ClusterObjectFieldDescriptor(Label="timeZone", Tag=0x00000005, Type=typing.Optional[typing.List[TimeSynchronization.Structs.TimeZoneType]]), + ClusterObjectFieldDescriptor(Label="dstOffset", Tag=0x00000006, Type=typing.Optional[typing.List[TimeSynchronization.Structs.DstOffsetType]]), + ClusterObjectFieldDescriptor(Label="localTime", Tag=0x00000007, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="timeZoneDatabase", Tag=0x00000008, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="ntpServerPort", Tag=0x00000009, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), @@ -9962,16 +9972,265 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), ]) + UTCTime: 'typing.Union[Nullable, uint]' = None + granularity: 'TimeSynchronization.Enums.GranularityEnum' = None + timeSource: 'typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]' = None + trustedTimeNodeId: 'typing.Union[Nullable, uint]' = None + defaultNtp: 'typing.Union[None, Nullable, str]' = None + timeZone: 'typing.Optional[typing.List[TimeSynchronization.Structs.TimeZoneType]]' = None + dstOffset: 'typing.Optional[typing.List[TimeSynchronization.Structs.DstOffsetType]]' = None + localTime: 'typing.Union[None, Nullable, uint]' = None + timeZoneDatabase: 'typing.Optional[bool]' = None + ntpServerPort: 'typing.Union[None, Nullable, uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None attributeList: 'typing.List[uint]' = None featureMap: 'uint' = None clusterRevision: 'uint' = None + class Enums: + class GranularityEnum(IntEnum): + kNoTimeGranularity = 0x00 + kMinutesGranularity = 0x01 + kSecondsGranularity = 0x02 + kMillisecondsGranularity = 0x03 + kMicrosecondsGranularity = 0x04 + + class TimeSourceEnum(IntEnum): + kNone = 0x00 + kUnknown = 0x01 + kAdmin = 0x02 + kNodeTimeCluster = 0x03 + kNonFabricSntp = 0x04 + kNonFabricNtp = 0x05 + kFabricSntp = 0x06 + kFabricNtp = 0x07 + kMixedNtp = 0x08 + kNonFabricSntpNts = 0x09 + kNonFabricNtpNts = 0x0A + kFabricSntpNts = 0x0B + kFabricNtpNts = 0x0C + kMixedNtpNts = 0x0D + kCloudSource = 0x0E + kPtp = 0x0F + kGnss = 0x10 + + + class Structs: + @dataclass + class DstOffsetType(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="offset", Tag=0, Type=int), + ClusterObjectFieldDescriptor(Label="validStarting", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="validUntil", Tag=2, Type=uint), + ]) + + offset: 'int' = 0 + validStarting: 'uint' = 0 + validUntil: 'uint' = 0 + + @dataclass + class TimeZoneType(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="offset", Tag=0, Type=int), + ClusterObjectFieldDescriptor(Label="validAt", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="name", Tag=2, Type=typing.Optional[str]), + ]) + + offset: 'int' = 0 + validAt: 'uint' = 0 + name: 'typing.Optional[str]' = None + class Commands: + @dataclass + class SetUtcTime(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0038 + command_id: typing.ClassVar[int] = 0x0000 + is_client: typing.ClassVar[bool] = True + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="utcTime", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="granularity", Tag=1, Type=TimeSynchronization.Enums.GranularityEnum), + ClusterObjectFieldDescriptor(Label="timeSource", Tag=2, Type=typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]), + ]) + + utcTime: 'uint' = 0 + granularity: 'TimeSynchronization.Enums.GranularityEnum' = 0 + timeSource: 'typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]' = None + + class Attributes: + @dataclass + class UTCTime(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class Granularity(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=TimeSynchronization.Enums.GranularityEnum) + + value: 'TimeSynchronization.Enums.GranularityEnum' = 0 + + @dataclass + class TimeSource(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]) + + value: 'typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]' = None + + @dataclass + class TrustedTimeNodeId(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class DefaultNtp(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, str]) + + value: 'typing.Union[None, Nullable, str]' = None + + @dataclass + class TimeZone(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[TimeSynchronization.Structs.TimeZoneType]]) + + value: 'typing.Optional[typing.List[TimeSynchronization.Structs.TimeZoneType]]' = None + + @dataclass + class DstOffset(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[TimeSynchronization.Structs.DstOffsetType]]) + + value: 'typing.Optional[typing.List[TimeSynchronization.Structs.DstOffsetType]]' = None + + @dataclass + class LocalTime(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000007 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: 'typing.Union[None, Nullable, uint]' = None + + @dataclass + class TimeZoneDatabase(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) + + value: 'typing.Optional[bool]' = None + + @dataclass + class NtpServerPort(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000009 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: 'typing.Union[None, Nullable, uint]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 0c017a184b92f8..fcd359ef6e62ad 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -22465,6 +22465,34 @@ typedef NS_ENUM(uint8_t, MTREthernetNetworkDiagnosticsPHYRateType) { MTREthernetNetworkDiagnosticsPHYRateType400G = 0x09, }; +typedef NS_ENUM(uint8_t, MTRTimeSynchronizationGranularity) { + MTRTimeSynchronizationGranularityNoTimeGranularity = 0x00, + MTRTimeSynchronizationGranularityMinutesGranularity = 0x01, + MTRTimeSynchronizationGranularitySecondsGranularity = 0x02, + MTRTimeSynchronizationGranularityMillisecondsGranularity = 0x03, + MTRTimeSynchronizationGranularityMicrosecondsGranularity = 0x04, +}; + +typedef NS_ENUM(uint8_t, MTRTimeSynchronizationTimeSource) { + MTRTimeSynchronizationTimeSourceNone = 0x00, + MTRTimeSynchronizationTimeSourceUnknown = 0x01, + MTRTimeSynchronizationTimeSourceAdmin = 0x02, + MTRTimeSynchronizationTimeSourceNodeTimeCluster = 0x03, + MTRTimeSynchronizationTimeSourceNonFabricSntp = 0x04, + MTRTimeSynchronizationTimeSourceNonFabricNtp = 0x05, + MTRTimeSynchronizationTimeSourceFabricSntp = 0x06, + MTRTimeSynchronizationTimeSourceFabricNtp = 0x07, + MTRTimeSynchronizationTimeSourceMixedNtp = 0x08, + MTRTimeSynchronizationTimeSourceNonFabricSntpNts = 0x09, + MTRTimeSynchronizationTimeSourceNonFabricNtpNts = 0x0A, + MTRTimeSynchronizationTimeSourceFabricSntpNts = 0x0B, + MTRTimeSynchronizationTimeSourceFabricNtpNts = 0x0C, + MTRTimeSynchronizationTimeSourceMixedNtpNts = 0x0D, + MTRTimeSynchronizationTimeSourceCloudSource = 0x0E, + MTRTimeSynchronizationTimeSourcePtp = 0x0F, + MTRTimeSynchronizationTimeSourceGnss = 0x10, +}; + typedef NS_ENUM(uint8_t, MTRAdministratorCommissioningCommissioningWindowStatus) { MTRAdministratorCommissioningCommissioningWindowStatusWindowNotOpen = 0x00, MTRAdministratorCommissioningCommissioningWindowStatusEnhancedWindowOpen = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm index 46579243420093..4c82f32c8365f6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm @@ -16181,6 +16181,112 @@ } } +void MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::TimeSynchronization::GranularityEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( + void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::TimeSynchronization::TimeSourceEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( + void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge::OnSuccessFn( void * context, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h index 2b4c03392ec8eb..36ef0831588eb6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge_internal.h @@ -327,6 +327,14 @@ typedef void (*EthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallback)( void *, chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType); typedef void (*NullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallback)( void *, const chip::app::DataModel::Nullable &); +typedef void (*TimeSynchronizationClusterGranularityEnumAttributeCallback)( + void *, chip::app::Clusters::TimeSynchronization::GranularityEnum); +typedef void (*NullableTimeSynchronizationClusterGranularityEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*TimeSynchronizationClusterTimeSourceEnumAttributeCallback)(void *, + chip::app::Clusters::TimeSynchronization::TimeSourceEnum); +typedef void (*NullableTimeSynchronizationClusterTimeSourceEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); typedef void (*AdministratorCommissioningClusterCommissioningWindowStatusAttributeCallback)( void *, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus); typedef void (*NullableAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallback)( @@ -21653,6 +21661,206 @@ class MTRNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackSu SubscriptionEstablishedHandler mEstablishedHandler; }; +class MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, + OnSuccessFn, keepAlive){}; + + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::TimeSynchronization::GranularityEnum value); +}; + +class MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge + : public MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge +{ +public: + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, chip::NodeId nodeID, MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, SubscriptionEstablishedHandler establishedHandler) : + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, + action, OnSuccessFn, keepAlive){}; + + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge + : public MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge +{ +public: + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, chip::NodeId nodeID, MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, SubscriptionEstablishedHandler establishedHandler) : + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(queue, nodeID, controller, handler, action, + true), + mEstablishedHandler(establishedHandler) + {} + + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRNullableTimeSynchronizationClusterGranularityEnumAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, action, + OnSuccessFn, keepAlive){}; + + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::TimeSynchronization::TimeSourceEnum value); +}; + +class MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge + : public MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge +{ +public: + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, chip::NodeId nodeID, MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, SubscriptionEstablishedHandler establishedHandler) : + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(queue, nodeID, controller, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRLocalActionBlock action, bool keepAlive = false) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(dispatch_queue_t queue, chip::NodeId nodeID, + MTRDeviceController * controller, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, nodeID, controller, handler, + action, OnSuccessFn, keepAlive){}; + + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, + ResponseHandler handler, MTRActionBlock action, + bool keepAlive = false) : + MTRCallbackBridge(queue, device, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge + : public MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge +{ +public: + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, chip::NodeId nodeID, MTRDeviceController * controller, ResponseHandler handler, + MTRActionBlock action, SubscriptionEstablishedHandler establishedHandler) : + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(queue, nodeID, controller, handler, action, + true), + mEstablishedHandler(establishedHandler) + {} + + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + MTRNullableTimeSynchronizationClusterTimeSourceEnumAttributeCallbackBridge(queue, device, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class MTRAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge : public MTRCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 858b48d69e85d4..e7ee53846f750a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -527,6 +527,16 @@ typedef NS_ENUM(uint32_t, MTRClusterAttributeIDType) { MTRClusterEthernetNetworkDiagnosticsAttributeClusterRevisionID = MTRClusterGlobalAttributeClusterRevisionID, // Cluster TimeSynchronization attributes + MTRClusterTimeSynchronizationAttributeUTCTimeID = 0x00000000, + MTRClusterTimeSynchronizationAttributeGranularityID = 0x00000001, + MTRClusterTimeSynchronizationAttributeTimeSourceID = 0x00000002, + MTRClusterTimeSynchronizationAttributeTrustedTimeNodeIdID = 0x00000003, + MTRClusterTimeSynchronizationAttributeDefaultNtpID = 0x00000004, + MTRClusterTimeSynchronizationAttributeTimeZoneID = 0x00000005, + MTRClusterTimeSynchronizationAttributeDstOffsetID = 0x00000006, + MTRClusterTimeSynchronizationAttributeLocalTimeID = 0x00000007, + MTRClusterTimeSynchronizationAttributeTimeZoneDatabaseID = 0x00000008, + MTRClusterTimeSynchronizationAttributeNtpServerPortID = 0x00000009, MTRClusterTimeSynchronizationAttributeGeneratedCommandListID = MTRClusterGlobalAttributeGeneratedCommandListID, MTRClusterTimeSynchronizationAttributeAcceptedCommandListID = MTRClusterGlobalAttributeAcceptedCommandListID, MTRClusterTimeSynchronizationAttributeAttributeListID = MTRClusterGlobalAttributeAttributeListID, @@ -1482,6 +1492,9 @@ typedef NS_ENUM(uint32_t, MTRClusterCommandIDType) { // Cluster EthernetNetworkDiagnostics commands MTRClusterEthernetNetworkDiagnosticsCommandResetCountsID = 0x00000000, + // Cluster TimeSynchronization commands + MTRClusterTimeSynchronizationCommandSetUtcTimeID = 0x00000000, + // Cluster AdministratorCommissioning commands MTRClusterAdministratorCommissioningCommandOpenCommissioningWindowID = 0x00000000, MTRClusterAdministratorCommissioningCommandOpenBasicCommissioningWindowID = 0x00000001, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index f4aa3641d0ad77..d3043ec6452991 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -2191,6 +2191,32 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; +- (instancetype)init; +- (id)copyWithZone:(nullable NSZone *)zone; +@end +@interface MTRTimeSynchronizationClusterSetUtcTimeParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull utcTime; + +@property (nonatomic, copy) NSNumber * _Nonnull granularity; + +@property (nonatomic, copy) NSNumber * _Nullable timeSource; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + - (instancetype)init; - (id)copyWithZone:(nullable NSZone *)zone; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index a48ecc364b3209..6a7c94a88aa7a4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -2942,6 +2942,41 @@ - (NSString *)description return descriptionString; } +@end +@implementation MTRTimeSynchronizationClusterSetUtcTimeParams +- (instancetype)init +{ + if (self = [super init]) { + + _utcTime = @(0); + + _granularity = @(0); + + _timeSource = nil; + _timedInvokeTimeoutMs = nil; + } + return self; +} + +- (id)copyWithZone:(nullable NSZone *)zone; +{ + auto other = [[MTRTimeSynchronizationClusterSetUtcTimeParams alloc] init]; + + other.utcTime = self.utcTime; + other.granularity = self.granularity; + other.timeSource = self.timeSource; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: utcTime:%@; granularity:%@; timeSource:%@; >", + NSStringFromClass([self class]), _utcTime, _granularity, _timeSource]; + return descriptionString; +} + @end @implementation MTRAdministratorCommissioningClusterOpenCommissioningWindowParams - (instancetype)init diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 6cf016c2fa6507..7351fed1616c57 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -449,6 +449,24 @@ NS_ASSUME_NONNULL_BEGIN - (id)copyWithZone:(nullable NSZone *)zone; @end +@interface MTRTimeSynchronizationClusterDstOffsetType : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull offset; +@property (nonatomic, copy) NSNumber * _Nonnull validStarting; +@property (nonatomic, copy) NSNumber * _Nonnull validUntil; + +- (instancetype)init; +- (id)copyWithZone:(nullable NSZone *)zone; +@end + +@interface MTRTimeSynchronizationClusterTimeZoneType : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull offset; +@property (nonatomic, copy) NSNumber * _Nonnull validAt; +@property (nonatomic, copy) NSString * _Nullable name; + +- (instancetype)init; +- (id)copyWithZone:(nullable NSZone *)zone; +@end + @interface MTRBridgedDeviceBasicClusterStartUpEvent : NSObject @property (nonatomic, copy) NSNumber * _Nonnull softwareVersion; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 4ed92c2d3c4931..9496ac336661de 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -1648,6 +1648,74 @@ - (NSString *)description @end +@implementation MTRTimeSynchronizationClusterDstOffsetType +- (instancetype)init +{ + if (self = [super init]) { + + _offset = @(0); + + _validStarting = @(0); + + _validUntil = @(0); + } + return self; +} + +- (id)copyWithZone:(nullable NSZone *)zone +{ + auto other = [[MTRTimeSynchronizationClusterDstOffsetType alloc] init]; + + other.offset = self.offset; + other.validStarting = self.validStarting; + other.validUntil = self.validUntil; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: offset:%@; validStarting:%@; validUntil:%@; >", + NSStringFromClass([self class]), _offset, _validStarting, _validUntil]; + return descriptionString; +} + +@end + +@implementation MTRTimeSynchronizationClusterTimeZoneType +- (instancetype)init +{ + if (self = [super init]) { + + _offset = @(0); + + _validAt = @(0); + + _name = nil; + } + return self; +} + +- (id)copyWithZone:(nullable NSZone *)zone +{ + auto other = [[MTRTimeSynchronizationClusterTimeZoneType alloc] init]; + + other.offset = self.offset; + other.validAt = self.validAt; + other.name = self.name; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString + stringWithFormat:@"<%@: offset:%@; validAt:%@; name:%@; >", NSStringFromClass([self class]), _offset, _validAt, _name]; + return descriptionString; +} + +@end + @implementation MTRBridgedDeviceBasicClusterStartUpEvent - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.h b/zzz_generated/app-common/app-common/zap-generated/af-structs.h index 93a09ffe05e0ac..c2ef3f9b0e97cd 100644 --- a/zzz_generated/app-common/app-common/zap-generated/af-structs.h +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.h @@ -278,6 +278,14 @@ typedef struct _DlCredential uint16_t CredentialIndex; } DlCredential; +// Struct for DstOffsetType +typedef struct _DstOffsetType +{ + int32_t Offset; + uint64_t ValidStarting; + uint64_t ValidUntil; +} DstOffsetType; + // Struct for EndpointListStruct typedef struct _EndpointListStruct { @@ -548,6 +556,14 @@ typedef struct _ThreadMetrics uint32_t StackSize; } ThreadMetrics; +// Struct for TimeZoneType +typedef struct _TimeZoneType +{ + int32_t Offset; + uint64_t ValidAt; + chip::CharSpan Name; +} TimeZoneType; + // Struct for WiFiInterfaceScanResult typedef struct _WiFiInterfaceScanResult { diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index d8054f97b1ca4d..aa7fbc1afd08ab 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -427,6 +427,16 @@ // Client attributes // Server attributes +#define ZCL_UTC_TIME_ATTRIBUTE_ID (0x0000) +#define ZCL_GRANULARITY_ATTRIBUTE_ID (0x0001) +#define ZCL_TIME_SOURCE_ATTRIBUTE_ID (0x0002) +#define ZCL_TRUSTED_TIME_NODE_ID_ATTRIBUTE_ID (0x0003) +#define ZCL_DEFAULT_NTP_ATTRIBUTE_ID (0x0004) +#define ZCL_TIME_ZONE_ATTRIBUTE_ID (0x0005) +#define ZCL_DST_OFFSET_ATTRIBUTE_ID (0x0006) +#define ZCL_LOCAL_TIME_ATTRIBUTE_ID (0x0007) +#define ZCL_TIME_ZONE_DATABASE_ATTRIBUTE_ID (0x0008) +#define ZCL_NTP_SERVER_PORT_ATTRIBUTE_ID (0x0009) // Attribute ids for cluster: Bridged Device Basic diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index fe3e77ae17c2bc..9fa1281d38db4f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -9151,6 +9151,360 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace TimeSynchronization { namespace Attributes { +namespace UTCTime { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace UTCTime + +namespace Granularity { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace Granularity + +namespace TimeSource { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace TimeSource + +namespace TrustedTimeNodeId { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::NodeId value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_NODE_ID_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_NODE_ID_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace TrustedTimeNodeId + +namespace DefaultNtp { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + uint8_t zclString[128 + 1]; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + value.SetNull(); + return EMBER_ZCL_STATUS_SUCCESS; + } + auto & span = value.SetNonNull(); + + VerifyOrReturnError(span.size() == 128, EMBER_ZCL_STATUS_INVALID_DATA_TYPE); + memcpy(span.data(), &zclString[1], 128); + span.reduce_size(length); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + static_assert(128 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 128, EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + uint8_t zclString[128 + 1]; + emberAfCopyInt8u(zclString, 0, static_cast(value.size())); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + uint8_t zclString[1] = { 0xFF }; + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace DefaultNtp + +namespace LocalTime { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace LocalTime + +namespace TimeZoneDatabase { + +EmberAfStatus Get(chip::EndpointId endpoint, bool * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, bool value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +} // namespace TimeZoneDatabase + +namespace NtpServerPort { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NtpServerPort + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index bcf76c04bf562a..239360ac366b9a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -1583,6 +1583,56 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace TimeSynchronization { namespace Attributes { +namespace UTCTime { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_us +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace UTCTime + +namespace Granularity { +EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum * value); // GranularityEnum +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum value); +} // namespace Granularity + +namespace TimeSource { +EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum * value); // TimeSourceEnum +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum value); +} // namespace TimeSource + +namespace TrustedTimeNodeId { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // node_id +EmberAfStatus Set(chip::EndpointId endpoint, chip::NodeId value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace TrustedTimeNodeId + +namespace DefaultNtp { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // char_string +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace DefaultNtp + +namespace LocalTime { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_us +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace LocalTime + +namespace TimeZoneDatabase { +EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean +EmberAfStatus Set(chip::EndpointId endpoint, bool value); +} // namespace TimeZoneDatabase + +namespace NtpServerPort { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace NtpServerPort + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index cfefbae274133f..02c2a59c511de5 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -7870,6 +7870,12 @@ bool emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback( bool emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::DecodableType & commandData); +/** + * @brief Time Synchronization Cluster SetUtcTime Command callback (from client) + */ +bool emberAfTimeSynchronizationClusterSetUtcTimeCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::TimeSynchronization::Commands::SetUtcTime::DecodableType & commandData); /** * @brief AdministratorCommissioning Cluster OpenCommissioningWindow Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index aad00776c2b222..64d9c1da0ff753 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -973,6 +973,49 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(EthernetNetworkDiagnost } } +static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::GranularityEnum val) +{ + using EnumType = TimeSynchronization::GranularityEnum; + switch (val) + { + case EnumType::kNoTimeGranularity: + case EnumType::kMinutesGranularity: + case EnumType::kSecondsGranularity: + case EnumType::kMillisecondsGranularity: + case EnumType::kMicrosecondsGranularity: + return val; + default: + return static_cast(5); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::TimeSourceEnum val) +{ + using EnumType = TimeSynchronization::TimeSourceEnum; + switch (val) + { + case EnumType::kNone: + case EnumType::kUnknown: + case EnumType::kAdmin: + case EnumType::kNodeTimeCluster: + case EnumType::kNonFabricSntp: + case EnumType::kNonFabricNtp: + case EnumType::kFabricSntp: + case EnumType::kFabricNtp: + case EnumType::kMixedNtp: + case EnumType::kNonFabricSntpNts: + case EnumType::kNonFabricNtpNts: + case EnumType::kFabricSntpNts: + case EnumType::kFabricNtpNts: + case EnumType::kMixedNtpNts: + case EnumType::kCloudSource: + case EnumType::kPtp: + case EnumType::kGnss: + return val; + default: + return static_cast(17); + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(AdministratorCommissioning::CommissioningWindowStatus val) { using EnumType = AdministratorCommissioning::CommissioningWindowStatus; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index fa7a51a92ee971..08e5853c7d3ead 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -893,6 +893,40 @@ static PHYRateType __attribute__((unused)) kPHYRateTypekUnknownEnumValue } // namespace EthernetNetworkDiagnostics namespace TimeSynchronization { + +// Enum for GranularityEnum +enum class GranularityEnum : uint8_t +{ + kNoTimeGranularity = 0x00, + kMinutesGranularity = 0x01, + kSecondsGranularity = 0x02, + kMillisecondsGranularity = 0x03, + kMicrosecondsGranularity = 0x04, + kUnknownEnumValue = 5, +}; + +// Enum for TimeSourceEnum +enum class TimeSourceEnum : uint8_t +{ + kNone = 0x00, + kUnknown = 0x01, + kAdmin = 0x02, + kNodeTimeCluster = 0x03, + kNonFabricSntp = 0x04, + kNonFabricNtp = 0x05, + kFabricSntp = 0x06, + kFabricNtp = 0x07, + kMixedNtp = 0x08, + kNonFabricSntpNts = 0x09, + kNonFabricNtpNts = 0x0A, + kFabricSntpNts = 0x0B, + kFabricNtpNts = 0x0C, + kMixedNtpNts = 0x0D, + kCloudSource = 0x0E, + kPtp = 0x0F, + kGnss = 0x10, + kUnknownEnumValue = 17, +}; } // namespace TimeSynchronization namespace BridgedDeviceBasic { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 00f5e64b716f5f..f3971342a281ad 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -7836,8 +7836,151 @@ namespace Events { } // namespace EthernetNetworkDiagnostics namespace TimeSynchronization { +namespace Structs { +namespace DstOffsetType { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kOffset)), offset)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kValidStarting)), validStarting)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kValidUntil)), validUntil)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + err = reader.EnterContainer(outer); + ReturnErrorOnFailure(err); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kOffset): + ReturnErrorOnFailure(DataModel::Decode(reader, offset)); + break; + case to_underlying(Fields::kValidStarting): + ReturnErrorOnFailure(DataModel::Decode(reader, validStarting)); + break; + case to_underlying(Fields::kValidUntil): + ReturnErrorOnFailure(DataModel::Decode(reader, validUntil)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + + return CHIP_NO_ERROR; +} + +} // namespace DstOffsetType +namespace TimeZoneType { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kOffset)), offset)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kValidAt)), validAt)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kName)), name)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + err = reader.EnterContainer(outer); + ReturnErrorOnFailure(err); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kOffset): + ReturnErrorOnFailure(DataModel::Decode(reader, offset)); + break; + case to_underlying(Fields::kValidAt): + ReturnErrorOnFailure(DataModel::Decode(reader, validAt)); + break; + case to_underlying(Fields::kName): + ReturnErrorOnFailure(DataModel::Decode(reader, name)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + + return CHIP_NO_ERROR; +} + +} // namespace TimeZoneType +} // namespace Structs namespace Commands { +namespace SetUtcTime { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kUtcTime)), utcTime)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGranularity)), granularity)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kTimeSource)), timeSource)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kUtcTime): + ReturnErrorOnFailure(DataModel::Decode(reader, utcTime)); + break; + case to_underlying(Fields::kGranularity): + ReturnErrorOnFailure(DataModel::Decode(reader, granularity)); + break; + case to_underlying(Fields::kTimeSource): + ReturnErrorOnFailure(DataModel::Decode(reader, timeSource)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace SetUtcTime. } // namespace Commands namespace Attributes { @@ -7845,6 +7988,36 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { switch (path.mAttributeId) { + case Attributes::UTCTime::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, UTCTime)); + break; + case Attributes::Granularity::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, granularity)); + break; + case Attributes::TimeSource::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, timeSource)); + break; + case Attributes::TrustedTimeNodeId::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, trustedTimeNodeId)); + break; + case Attributes::DefaultNtp::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, defaultNtp)); + break; + case Attributes::TimeZone::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, timeZone)); + break; + case Attributes::DstOffset::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, dstOffset)); + break; + case Attributes::LocalTime::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, localTime)); + break; + case Attributes::TimeZoneDatabase::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, timeZoneDatabase)); + break; + case Attributes::NtpServerPort::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, ntpServerPort)); + break; case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); break; @@ -20931,6 +21104,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::TimeSynchronization::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::AdministratorCommissioning::Id: { switch (aCommand) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index c35ba378c1822c..7aba9ed714c63e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -9908,9 +9908,237 @@ struct TypeInfo } // namespace Attributes } // namespace EthernetNetworkDiagnostics namespace TimeSynchronization { +namespace Structs { +namespace DstOffsetType { +enum class Fields +{ + kOffset = 0, + kValidStarting = 1, + kValidUntil = 2, +}; + +struct Type +{ +public: + int32_t offset = static_cast(0); + uint64_t validStarting = static_cast(0); + uint64_t validUntil = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +using DecodableType = Type; + +} // namespace DstOffsetType +namespace TimeZoneType { +enum class Fields +{ + kOffset = 0, + kValidAt = 1, + kName = 2, +}; + +struct Type +{ +public: + int32_t offset = static_cast(0); + uint64_t validAt = static_cast(0); + Optional name; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +using DecodableType = Type; + +} // namespace TimeZoneType +} // namespace Structs + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace SetUtcTime { +struct Type; +struct DecodableType; +} // namespace SetUtcTime + +} // namespace Commands + +namespace Commands { +namespace SetUtcTime { +enum class Fields +{ + kUtcTime = 0, + kGranularity = 1, + kTimeSource = 2, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::SetUtcTime::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + uint64_t utcTime = static_cast(0); + GranularityEnum granularity = static_cast(0); + Optional timeSource; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::SetUtcTime::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + uint64_t utcTime = static_cast(0); + GranularityEnum granularity = static_cast(0); + Optional timeSource; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace SetUtcTime +} // namespace Commands namespace Attributes { +namespace UTCTime { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::UTCTime::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace UTCTime +namespace Granularity { +struct TypeInfo +{ + using Type = chip::app::Clusters::TimeSynchronization::GranularityEnum; + using DecodableType = chip::app::Clusters::TimeSynchronization::GranularityEnum; + using DecodableArgType = chip::app::Clusters::TimeSynchronization::GranularityEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Granularity::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Granularity +namespace TimeSource { +struct TypeInfo +{ + using Type = chip::app::Clusters::TimeSynchronization::TimeSourceEnum; + using DecodableType = chip::app::Clusters::TimeSynchronization::TimeSourceEnum; + using DecodableArgType = chip::app::Clusters::TimeSynchronization::TimeSourceEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TimeSource::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TimeSource +namespace TrustedTimeNodeId { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TrustedTimeNodeId::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TrustedTimeNodeId +namespace DefaultNtp { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DefaultNtp::Id; } + static constexpr bool MustUseTimedWrite() { return false; } + static constexpr size_t MaxLength() { return 128; } +}; +} // namespace DefaultNtp +namespace TimeZone { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TimeZone::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TimeZone +namespace DstOffset { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DstOffset::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DstOffset +namespace LocalTime { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::LocalTime::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace LocalTime +namespace TimeZoneDatabase { +struct TypeInfo +{ + using Type = bool; + using DecodableType = bool; + using DecodableArgType = bool; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TimeZoneDatabase::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TimeZoneDatabase +namespace NtpServerPort { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NtpServerPort::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NtpServerPort namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -9950,6 +10178,18 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + Attributes::UTCTime::TypeInfo::DecodableType UTCTime; + Attributes::Granularity::TypeInfo::DecodableType granularity = + static_cast(0); + Attributes::TimeSource::TypeInfo::DecodableType timeSource = + static_cast(0); + Attributes::TrustedTimeNodeId::TypeInfo::DecodableType trustedTimeNodeId; + Attributes::DefaultNtp::TypeInfo::DecodableType defaultNtp; + Attributes::TimeZone::TypeInfo::DecodableType timeZone; + Attributes::DstOffset::TypeInfo::DecodableType dstOffset; + Attributes::LocalTime::TypeInfo::DecodableType localTime; + Attributes::TimeZoneDatabase::TypeInfo::DecodableType timeZoneDatabase = static_cast(0); + Attributes::NtpServerPort::TypeInfo::DecodableType ntpServerPort; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::AttributeList::TypeInfo::DecodableType attributeList; diff --git a/zzz_generated/app-common/app-common/zap-generated/command-id.h b/zzz_generated/app-common/app-common/zap-generated/command-id.h index ad1b44624cee7c..502843e55b69b8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/command-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/command-id.h @@ -153,6 +153,9 @@ // Commands for cluster: Ethernet Network Diagnostics #define ZCL_RESET_COUNTS_COMMAND_ID (0x00) +// Commands for cluster: Time Synchronization +#define ZCL_SET_UTC_TIME_COMMAND_ID (0x00) + // Commands for cluster: AdministratorCommissioning #define ZCL_OPEN_COMMISSIONING_WINDOW_COMMAND_ID (0x00) #define ZCL_OPEN_BASIC_COMMISSIONING_WINDOW_COMMAND_ID (0x01) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 02c182f3bf50a0..3c07637a654a29 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -1682,6 +1682,46 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; namespace TimeSynchronization { namespace Attributes { +namespace UTCTime { +static constexpr AttributeId Id = 0x00000000; +} // namespace UTCTime + +namespace Granularity { +static constexpr AttributeId Id = 0x00000001; +} // namespace Granularity + +namespace TimeSource { +static constexpr AttributeId Id = 0x00000002; +} // namespace TimeSource + +namespace TrustedTimeNodeId { +static constexpr AttributeId Id = 0x00000003; +} // namespace TrustedTimeNodeId + +namespace DefaultNtp { +static constexpr AttributeId Id = 0x00000004; +} // namespace DefaultNtp + +namespace TimeZone { +static constexpr AttributeId Id = 0x00000005; +} // namespace TimeZone + +namespace DstOffset { +static constexpr AttributeId Id = 0x00000006; +} // namespace DstOffset + +namespace LocalTime { +static constexpr AttributeId Id = 0x00000007; +} // namespace LocalTime + +namespace TimeZoneDatabase { +static constexpr AttributeId Id = 0x00000008; +} // namespace TimeZoneDatabase + +namespace NtpServerPort { +static constexpr AttributeId Id = 0x00000009; +} // namespace NtpServerPort + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 57d1a772ea1d89..b2575ebb67f9e2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -477,6 +477,16 @@ static constexpr CommandId Id = 0x00000000; } // namespace Commands } // namespace EthernetNetworkDiagnostics +namespace TimeSynchronization { +namespace Commands { + +namespace SetUtcTime { +static constexpr CommandId Id = 0x00000000; +} // namespace SetUtcTime + +} // namespace Commands +} // namespace TimeSynchronization + namespace AdministratorCommissioning { namespace Commands { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a460a482359f20..fc77b7c93e1fc8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -2908,8 +2908,19 @@ class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand | Cluster TimeSynchronization | 0x0038 | |------------------------------------------------------------------------------| | Commands: | | +| * SetUtcTime | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | +| * UTCTime | 0x0000 | +| * Granularity | 0x0001 | +| * TimeSource | 0x0002 | +| * TrustedTimeNodeId | 0x0003 | +| * DefaultNtp | 0x0004 | +| * TimeZone | 0x0005 | +| * DstOffset | 0x0006 | +| * LocalTime | 0x0007 | +| * TimeZoneDatabase | 0x0008 | +| * NtpServerPort | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -2919,6 +2930,38 @@ class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand | Events: | | \*----------------------------------------------------------------------------*/ +/* + * Command SetUtcTime + */ +class TimeSynchronizationSetUtcTime : public ClusterCommand +{ +public: + TimeSynchronizationSetUtcTime(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("set-utc-time", credsIssuerConfig) + { + AddArgument("UtcTime", 0, UINT64_MAX, &mRequest.utcTime); + AddArgument("Granularity", 0, UINT8_MAX, &mRequest.granularity); + AddArgument("TimeSource", 0, UINT8_MAX, &mRequest.timeSource); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000000) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0x00000038, 0x00000000, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000000) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00000038, 0x00000000, mRequest); + } + +private: + chip::app::Clusters::TimeSynchronization::Commands::SetUtcTime::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster BridgedDeviceBasic | 0x0039 | |------------------------------------------------------------------------------| @@ -9780,18 +9823,49 @@ void registerClusterTimeSynchronization(Commands & commands, CredentialIssuerCom // // Commands // - make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // - make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // - make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // - make_unique>(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "utctime", Attributes::UTCTime::Id, credsIssuerConfig), // + make_unique(Id, "granularity", Attributes::Granularity::Id, credsIssuerConfig), // + make_unique(Id, "time-source", Attributes::TimeSource::Id, credsIssuerConfig), // + make_unique(Id, "trusted-time-node-id", Attributes::TrustedTimeNodeId::Id, credsIssuerConfig), // + make_unique(Id, "default-ntp", Attributes::DefaultNtp::Id, credsIssuerConfig), // + make_unique(Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // + make_unique(Id, "dst-offset", Attributes::DstOffset::Id, credsIssuerConfig), // + make_unique(Id, "local-time", Attributes::LocalTime::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-database", Attributes::TimeZoneDatabase::Id, credsIssuerConfig), // + make_unique(Id, "ntp-server-port", Attributes::NtpServerPort::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "trusted-time-node-id", 0, UINT64_MAX, Attributes::TrustedTimeNodeId::Id, credsIssuerConfig), // + make_unique>>(Id, "default-ntp", Attributes::DefaultNtp::Id, + credsIssuerConfig), // + make_unique>>( + Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // + make_unique>>( + Id, "dst-offset", Attributes::DstOffset::Id, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // + make_unique(Id, "utctime", Attributes::UTCTime::Id, credsIssuerConfig), // + make_unique(Id, "granularity", Attributes::Granularity::Id, credsIssuerConfig), // + make_unique(Id, "time-source", Attributes::TimeSource::Id, credsIssuerConfig), // + make_unique(Id, "trusted-time-node-id", Attributes::TrustedTimeNodeId::Id, credsIssuerConfig), // + make_unique(Id, "default-ntp", Attributes::DefaultNtp::Id, credsIssuerConfig), // + make_unique(Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // + make_unique(Id, "dst-offset", Attributes::DstOffset::Id, credsIssuerConfig), // + make_unique(Id, "local-time", Attributes::LocalTime::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-database", Attributes::TimeZoneDatabase::Id, credsIssuerConfig), // + make_unique(Id, "ntp-server-port", Attributes::NtpServerPort::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index de1b57421ea07d..df9712528bc224 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -566,6 +566,37 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs:: { ComplexArgumentParser::Finalize(request.a); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DstOffsetType.offset", "offset", value.isMember("offset"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DstOffsetType.validStarting", "validStarting", value.isMember("validStarting"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DstOffsetType.validUntil", "validUntil", value.isMember("validUntil"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "offset"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.offset, value["offset"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "validStarting"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.validStarting, value["validStarting"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "validUntil"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.validUntil, value["validUntil"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::Type & request) +{ + ComplexArgumentParser::Finalize(request.offset); + ComplexArgumentParser::Finalize(request.validStarting); + ComplexArgumentParser::Finalize(request.validUntil); +} CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Actions::Structs::EndpointListStruct::Type & request, Json::Value & value) @@ -2109,6 +2140,37 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::SoftwareDiagnostics::S ComplexArgumentParser::Finalize(request.stackFreeMinimum); ComplexArgumentParser::Finalize(request.stackSize); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TimeSynchronization::Structs::TimeZoneType::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TimeZoneType.offset", "offset", value.isMember("offset"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TimeZoneType.validAt", "validAt", value.isMember("validAt"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "offset"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.offset, value["offset"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "validAt"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.validAt, value["validAt"])); + + if (value.isMember("name")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + } + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TimeSynchronization::Structs::TimeZoneType::Type & request) +{ + ComplexArgumentParser::Finalize(request.offset); + ComplexArgumentParser::Finalize(request.validAt); + ComplexArgumentParser::Finalize(request.name); +} CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 874f778f58992f..9a1049157f4d91 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -96,6 +96,10 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::St Json::Value & value); static void Finalize(chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Actions::Structs::EndpointListStruct::Type & request, Json::Value & value); @@ -241,6 +245,10 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::SoftwareDiagnos Json::Value & value); static void Finalize(chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TimeSynchronization::Structs::TimeZoneType::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TimeSynchronization::Structs::TimeZoneType::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 815f415a033baf..f2031dd1c3b7d6 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -561,6 +561,38 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Offset", indent + 1, value.offset); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Offset'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValidStarting", indent + 1, value.validStarting); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValidStarting'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValidUntil", indent + 1, value.validUntil); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValidUntil'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Actions::Structs::EndpointListStruct::DecodableType & value) { @@ -2263,6 +2295,38 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::TimeZoneType::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Offset", indent + 1, value.offset); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Offset'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValidAt", indent + 1, value.validAt); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValidAt'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Name", indent + 1, value.name); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Name'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::DecodableType & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 9b079c170522cc..8fd227ef675145 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -57,6 +57,8 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Structs::DlCredential::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::DstOffsetType::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Actions::Structs::EndpointListStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -131,6 +133,8 @@ LogValue(const char * label, size_t indent, const chip::app::Clusters::NetworkCommissioning::Structs::ThreadInterfaceScanResult::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::TimeZoneType::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::DecodableType & value);