From 6f89b9b50aaf4852fdcff3937078ad0a56c7f787 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Tue, 7 Dec 2021 14:26:21 -0800 Subject: [PATCH] Integrate IM event with server (#12641) * Port change from #12059 * Hook server with IM EventManagment and adjust EventManagment * run codegen --- .../all-clusters-common/all-clusters-app.zap | 16 + .../k32w/k32w0/include/CHIPProjectConfig.h | 7 - .../k32w/k32w0/include/CHIPProjectConfig.h | 7 - .../k32w/k32w0/include/CHIPProjectConfig.h | 6 +- src/app/EventLogging.h | 77 +++ src/app/EventManagement.cpp | 21 +- .../test-cluster-server.cpp | 24 +- src/app/server/Server.cpp | 33 ++ src/app/tests/TestEventLogging.cpp | 8 +- src/app/tests/TestReadInteraction.cpp | 8 +- src/app/tests/integration/MockEvents.cpp | 8 +- .../zcl/data-model/chip/test-cluster.xml | 17 + .../python/chip/clusters/Attribute.py | 32 +- .../python/chip/clusters/Objects.py | 475 ++++++++++++++---- .../templates/python-cluster-Objects-py.zapt | 9 +- .../test/test_scripts/cluster_objects.py | 44 +- .../zap-generated/CHIPCommandPayloadsObjc.h | 12 + .../zap-generated/CHIPCommandPayloadsObjc.mm | 26 + src/include/platform/CHIPDeviceConfig.h | 12 +- src/lib/core/CHIPConfig.h | 8 + src/platform/Ameba/CHIPDevicePlatformConfig.h | 5 - .../Darwin/CHIPDevicePlatformConfig.h | 5 - src/platform/EFR32/CHIPDevicePlatformConfig.h | 5 +- src/platform/Linux/CHIPDevicePlatformConfig.h | 5 - src/platform/Tizen/CHIPDevicePlatformConfig.h | 5 - .../android/CHIPDevicePlatformConfig.h | 5 - src/platform/cc13x2_26x2/CHIPPlatformConfig.h | 4 + src/platform/mbed/CHIPDevicePlatformConfig.h | 5 - .../nrfconnect/CHIPDevicePlatformConfig.h | 5 - .../nxp/k32w/k32w0/CHIPDevicePlatformConfig.h | 5 +- .../nxp/k32w/k32w0/CHIPPlatformConfig.h | 4 + src/platform/qpg/CHIPDevicePlatformConfig.h | 5 +- .../telink/CHIPDevicePlatformConfig.h | 5 - .../zap-generated/IMClusterCommandHandler.cpp | 9 + .../app-common/zap-generated/callback.h | 11 + .../zap-generated/cluster-objects.cpp | 76 +++ .../zap-generated/cluster-objects.h | 80 +++ .../app-common/zap-generated/command-id.h | 2 + .../app-common/zap-generated/ids/Commands.h | 8 + 39 files changed, 868 insertions(+), 231 deletions(-) create mode 100644 src/app/EventLogging.h diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 546d4289e4834c..bab478a413c638 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -15442,6 +15442,14 @@ "incoming": 1, "outgoing": 0 }, + { + "name": "TestEmitTestEventRequest", + "code": 20, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, { "name": "TestSimpleOptionalArgumentRequest", "code": 19, @@ -15524,6 +15532,14 @@ "source": "server", "incoming": 0, "outgoing": 1 + }, + { + "name": "TestEmitTestEventResponse", + "code": 10, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 } ], "attributes": [ diff --git a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index b1087741ca6958..b0056fd0f95d7b 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -132,13 +132,6 @@ */ #define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - /** * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT * diff --git a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 8da35444dca534..cdd81ca7412820 100644 --- a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -132,13 +132,6 @@ */ #define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - /** * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT * diff --git a/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 3308b4598a01d8..52a4e1ad0fab2e 100644 --- a/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -133,11 +133,11 @@ #define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 /** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE + * @def CHIP_CONFIG_ENABLE_SERVER_IM_EVENT * - * A size, in bytes, of the individual debug event logging buffer. + * @brief Enable Interaction model Event support in server */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) +#define CHIP_CONFIG_ENABLE_SERVER_IM_EVENT 0 /** * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT diff --git a/src/app/EventLogging.h b/src/app/EventLogging.h new file mode 100644 index 00000000000000..83ce5ebcabe32d --- /dev/null +++ b/src/app/EventLogging.h @@ -0,0 +1,77 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include +#include // So we can encode lists + +namespace chip { +namespace app { + +template +class EventLogger : public EventLoggingDelegate +{ +public: + EventLogger(const T & aEventData) : mEventData(aEventData){}; + CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) final override + { + return DataModel::Encode(aWriter, TLV::ContextTag(to_underlying(EventDataIB::Tag::kData)), mEventData); + } + +private: + const T & mEventData; +}; + +/** + * @brief + * Log an event via a EventLoggingDelegate, with options. + * + * The EventLoggingDelegate writes the event metadata and calls the `apDelegate` + * with an TLV::TLVWriter reference so that the user code can emit + * the event data directly into the event log. This form of event + * logging minimizes memory consumption, as event data is serialized + * directly into the target buffer. The event data MUST contain + * context tags to be interpreted within the schema identified by + * `ClusterID` and `EventId`. + * + * @param[in] apDelegate The EventLoggingDelegate to serialize the event data + * + * @param[in] aEventOptions The options for the event metadata. + * + * @param[out] aEventNumber The event Number if the event was written to the + * log, 0 otherwise. The Event number is expected to monotonically increase. + * + * @return CHIP_ERROR CHIP Error Code + */ +template +CHIP_ERROR LogEvent(const T & aEventData, EndpointId aEndpoint, EventOptions aEventOptions, EventNumber & aEventNumber) +{ + EventLogger eventData(aEventData); + ConcreteEventPath path(aEndpoint, aEventData.GetClusterId(), aEventData.GetEventId()); + EventManagement & logMgmt = chip::app::EventManagement::GetInstance(); + aEventOptions.mPath = path; + aEventOptions.mPriority = aEventData.GetPriorityLevel(); + return logMgmt.LogEvent(&eventData, aEventOptions, aEventNumber); +} + +} // namespace app +} // namespace chip diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index b59f26e9917057..fd3713768ec616 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -309,9 +309,7 @@ CHIP_ERROR EventManagement::CalculateEventSize(EventLoggingDelegate * apDelegate CHIP_ERROR EventManagement::ConstructEvent(EventLoadOutContext * apContext, EventLoggingDelegate * apDelegate, const EventOptions * apOptions) { - TLV::TLVType dataContainerType; uint64_t deltatime = 0; - VerifyOrReturnError(apContext->mCurrentEventNumber >= apContext->mStartingEventNumber, CHIP_NO_ERROR /* no-op: don't write event, but advance current event Number */); @@ -347,11 +345,8 @@ CHIP_ERROR EventManagement::ConstructEvent(EventLoadOutContext * apContext, Even ReturnErrorOnFailure(eventDataIBBuilder.GetError()); - ReturnErrorOnFailure(apContext->mWriter.StartContainer(ContextTag(chip::to_underlying(EventDataIB::Tag::kData)), - TLV::kTLVType_Structure, dataContainerType)); // Callback to write the EventData ReturnErrorOnFailure(apDelegate->WriteEvent(apContext->mWriter)); - ReturnErrorOnFailure(apContext->mWriter.EndContainer(dataContainerType)); eventDataIBBuilder.EndOfEventDataIB(); ReturnErrorOnFailure(eventDataIBBuilder.GetError()); eventReportBuilder.EndOfEventReportIB(); @@ -512,7 +507,6 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, E opts = EventOptions(timestamp); // Start the event container (anonymous structure) in the circular buffer writer.Init(*mpEventBuffer); - // check whether the entry is to be logged or discarded silently VerifyOrExit(aEventOptions.mPriority >= CHIP_CONFIG_EVENT_GLOBAL_PRIORITY, /* no-op */); @@ -520,8 +514,6 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, E // Create all event specific data // Timestamp; encoded as a delta time - opts.mTimestamp = aEventOptions.mTimestamp; - if (GetPriorityBuffer(aEventOptions.mPriority)->GetFirstEventTimestamp() == 0) { GetPriorityBuffer(aEventOptions.mPriority)->UpdateFirstLastEventTime(opts.mTimestamp); @@ -576,17 +568,16 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, E #if CHIP_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS ChipLogDetail(EventLogging, - "LogEvent event number: 0x" ChipLogFormatX64 " schema priority: %u cluster id: " ChipLogFormatMEI - " event id: 0x%" PRIx32 " %s timestamp: 0x" ChipLogFormatX64, - ChipLogValueX64(aEventNumber), static_cast(opts.mPriority), ChipLogValueMEI(opts.mPath.mClusterId), - opts.mPath.mEventId, opts.mTimestamp.mType == Timestamp::Type::kSystem ? "Sys" : "Epoch", - ChipLogValueX64(opts.mTimestamp.mValue)); + "LogEvent event number: 0x" ChipLogFormatX64 " schema priority: %u, endpoint id: 0x%" PRIx16 + " cluster id: " ChipLogFormatMEI " event id: 0x%" PRIx32 " %s timestamp: 0x" ChipLogFormatX64, + ChipLogValueX64(aEventNumber), static_cast(opts.mPriority), opts.mPath.mEndpointId, + ChipLogValueMEI(opts.mPath.mClusterId), opts.mPath.mEventId, + opts.mTimestamp.mType == Timestamp::Type::kSystem ? "Sys" : "Epoch", ChipLogValueX64(opts.mTimestamp.mValue)); #endif // CHIP_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS if (opts.mUrgent == EventOptions::Type::kUrgent) { - ConcreteEventPath path(opts.mPath.mEndpointId, opts.mPath.mClusterId, opts.mPath.mEventId); - err = InteractionModelEngine::GetInstance()->GetReportingEngine().ScheduleUrgentEventDelivery(path); + err = InteractionModelEngine::GetInstance()->GetReportingEngine().ScheduleUrgentEventDelivery(opts.mPath); } } diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp index ba62dc9267eb03..db20926b429290 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -443,9 +444,30 @@ bool emberAfTestClusterClusterTestListStructArgumentRequestCallback( return SendBooleanResponse(commandObj, commandPath, shouldReturnTrue); } +bool emberAfTestClusterClusterTestEmitTestEventRequestCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::TestEmitTestEventRequest::DecodableType & commandData) +{ + Commands::TestEmitTestEventResponse::Type responseData; + Structs::SimpleStruct::Type arg4; + DataModel::List arg5; + DataModel::List arg6; + EventOptions eventOptions; + + // TODO: Add code to pull arg4, arg5 and arg6 from the arguments of the command + Events::TestEvent::Type event{ commandData.arg1, commandData.arg2, commandData.arg3, arg4, arg5, arg6 }; + + if (CHIP_NO_ERROR != LogEvent(event, commandPath.mEndpointId, eventOptions, responseData.value)) + { + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return true; + } + commandObj->AddResponseData(commandPath, responseData); + return true; +} bool emberAfTestClusterClusterTestListInt8UArgumentRequestCallback( - app::CommandHandler * commandObj, app::ConcreteCommandPath const & commandPath, + CommandHandler * commandObj, ConcreteCommandPath const & commandPath, Commands::TestListInt8UArgumentRequest::DecodableType const & commandData) { bool shouldReturnTrue = true; diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 844cdee7dd1e99..1c9af3eb3a9ceb 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -17,6 +17,7 @@ #include +#include #include #include #include @@ -70,6 +71,17 @@ namespace chip { Server Server::sServer; +#if CHIP_CONFIG_ENABLE_SERVER_IM_EVENT +#define CHIP_NUM_EVENT_LOGGING_BUFFERS 3 +static uint8_t sInfoEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE]; +static uint8_t sDebugEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE]; +static uint8_t sCritEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE]; +static ::chip::PersistedCounter sCritEventIdCounter; +static ::chip::PersistedCounter sInfoEventIdCounter; +static ::chip::PersistedCounter sDebugEventIdCounter; +static ::chip::app::CircularEventBuffer sLoggingBuffer[CHIP_NUM_EVENT_LOGGING_BUFFERS]; +#endif // CHIP_CONFIG_ENABLE_SERVER_IM_EVENT + CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint16_t unsecureServicePort) { mSecuredServicePort = secureServicePort; @@ -138,6 +150,27 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint err = chip::app::InteractionModelEngine::GetInstance()->Init(&mExchangeMgr, nullptr); SuccessOrExit(err); +#if CHIP_CONFIG_ENABLE_SERVER_IM_EVENT + // Initialize event logging subsystem + { + ::chip::Platform::PersistedStorage::Key debugEventIdCounterStorageKey = CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY; + ::chip::Platform::PersistedStorage::Key critEventIdCounterStorageKey = CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY; + ::chip::Platform::PersistedStorage::Key infoEventIdCounterStorageKey = CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY; + + ::chip::app::LogStorageResources logStorageResources[] = { + { &sDebugEventBuffer[0], sizeof(sDebugEventBuffer), &debugEventIdCounterStorageKey, + CHIP_DEVICE_CONFIG_EVENT_ID_COUNTER_EPOCH, &sDebugEventIdCounter, ::chip::app::PriorityLevel::Debug }, + { &sInfoEventBuffer[0], sizeof(sInfoEventBuffer), &infoEventIdCounterStorageKey, + CHIP_DEVICE_CONFIG_EVENT_ID_COUNTER_EPOCH, &sInfoEventIdCounter, ::chip::app::PriorityLevel::Info }, + { &sCritEventBuffer[0], sizeof(sCritEventBuffer), &critEventIdCounterStorageKey, + CHIP_DEVICE_CONFIG_EVENT_ID_COUNTER_EPOCH, &sCritEventIdCounter, ::chip::app::PriorityLevel::Critical } + }; + + chip::app::EventManagement::GetInstance().Init(&mExchangeMgr, CHIP_NUM_EVENT_LOGGING_BUFFERS, &sLoggingBuffer[0], + &logStorageResources[0]); + } +#endif // CHIP_CONFIG_ENABLE_SERVER_IM_EVENT + #if defined(CHIP_APP_USE_ECHO) err = InitEchoHandler(&gExchangeMgr); SuccessOrExit(err); diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index 5a0cee4a39ade8..ebfb3f74877f76 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -156,9 +156,11 @@ class TestEventGenerator : public chip::app::EventLoggingDelegate public: CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) { - CHIP_ERROR err = CHIP_NO_ERROR; - err = aWriter.Put(kLivenessDeviceStatus, mStatus); - return err; + chip::TLV::TLVType dataContainerType; + ReturnErrorOnFailure(aWriter.StartContainer(chip::TLV::ContextTag(chip::to_underlying(chip::app::EventDataIB::Tag::kData)), + chip::TLV::kTLVType_Structure, dataContainerType)); + ReturnErrorOnFailure(aWriter.Put(kLivenessDeviceStatus, mStatus)); + return aWriter.EndContainer(dataContainerType); } void SetStatus(int32_t aStatus) { mStatus = aStatus; } diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index b03ca4e0264471..9af284ff9b301b 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -94,9 +94,11 @@ class TestEventGenerator : public chip::app::EventLoggingDelegate public: CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) { - CHIP_ERROR err = CHIP_NO_ERROR; - err = aWriter.Put(kTestEventTag, mStatus); - return err; + chip::TLV::TLVType dataContainerType; + ReturnErrorOnFailure(aWriter.StartContainer(chip::TLV::ContextTag(chip::to_underlying(chip::app::EventDataIB::Tag::kData)), + chip::TLV::kTLVType_Structure, dataContainerType)); + ReturnErrorOnFailure(aWriter.Put(kTestEventTag, mStatus)); + return aWriter.EndContainer(dataContainerType); } void SetStatus(int32_t aStatus) { mStatus = aStatus; } diff --git a/src/app/tests/integration/MockEvents.cpp b/src/app/tests/integration/MockEvents.cpp index fc0c0d0c341c42..15852e3272300d 100644 --- a/src/app/tests/integration/MockEvents.cpp +++ b/src/app/tests/integration/MockEvents.cpp @@ -110,9 +110,11 @@ void LivenessEventGenerator::Generate(void) CHIP_ERROR LivenessEventGenerator::WriteEvent(chip::TLV::TLVWriter & aWriter) { - CHIP_ERROR err = CHIP_NO_ERROR; - err = aWriter.Put(kLivenessDeviceStatus, mStatus); - return err; + chip::TLV::TLVType dataContainerType; + ReturnErrorOnFailure(aWriter.StartContainer(chip::TLV::ContextTag(chip::to_underlying(chip::app::EventDataIB::Tag::kData)), + chip::TLV::kTLVType_Structure, dataContainerType)); + ReturnErrorOnFailure(aWriter.Put(kLivenessDeviceStatus, mStatus)); + return aWriter.EndContainer(dataContainerType); } chip::EventNumber LivenessEventGenerator::LogLiveness(chip::NodeId aNodeId, chip::EndpointId aEndpointId, diff --git a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml index 8b403982196511..24abf54eafa3a0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml @@ -370,6 +370,16 @@ limitations under the License. + + + Command that takes identical arguments to the fields of the TestEvent and logs the TestEvent to the buffer. Command returns an event ID as the response. + + + + + + Simple response for TestWithResponse with a simple return value @@ -482,6 +492,13 @@ limitations under the License. + + + Delivers the ID of an event in response to test command emitting events. + + + + Example test event diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 9953b4ace5ece7..c16a390879de81 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -35,8 +35,8 @@ @unique class EventTimestampType(Enum): - SYSTEM = 1 - EPOCH = 2 + SYSTEM = 0 + EPOCH = 1 @unique @@ -104,7 +104,7 @@ def __init__(self, EndpointId: int = None, Cluster=None, Event=None, ClusterId=N self.EventId = EventId def __str__(self) -> str: - return f"{self.EndpointId}/{self.EventId}/{self.EventId}" + return f"{self.EndpointId}/{self.ClusterId}/{self.EventId}" def __hash__(self): return str(self).__hash__() @@ -187,6 +187,7 @@ class ValueDecodeFailure: Reason: Exception = None +@dataclass class EventReadResult(EventStatus): Data: Any = None @@ -278,7 +279,7 @@ def _BuildEventIndex(): for clusterName, obj in inspect.getmembers(sys.modules['chip.clusters.Objects']): if ('chip.clusters.Objects' in str(obj)) and inspect.isclass(obj): for objName, subclass in inspect.getmembers(obj): - if inspect.isclass(subclass) and (('Events') in str(subclass)): + if inspect.isclass(subclass) and (('Events' == objName)): for eventName, event in inspect.getmembers(subclass): if inspect.isclass(event): base_classes = inspect.getmro(event) @@ -288,7 +289,8 @@ def _BuildEventIndex(): value for value in base_classes if 'ClusterEventDescriptor' in str(value)] if (matched == []): continue - + logging.error( + f"event iterate {event.cluster_id} and {event.event_id}") _EventIndex[str(EventPath(ClusterId=event.cluster_id, EventId=event.event_id))] = eval( 'chip.clusters.Objects.' + clusterName + '.Events.' + eventName) @@ -375,24 +377,12 @@ def _handleEventData(self, header: EventHeader, path: EventPath, data: bytes): eventValue = ValueDecodeFailure( tlvData, LookupError("event schema not found")) else: - try: - eventValue = eventType(eventType.FromTLV(data)) - except Exception as ex: - logging.error( - f"Error convering TLV to Cluster Object for path: Endpoint = {path.EndpointId}/Cluster = {path.ClusterId}/Event = {path.EventId}") - logging.error( - f"Failed Cluster Object: {str(eventType)}") - logging.error(ex) - eventValue = ValueDecodeFailure( - tlvData, ex) - - # If we're in debug mode, raise the exception so that we can better debug what's happening. - if (builtins.enableDebugMode): - raise + eventValue = tlvData + header.Event = eventType with self._resLock: - self._res['Events'].append[EventReadResult( - Header=header, Data=eventValue)] + self._res['Events'].append(EventReadResult( + Header=header, Status=chip.interaction_model.Status.Success, Data=eventValue)) except Exception as ex: logging.exception(ex) diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 6e682eb239f445..da6be365ae6618 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -5124,8 +5124,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class StateChanged(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0025 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0025 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5142,8 +5147,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ActionFailed(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0025 - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0025 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5562,8 +5572,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class StartUp(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0028 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0028 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5576,8 +5591,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ShutDown(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0028 - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0028 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5588,8 +5608,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class Leave(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0028 - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0028 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5600,8 +5625,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ReachableChanged(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0028 - event_id: typing.ClassVar[int] = 0x00000003 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0028 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5904,8 +5934,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class StateTransition(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x002A - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x002A + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5924,8 +5959,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class VersionApplied(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x002A - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x002A + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -5940,8 +5980,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class DownloadError(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x002A - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x002A + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -7651,8 +7696,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class HardwareFaultChange(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0033 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0033 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -7667,8 +7717,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class RadioFaultChange(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0033 - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0033 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -7683,8 +7738,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class NetworkFaultChange(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0033 - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0033 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -7699,8 +7759,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class BootReason(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0033 - event_id: typing.ClassVar[int] = 0x00000003 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0033 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -7870,8 +7935,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class SoftwareFault(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0034 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0034 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -9083,8 +9153,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class ConnectionStatus(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0035 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0035 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -9389,8 +9464,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class Disconnection(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0036 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0036 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -9403,8 +9483,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class AssociationFailure(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0036 - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0036 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -9419,8 +9504,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ConnectionStatus(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0036 - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0036 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10114,8 +10204,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class SwitchLatched(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10128,8 +10223,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class InitialPress(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10142,8 +10242,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class LongPress(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10156,8 +10261,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ShortRelease(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000003 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10170,8 +10280,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class LongRelease(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000004 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000004 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10184,8 +10299,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class MultiPressOngoing(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000005 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000005 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -10200,8 +10320,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class MultiPressComplete(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x003B - event_id: typing.ClassVar[int] = 0x00000006 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003B + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000006 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -11202,8 +11327,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class StateChange(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0045 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0045 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -13292,8 +13422,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class DoorLockAlarm(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0101 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0101 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -13306,8 +13441,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class DoorStateChange(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0101 - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0101 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -13320,8 +13460,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class LockOperation(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0101 - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0101 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -13344,8 +13489,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class LockOperationError(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0101 - event_id: typing.ClassVar[int] = 0x00000003 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0101 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -13370,8 +13520,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class LockUserChange(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0101 - event_id: typing.ClassVar[int] = 0x00000004 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0101 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000004 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14647,8 +14802,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class SupplyVoltageLow(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000000 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14659,8 +14819,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class SupplyVoltageHigh(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14671,8 +14836,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class PowerMissingPhase(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000002 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14683,8 +14853,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class SystemPressureLow(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000003 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14695,8 +14870,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class SystemPressureHigh(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000004 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000004 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14707,8 +14887,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class DryRunning(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000005 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000005 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14719,8 +14904,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class MotorTemperatureHigh(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000006 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000006 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14731,8 +14921,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class PumpMotorFatalFailure(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000007 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000007 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14743,8 +14938,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ElectronicTemperatureHigh(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000008 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000008 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14755,8 +14955,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class PumpBlocked(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000009 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000009 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14767,8 +14972,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class SensorFailure(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x0000000A + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x0000000A @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14779,8 +14989,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ElectronicNonFatalFailure(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x0000000B + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x0000000B @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14791,8 +15006,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class ElectronicFatalFailure(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x0000000C + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x0000000C @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14803,8 +15023,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class GeneralFault(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x0000000D + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x0000000D @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14815,8 +15040,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class Leakage(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x0000000E + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x0000000E @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14827,8 +15057,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class AirDetection(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x0000000F + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x0000000F @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -14839,8 +15074,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class TurbineOperation(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x0200 - event_id: typing.ClassVar[int] = 0x00000010 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0200 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000010 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: @@ -25215,6 +25455,21 @@ def descriptor(cls) -> ClusterObjectDescriptor: arg1: 'typing.List[uint]' = field(default_factory=lambda: []) + @dataclass + class TestEmitTestEventResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x050F + command_id: typing.ClassVar[int] = 0x000A + is_client: typing.ClassVar[bool] = False + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="value", Tag=0, Type=uint), + ]) + + value: 'uint' = 0 + @dataclass class TestNestedStructListArgumentRequest(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x050F @@ -25372,6 +25627,25 @@ def descriptor(cls) -> ClusterObjectDescriptor: arg1: 'typing.Optional[bool]' = None + @dataclass + class TestEmitTestEventRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x050F + command_id: typing.ClassVar[int] = 0x0014 + is_client: typing.ClassVar[bool] = True + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="arg1", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="arg2", Tag=1, Type=TestCluster.Enums.SimpleEnum), + ClusterObjectFieldDescriptor(Label="arg3", Tag=2, Type=bool), + ]) + + arg1: 'uint' = 0 + arg2: 'TestCluster.Enums.SimpleEnum' = 0 + arg3: 'bool' = False + class Attributes: @dataclass @@ -26658,8 +26932,13 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: class Events: @dataclass class TestEvent(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = 0x050F - event_id: typing.ClassVar[int] = 0x00000001 + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: diff --git a/src/controller/python/templates/python-cluster-Objects-py.zapt b/src/controller/python/templates/python-cluster-Objects-py.zapt index 6b61951454e689..685d8dcbf446c6 100644 --- a/src/controller/python/templates/python-cluster-Objects-py.zapt +++ b/src/controller/python/templates/python-cluster-Objects-py.zapt @@ -120,8 +120,13 @@ class {{asUpperCamelCase name}}(Cluster): {{/first}} @dataclass class {{asUpperCamelCase name}}(ClusterEventDescriptor): - cluster_id: typing.ClassVar[int] = {{ asHex parent.code 4 }} - event_id: typing.ClassVar[int] = {{asMEI manufacturerCode code}} + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return {{ asHex parent.code 4 }} + + @ChipUtility.classproperty + def event_id(cls) -> int: + return {{ asMEI manufacturerCode code }} @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: diff --git a/src/controller/python/test/test_scripts/cluster_objects.py b/src/controller/python/test/test_scripts/cluster_objects.py index 876f8916621977..c04641f3e49beb 100644 --- a/src/controller/python/test/test_scripts/cluster_objects.py +++ b/src/controller/python/test/test_scripts/cluster_objects.py @@ -95,6 +95,17 @@ async def SendCommandWithResponse(cls, devCtrl): if res.returnValue != 5: raise ValueError() + @classmethod + async def SendCommandWithTestClusterEventTrigger(cls, devCtrl, eventNumber): + req = Clusters.TestCluster.Commands.TestEmitTestEventRequest(arg1=1) + res = await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=LIGHTING_ENDPOINT_ID, payload=req) + if not isinstance(res, Clusters.TestCluster.Commands.TestEmitTestEventResponse): + logger.error(f"Unexpected response of type {type(res)} received.") + raise ValueError() + logger.info(f"Received response: {res}") + if res.value != eventNumber: + raise ValueError() + @classmethod async def SendWriteRequest(cls, devCtrl): res = await devCtrl.WriteAttribute(nodeid=NODE_ID, @@ -198,29 +209,43 @@ async def TestReadAttributeRequests(cls, devCtrl): raise AssertionError("Unexpected read result") @classmethod - async def TestReadEventRequests(cls, devCtrl): + async def TestReadEventRequests(cls, devCtrl, expectEventsNum): logger.info("1: Reading Ex Cx Ex") req = [ - (0, Clusters.TestCluster.Events.TestEvent), + (1, Clusters.TestCluster.Events.TestEvent), ] - _AssumeEventsDecodeSuccess(await devCtrl.ReadEvent(nodeid=NODE_ID, events=req)) - + res = await devCtrl.ReadEvent(nodeid=NODE_ID, events=req) + if (len(res['Events']) != expectEventsNum): + raise AssertionError( + f"Got back {len(res['Events'])} event items instead of {expectEventsNum}") + _AssumeEventsDecodeSuccess(res) logger.info("2: Reading Ex Cx E*") req = [ - (0, Clusters.TestCluster), + (1, Clusters.TestCluster), ] - _AssumeEventsDecodeSuccess(await devCtrl.ReadEvent(nodeid=NODE_ID, events=req)) + + res = await devCtrl.ReadEvent(nodeid=NODE_ID, events=req) + if (len(res['Events']) != 0): + raise AssertionError( + f"Got back {len(res['Events'])} event items instead of 0") + _AssumeEventsDecodeSuccess(res) logger.info("3: Reading Ex C* E*") req = [ - 0 + 1 ] + if (len(res['Events']) != 0): + raise AssertionError( + f"Got back {len(res['Events'])} event items instead of 0") _AssumeEventsDecodeSuccess(await devCtrl.ReadEvent(nodeid=NODE_ID, events=req)) logger.info("4: Reading E* C* E*") req = [ '*' ] + if (len(res['Events']) != 0): + raise AssertionError( + f"Got back {len(res['Events'])} event items instead of 0") _AssumeEventsDecodeSuccess(await devCtrl.ReadEvent(nodeid=NODE_ID, events=req)) # TODO: Add more wildcard test for IM events. @@ -232,9 +257,12 @@ async def RunTest(cls, devCtrl): await cls.RoundTripTest(devCtrl) await cls.RoundTripTestWithBadEndpoint(devCtrl) await cls.SendCommandWithResponse(devCtrl) + await cls.SendCommandWithTestClusterEventTrigger(devCtrl, 1) + await cls.TestReadEventRequests(devCtrl, 1) + await cls.SendCommandWithTestClusterEventTrigger(devCtrl, 2) + await cls.TestReadEventRequests(devCtrl, 1) await cls.SendWriteRequest(devCtrl) await cls.TestReadAttributeRequests(devCtrl) - await cls.TestReadEventRequests(devCtrl) await cls.TestSubscribeAttribute(devCtrl) except Exception as ex: logger.error( diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h index 6b12d34d2276e8..4f63d2f0d731d0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h @@ -1873,6 +1873,11 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPTestClusterClusterTestEmitTestEventResponseParams : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull value; +- (instancetype)init; +@end + @interface CHIPTestClusterClusterTestNestedStructListArgumentRequestParams : NSObject @property (strong, nonatomic) CHIPTestClusterClusterNestedStructList * _Nonnull arg1; - (instancetype)init; @@ -1925,6 +1930,13 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPTestClusterClusterTestEmitTestEventRequestParams : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull arg1; +@property (strong, nonatomic) NSNumber * _Nonnull arg2; +@property (strong, nonatomic) NSNumber * _Nonnull arg3; +- (instancetype)init; +@end + @interface CHIPMessagingClusterDisplayMessageParams : NSObject @property (strong, nonatomic) NSNumber * _Nonnull messageId; @property (strong, nonatomic) NSNumber * _Nonnull messageControl; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm index a3d8818c065e56..1f7dd89c417f19 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm @@ -3989,6 +3989,17 @@ - (instancetype)init } @end +@implementation CHIPTestClusterClusterTestEmitTestEventResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _value = @(0); + } + return self; +} +@end + @implementation CHIPTestClusterClusterTestNestedStructListArgumentRequestParams - (instancetype)init { @@ -4101,6 +4112,21 @@ - (instancetype)init } @end +@implementation CHIPTestClusterClusterTestEmitTestEventRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _arg1 = @(0); + + _arg2 = @(0); + + _arg3 = @(0); + } + return self; +} +@end + @implementation CHIPMessagingClusterDisplayMessageParams - (instancetype)init { diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index d48736157d4320..f1324d78b8eb73 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -873,7 +873,7 @@ * for the debug level events. */ #ifndef CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (256) +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) #endif /** @@ -896,16 +896,6 @@ #define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY "crit-eidc" #endif -/** - * @def CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY - * - * @brief - * The production event id counter (eidc) persisted storage key. - */ -#ifndef CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY "prod-eidc" -#endif - /** * @def CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY * diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 4157026b139cf7..e0696be2be640b 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -2732,6 +2732,14 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_CASE_SESSION_RESUME_CACHE_SIZE 4 #endif +/** + * @def CHIP_CONFIG_ENABLE_SERVER_IM_EVENT + * + * @brief Enable Interaction model Event support in server + */ +#ifndef CHIP_CONFIG_ENABLE_SERVER_IM_EVENT +#define CHIP_CONFIG_ENABLE_SERVER_IM_EVENT 1 +#endif /** * @} */ diff --git a/src/platform/Ameba/CHIPDevicePlatformConfig.h b/src/platform/Ameba/CHIPDevicePlatformConfig.h index 85e0146f88d090..16edccd8f91ab6 100755 --- a/src/platform/Ameba/CHIPDevicePlatformConfig.h +++ b/src/platform/Ameba/CHIPDevicePlatformConfig.h @@ -38,11 +38,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to the platform. diff --git a/src/platform/Darwin/CHIPDevicePlatformConfig.h b/src/platform/Darwin/CHIPDevicePlatformConfig.h index 482ebf52d73874..b9b2f4d7133c30 100644 --- a/src/platform/Darwin/CHIPDevicePlatformConfig.h +++ b/src/platform/Darwin/CHIPDevicePlatformConfig.h @@ -36,11 +36,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 // ========== Platform-specific Configuration ========= diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index 05842edabe4744..a32bb6a651db78 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -49,9 +49,8 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 #define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 3 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 4 // ========== Platform-specific Configuration ========= diff --git a/src/platform/Linux/CHIPDevicePlatformConfig.h b/src/platform/Linux/CHIPDevicePlatformConfig.h index fe7bff97a3e8bf..7c9a5d6beb417c 100644 --- a/src/platform/Linux/CHIPDevicePlatformConfig.h +++ b/src/platform/Linux/CHIPDevicePlatformConfig.h @@ -43,11 +43,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 // ========== Platform-specific Configuration ========= diff --git a/src/platform/Tizen/CHIPDevicePlatformConfig.h b/src/platform/Tizen/CHIPDevicePlatformConfig.h index d22b7dcae1881c..7a32ad560c7039 100644 --- a/src/platform/Tizen/CHIPDevicePlatformConfig.h +++ b/src/platform/Tizen/CHIPDevicePlatformConfig.h @@ -42,11 +42,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to Tizen platforms. diff --git a/src/platform/android/CHIPDevicePlatformConfig.h b/src/platform/android/CHIPDevicePlatformConfig.h index 9e17bd853397e0..f7ee1b21c6a2c1 100644 --- a/src/platform/android/CHIPDevicePlatformConfig.h +++ b/src/platform/android/CHIPDevicePlatformConfig.h @@ -43,11 +43,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - #define CHIP_DEVICE_CONFIG_ENABLE_UNPROVISIONED_MDNS 1 // ========== Platform-specific Configuration ========= diff --git a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h index a4a57469d90c5a..6fabd3d32fa7e4 100644 --- a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h @@ -41,6 +41,10 @@ // ==================== Security Adaptations ==================== +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 1 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 2 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 3 + // This platform uses mbedtls, but these defines don't seem to be used in source #define CHIP_CONFIG_USE_OPENSSL_ECC 0 #define CHIP_CONFIG_USE_MICRO_ECC 1 diff --git a/src/platform/mbed/CHIPDevicePlatformConfig.h b/src/platform/mbed/CHIPDevicePlatformConfig.h index dbf086240679d4..ab3dced8197f5d 100644 --- a/src/platform/mbed/CHIPDevicePlatformConfig.h +++ b/src/platform/mbed/CHIPDevicePlatformConfig.h @@ -32,11 +32,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - #define CHIP_DEVICE_CONFIG_ENABLE_DNSSD 1 #ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index f82d5f046fd851..cccce5f8461db1 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -37,11 +37,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to Zephyr platforms. diff --git a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h index 7b3b2666d3c194..b55382633713af 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h @@ -44,9 +44,8 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 #define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 3 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 4 // ========== Platform-specific Configuration ========= diff --git a/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h index 0f1fd54a4c4b5b..dca1ba32ec34ec 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h @@ -43,6 +43,10 @@ #define CHIP_CONFIG_ERROR_CLASS 1 +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE (512) +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE (512) + // ==================== Security Adaptations ==================== #define CHIP_CONFIG_USE_OPENSSL_ECC 0 diff --git a/src/platform/qpg/CHIPDevicePlatformConfig.h b/src/platform/qpg/CHIPDevicePlatformConfig.h index d04bf925788f0a..2a950414f6cc26 100644 --- a/src/platform/qpg/CHIPDevicePlatformConfig.h +++ b/src/platform/qpg/CHIPDevicePlatformConfig.h @@ -41,9 +41,8 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 #define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 3 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 4 #define CHIP_DEVICE_CONFIG_ENABLE_DNSSD 1 diff --git a/src/platform/telink/CHIPDevicePlatformConfig.h b/src/platform/telink/CHIPDevicePlatformConfig.h index 53b146c5309eba..18c5a336135be6 100644 --- a/src/platform/telink/CHIPDevicePlatformConfig.h +++ b/src/platform/telink/CHIPDevicePlatformConfig.h @@ -37,11 +37,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_CRIT_EIDC_KEY 2 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_PROD_EIDC_KEY 3 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_INFO_EIDC_KEY 4 -#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 5 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to Zephyr platforms. diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 985d51a557aac6..110214e9b8b25b 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -1796,6 +1796,15 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::TestEmitTestEventRequest::Id: { + Commands::TestEmitTestEventRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfTestClusterClusterTestEmitTestEventRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } case Commands::TestEnumsRequest::Id: { Commands::TestEnumsRequest::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); 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 c401c082c30786..d0e1af6c4b43cb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -15216,6 +15216,11 @@ bool emberAfTestClusterClusterSimpleStructResponseCallback( bool emberAfTestClusterClusterTestListInt8UArgumentRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::DecodableType & commandData); +/** + * @brief Test Cluster Cluster TestEmitTestEventResponse Command callback (from server) + */ +bool emberAfTestClusterClusterTestEmitTestEventResponseCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj, + uint64_t value); /** * @brief Test Cluster Cluster TestNestedStructListArgumentRequest Command callback (from client) */ @@ -15270,6 +15275,12 @@ bool emberAfTestClusterClusterTimedInvokeRequestCallback( bool emberAfTestClusterClusterTestSimpleOptionalArgumentRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::TestCluster::Commands::TestSimpleOptionalArgumentRequest::DecodableType & commandData); +/** + * @brief Test Cluster Cluster TestEmitTestEventRequest Command callback (from client) + */ +bool emberAfTestClusterClusterTestEmitTestEventRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::TestCluster::Commands::TestEmitTestEventRequest::DecodableType & commandData); /** * @brief Messaging Cluster DisplayMessage Command callback (from server) */ 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 1d8adae836a303..a9669c96ce59de 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 @@ -18302,6 +18302,40 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace TestListInt8UArgumentRequest. +namespace TestEmitTestEventResponse { +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::kValue)), value)); + 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) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kValue): + ReturnErrorOnFailure(DataModel::Decode(reader, value)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace TestEmitTestEventResponse. namespace TestNestedStructListArgumentRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { @@ -18656,6 +18690,48 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace TestSimpleOptionalArgumentRequest. +namespace TestEmitTestEventRequest { +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::kArg1)), arg1)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kArg2)), arg2)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kArg3)), arg3)); + 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) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kArg1): + ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); + break; + case to_underlying(Fields::kArg2): + ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); + break; + case to_underlying(Fields::kArg3): + ReturnErrorOnFailure(DataModel::Decode(reader, arg3)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace TestEmitTestEventRequest. } // namespace Commands namespace Events { 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 d665da5735f361..c0e56a463be385 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 @@ -30145,6 +30145,11 @@ struct Type; struct DecodableType; } // namespace TestListInt8UArgumentRequest +namespace TestEmitTestEventResponse { +struct Type; +struct DecodableType; +} // namespace TestEmitTestEventResponse + namespace TestNestedStructListArgumentRequest { struct Type; struct DecodableType; @@ -30190,6 +30195,11 @@ struct Type; struct DecodableType; } // namespace TestSimpleOptionalArgumentRequest +namespace TestEmitTestEventRequest { +struct Type; +struct DecodableType; +} // namespace TestEmitTestEventRequest + } // namespace Commands namespace Commands { @@ -30975,6 +30985,38 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace TestListInt8UArgumentRequest +namespace TestEmitTestEventResponse { +enum class Fields +{ + kValue = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::TestEmitTestEventResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + + uint64_t value; + + 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::TestEmitTestEventResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + + uint64_t value; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace TestEmitTestEventResponse namespace TestNestedStructListArgumentRequest { enum class Fields { @@ -31295,6 +31337,44 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace TestSimpleOptionalArgumentRequest +namespace TestEmitTestEventRequest { +enum class Fields +{ + kArg1 = 0, + kArg2 = 1, + kArg3 = 2, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::TestEmitTestEventRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + + uint8_t arg1; + SimpleEnum arg2; + bool arg3; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = Clusters::TestCluster::Commands::TestEmitTestEventResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::TestEmitTestEventRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + + uint8_t arg1; + SimpleEnum arg2; + bool arg3; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace TestEmitTestEventRequest } // namespace Commands namespace Attributes { 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 9c27f255f11fa4..026a12742a8f66 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 @@ -456,6 +456,7 @@ #define ZCL_TEST_LIST_STRUCT_ARGUMENT_REQUEST_COMMAND_ID (0x09) #define ZCL_SIMPLE_STRUCT_RESPONSE_COMMAND_ID (0x09) #define ZCL_TEST_LIST_INT8_U_ARGUMENT_REQUEST_COMMAND_ID (0x0A) +#define ZCL_TEST_EMIT_TEST_EVENT_RESPONSE_COMMAND_ID (0x0A) #define ZCL_TEST_NESTED_STRUCT_LIST_ARGUMENT_REQUEST_COMMAND_ID (0x0B) #define ZCL_TEST_LIST_NESTED_STRUCT_LIST_ARGUMENT_REQUEST_COMMAND_ID (0x0C) #define ZCL_TEST_LIST_INT8_U_REVERSE_REQUEST_COMMAND_ID (0x0D) @@ -465,6 +466,7 @@ #define ZCL_SIMPLE_STRUCT_ECHO_REQUEST_COMMAND_ID (0x11) #define ZCL_TIMED_INVOKE_REQUEST_COMMAND_ID (0x12) #define ZCL_TEST_SIMPLE_OPTIONAL_ARGUMENT_REQUEST_COMMAND_ID (0x13) +#define ZCL_TEST_EMIT_TEST_EVENT_REQUEST_COMMAND_ID (0x14) // Commands for cluster: Messaging #define ZCL_DISPLAY_MESSAGE_COMMAND_ID (0x00) 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 b455c92ad3a917..fcb1790f1a92a2 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 @@ -1634,6 +1634,10 @@ namespace TestListInt8UArgumentRequest { static constexpr CommandId Id = 0x0000000A; } // namespace TestListInt8UArgumentRequest +namespace TestEmitTestEventResponse { +static constexpr CommandId Id = 0x0000000A; +} // namespace TestEmitTestEventResponse + namespace TestNestedStructListArgumentRequest { static constexpr CommandId Id = 0x0000000B; } // namespace TestNestedStructListArgumentRequest @@ -1670,6 +1674,10 @@ namespace TestSimpleOptionalArgumentRequest { static constexpr CommandId Id = 0x00000013; } // namespace TestSimpleOptionalArgumentRequest +namespace TestEmitTestEventRequest { +static constexpr CommandId Id = 0x00000014; +} // namespace TestEmitTestEventRequest + } // namespace Commands } // namespace TestCluster