From 8fd3915a2f0dc0c12bd48a078408aee53abcf512 Mon Sep 17 00:00:00 2001 From: yunhanw Date: Mon, 6 Dec 2021 23:18:21 -0800 Subject: [PATCH] Hook server with IM EventManagment and adjust EventManagment --- .../all-clusters-common/all-clusters-app.zap | 16 +++++++ src/app/EventLogging.h | 36 ++++++++++++--- src/app/EventManagement.cpp | 21 +++------ .../test-cluster-server.cpp | 6 ++- src/app/server/Server.cpp | 12 ++--- 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 | 3 -- .../python/chip/clusters/Attribute.py | 32 +++++--------- .../templates/python-cluster-Objects-py.zapt | 9 +++- .../test/test_scripts/cluster_objects.py | 44 +++++++++++++++---- src/platform/EFR32/CHIPDevicePlatformConfig.h | 4 ++ src/platform/cc13x2_26x2/CHIPPlatformConfig.h | 4 ++ .../nxp/k32w/k32w0/CHIPDevicePlatformConfig.h | 4 ++ src/platform/qpg/CHIPDevicePlatformConfig.h | 4 ++ 16 files changed, 149 insertions(+), 70 deletions(-) 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/src/app/EventLogging.h b/src/app/EventLogging.h index 5a4a23d4d4f285..83ce5ebcabe32d 100644 --- a/src/app/EventLogging.h +++ b/src/app/EventLogging.h @@ -20,6 +20,7 @@ #include #include +#include #include #include // So we can encode lists @@ -27,24 +28,49 @@ namespace chip { namespace app { template -class EventLogger : EventLoggingDelegate +class EventLogger : public EventLoggingDelegate { public: EventLogger(const T & aEventData) : mEventData(aEventData){}; - CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) final override { return mEventData.Encode(aWriter, TLV::AnonymousTag); } + 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()); - // log the actual event - aEventNumber = 0; - return CHIP_NO_ERROR; + EventManagement & logMgmt = chip::app::EventManagement::GetInstance(); + aEventOptions.mPath = path; + aEventOptions.mPriority = aEventData.GetPriorityLevel(); + return logMgmt.LogEvent(&eventData, aEventOptions, aEventNumber); } } // namespace app 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 96e8a0246fd486..db20926b429290 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -449,10 +449,14 @@ bool emberAfTestClusterClusterTestEmitTestEventRequestCallback( const Commands::TestEmitTestEventRequest::DecodableType & commandData) { Commands::TestEmitTestEventResponse::Type responseData; + Structs::SimpleStruct::Type arg4; DataModel::List arg5; DataModel::List arg6; EventOptions eventOptions; - Events::TestEvent::Type event{ commandData.arg1, commandData.arg2, commandData.arg3, commandData.arg4, arg5, arg6 }; + + // 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); diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index ad2801b8aa75c0..a2b086ed4a0425 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -72,9 +72,9 @@ namespace chip { Server Server::sServer; #define CHIP_NUM_EVENT_LOGGING_BUFFERS 3 -static uint8_t sCritEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE]; 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; @@ -151,17 +151,17 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint // 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::Platform::PersistedStorage::Key debugEventIdCounterStorageKey = CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY; ::chip::app::LogStorageResources logStorageResources[] = { - { &sCritEventBuffer[0], sizeof(sCritEventBuffer), &critEventIdCounterStorageKey, - CHIP_DEVICE_CONFIG_EVENT_ID_COUNTER_EPOCH, &sCritEventIdCounter, ::chip::app::PriorityLevel::Critical }, + { &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 }, - { &sDebugEventBuffer[0], sizeof(sDebugEventBuffer), &debugEventIdCounterStorageKey, - CHIP_DEVICE_CONFIG_EVENT_ID_COUNTER_EPOCH, &sDebugEventIdCounter, ::chip::app::PriorityLevel::Debug } + { &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], 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 fb890eeebedfa8..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 @@ -378,9 +378,6 @@ limitations under the License. - - - 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/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/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index f404d300183247..a32bb6a651db78 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -48,6 +48,10 @@ #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_INFO_EIDC_KEY 3 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 4 + // ========== Platform-specific Configuration ========= // These are configuration options that are unique to the EFR32 platform. 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/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h index e170d6c9442492..b55382633713af 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h @@ -43,6 +43,10 @@ #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_INFO_EIDC_KEY 3 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 4 + // ========== Platform-specific Configuration ========= // These are configuration options that are unique to the K32W platform. diff --git a/src/platform/qpg/CHIPDevicePlatformConfig.h b/src/platform/qpg/CHIPDevicePlatformConfig.h index a02ecc9bd71756..2a950414f6cc26 100644 --- a/src/platform/qpg/CHIPDevicePlatformConfig.h +++ b/src/platform/qpg/CHIPDevicePlatformConfig.h @@ -40,6 +40,10 @@ #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_INFO_EIDC_KEY 3 +#define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_DEBUG_EIDC_KEY 4 + #define CHIP_DEVICE_CONFIG_ENABLE_DNSSD 1 // ========== Platform-specific Configuration =========