4444
4545import matter .clusters as Clusters
4646from matter .clusters import Globals
47+ from matter .testing .event_attribute_reporting import EventSubscriptionHandler
4748from matter .testing .matter_testing import MatterBaseTest , TestStep , async_test_body , default_matter_test_main
4849
4950logger = logging .getLogger (__name__ )
@@ -106,29 +107,43 @@ def steps_TC_PAVSTI_1_1(self) -> list[TestStep]:
106107 ),
107108 TestStep (
108109 6 ,
110+ "TH establishes a subscription to all of the Events from the Cluster" ,
111+ ),
112+ TestStep (
113+ 7 ,
109114 "TH sends the SetTransportStatus command with ConnectionID = aConnectionID and TransportStatus = Active." ,
110115 "DUT responds with SUCCESS status code." ,
111116 ),
112117 TestStep (
113- 7 ,
118+ 8 ,
114119 "TH sends the ManuallyTriggerTransport command with ConnectionID = aConnectionID." ,
115120 "DUT responds with SUCCESS status code and begins transmission." ,
116121 ),
117122 TestStep (
118- 8 ,
123+ 9 ,
124+ "TH verifies that a PushTransportBegin Event was received." ,
125+ "TH validates that the connectionID = aConnectionID, triggerType = Command, and activationReason = UserInitiated." ,
126+ ),
127+ TestStep (
128+ 10 ,
119129 "View the video stream in TH UI" ,
120130 "Verify the transmitted video stream is of CMAF Format." ,
121131 ),
122132 TestStep (
123- 9 ,
133+ 11 ,
124134 "TH sends the SetTransportStatus command with ConnectionID = aConnectionID and TransportStatus = Inactive." ,
125135 "DUT responds with SUCCESS status code" ,
126136 ),
127137 TestStep (
128- 10 ,
138+ 12 ,
129139 "View the video stream in TH UI" ,
130140 "Verify the transmission of video stream has stopped." ,
131141 ),
142+ TestStep (
143+ 13 ,
144+ "TH verifies that a PushTransportEnd Event was received." ,
145+ "TH validates that the connectionID = aConnectionID." ,
146+ ),
132147 ]
133148
134149 @async_test_body
@@ -235,6 +250,12 @@ async def test_TC_PAVSTI_1_1(self):
235250 )
236251
237252 self .step (6 )
253+ event_callback = EventSubscriptionHandler (expected_cluster = pushavCluster )
254+ await event_callback .start (self .default_controller ,
255+ self .dut_node_id ,
256+ self .get_endpoint (1 ))
257+
258+ self .step (7 )
238259 aConnectionID = (
239260 allocatePushTransportResponse .transportConfiguration .connectionID
240261 )
@@ -244,7 +265,7 @@ async def test_TC_PAVSTI_1_1(self):
244265 endpoint = endpoint ,
245266 )
246267
247- self .step (7 )
268+ self .step (8 )
248269 await self .send_single_cmd (
249270 cmd = pushavCluster .Commands .ManuallyTriggerTransport (
250271 connectionID = aConnectionID ,
@@ -260,7 +281,17 @@ async def test_TC_PAVSTI_1_1(self):
260281 endpoint = endpoint ,
261282 )
262283
263- self .step (8 )
284+ self .step (9 )
285+ # Verify event received
286+ event_data = event_callback .wait_for_event_report (pushavCluster .Events .PushTransportBegin , timeout_sec = 5 )
287+ logger .info (f"Event data { event_data } " )
288+ asserts .assert_equal (event_data .connectionID , aConnectionID , "Unexpected value for ConnectionID returned" )
289+ asserts .assert_equal (event_data .triggerType , pushavCluster .Enums .TransportTriggerTypeEnum .kCommand ,
290+ "Unexpected value for TriggerType returned" )
291+ asserts .assert_equal (event_data .activationReason , pushavCluster .Enums .TriggerActivationReasonEnum .kUserInitiated ,
292+ "Unexpected value for ActivationReason returned" )
293+
294+ self .step (10 )
264295 if not self .check_pics ("PICS_SDK_CI_ONLY" ):
265296 skipped = self .user_verify_push_av_stream (
266297 prompt_msg = "Verify the video stream is being transmitted and is of CMAF format."
@@ -274,14 +305,14 @@ async def test_TC_PAVSTI_1_1(self):
274305 )
275306 asserts .assert_equal (user_response .lower (), "y" )
276307
277- self .step (9 )
308+ self .step (11 )
278309 await self .send_single_cmd (
279310 cmd = pushavCluster .Commands .SetTransportStatus (
280311 connectionID = aConnectionID , transportStatus = pushavCluster .Enums .TransportStatusEnum .kInactive ),
281312 endpoint = endpoint ,
282313 )
283314
284- self .step (10 )
315+ self .step (12 )
285316 if not self .check_pics ("PICS_SDK_CI_ONLY" ):
286317 skipped = self .user_verify_push_av_stream (
287318 prompt_msg = "Verify the transmission of video stream has stopped."
@@ -295,6 +326,12 @@ async def test_TC_PAVSTI_1_1(self):
295326 )
296327 asserts .assert_equal (user_response .lower (), "y" )
297328
329+ self .step (13 )
330+ # Verify event received
331+ event_data = event_callback .wait_for_event_report (pushavCluster .Events .PushTransportEnd , timeout_sec = 5 )
332+ logger .info (f"Event data { event_data } " )
333+ asserts .assert_equal (event_data .connectionID , aConnectionID , "Unexpected value for ConnectionID returned" )
334+
298335
299336if __name__ == "__main__" :
300337 default_matter_test_main ()
0 commit comments