From 70e08ecf85298034e8592842442fb648b53f37e9 Mon Sep 17 00:00:00 2001 From: simonhmorris1 <112178216+simonhmorris1@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:48:23 +0000 Subject: [PATCH 01/13] Update TC-DD-3.2/3.6/3.8 Non-Concurrent(#31751) (#31760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update TC-DD-3.2/3.6/3.8 Non-Concurrent(#31751) * Restyled by whitespace * Restyled by prettier-yaml * Update src/app/tests/suites/certification/Test_TC_DD_3_8.yaml Co-authored-by: Damian Królik <66667989+Damian-Nordic@users.noreply.github.com> --------- Co-authored-by: Restyled.io Co-authored-by: Damian Królik <66667989+Damian-Nordic@users.noreply.github.com> --- .../suites/certification/Test_TC_DD_3_2.yaml | 481 ++++++++++-------- .../suites/certification/Test_TC_DD_3_6.yaml | 108 ++-- .../suites/certification/Test_TC_DD_3_8.yaml | 44 +- 3 files changed, 361 insertions(+), 272 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_DD_3_2.yaml b/src/app/tests/suites/certification/Test_TC_DD_3_2.yaml index 4814d35ee82829..514d9375b11251 100644 --- a/src/app/tests/suites/certification/Test_TC_DD_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_DD_3_2.yaml @@ -37,9 +37,10 @@ tests: verification: | Verify in DUT(ALL-CLUSTER-APP) start BLE Advertising by specific DUT implementation - Verify in TH (CHIP-TOOL) start commissioning process(need to obtain the Thread dataset first) + Verify in TH (CHIP-TOOL) start commissioning process (either Thread or WiFi) ./chip-tool pairing ble-thread 1 hex:0e080000000000010000000300000f35060004001fffe0020811111111222222220708fd27e57b1b1e22d9051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f01021234041061e1206d2c2b46e079eb775f41fc72190c0402a0fff8 20202021 3840 + ./chip-tool pairing ble-wifi 20202021 3840 disabled: true - label: @@ -51,6 +52,38 @@ tests: CHIP:SC: Received PBKDF param response disabled: true + - label: + "Step 2a: Commissioner reads General Commissioning cluster attribute + SupportsConcurrentConnection" + verification: | + Verify in TH(CHIP-TOOL) + CHIP:DMG: AttributeReportIB = + CHIP:DMG: { + CHIP:DMG: AttributeDataIB = + CHIP:DMG: { + CHIP:DMG: DataVersion = 0xb0556660, + CHIP:DMG: AttributePathIB = + CHIP:DMG: { + CHIP:DMG: Endpoint = 0x0, + CHIP:DMG: Cluster = 0x30, + CHIP:DMG: Attribute = 0x0000_0004, + CHIP:DMG: } + CHIP:DMG: + CHIP:DMG: Data = false, + CHIP:DMG: }, + CHIP:DMG: + CHIP:DMG: }, + CHIP:DMG: + CHIP:DMG: ], + CHIP:DMG: + CHIP:DMG: SuppressResponse = true, + CHIP:DMG: InteractionModelRevision = 11 + CHIP:DMG: } + CHIP:CTL: ----- NetworkCommissioning Features: has WiFi. endpointid = 0 + CHIP:SVR: OnReadCommissioningInfo - vendorId=0xFFF1 productId=0x8001 + CHIP:CTL: Successfully finished commissioning step 'ReadCommissioningInfo2' + disabled: true + - label: "Step 3: Commissioner SHALL re-arm Fail-safe timer on Commissionee within 60s (the autonomously Fail-safe timer length set by @@ -76,63 +109,68 @@ tests: OperationalCSRRequest command" verification: | Verify in TH(CHIP-TOOL) - - CHIP:CTL: Sending CSR request to 0xffffa4001730 device + CHIP:CTL: Sending CSR request to 0xffff7fe56480 device CHIP:DMG: ICR moving to [AddingComm] CHIP:DMG: ICR moving to [AddedComma] - CHIP:IN: Prepared secure message 0xffffb9ba6db8 to 0x0000000000000001 (1) of type 0x8 and protocolId (0, 1) on exchange 45042i with MessageCounter:12011388. - CHIP:IN: Sending encrypted msg 0xffffb9ba6db8 with MessageCounter:12011388 to 0x0000000000000001 (1) at monotonic time: 304120 msec - CHIP:DMG: ICR moving to [CommandSen] + CHIP:EM: <<< [E:11057i S:28473 M:98750543] (S) Msg TX to 0:FFFFFFFB00000000 [0000] [BLE] --- Type 0001:08 (IM:InvokeCommandRequest) + CHIP:DMG: ICR moving to [AwaitingRe] CHIP:CTL: Sent CSR request, waiting for the CSR CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DL: Long dispatch time: 118 ms, for event type 16389 CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - CHIP:DL: Indication received, conn = 0xffffb0044210 + CHIP:DL: Indication received, conn = 0xffff81218b30 CHIP:DL: HandlePlatformSpecificBLEEvent 16389 - CHIP:DL: Indication received, conn = 0xffffb0044210 + CHIP:DL: Indication received, conn = 0xffff81218b30 CHIP:DL: HandlePlatformSpecificBLEEvent 16389 - CHIP:EM: Received message of type 0x9 with protocolId (0, 1) and MessageCounter:8508040 on exchange 45042i - CHIP:EM: Found matching exchange: 45042i, Delegate: 0xffffb0040000 + CHIP:EM: >>> [E:11057i S:28473 M:31913565] (S) Msg RX from 0:FFFFFFFB00000000 [0000] --- Type 0001:09 (IM:InvokeCommandResponse) + CHIP:EM: Found matching exchange: 11057i, Delegate: 0xffff78c217c8 CHIP:DMG: ICR moving to [ResponseRe] CHIP:DMG: InvokeResponseMessage = CHIP:DMG: { - CHIP:DMG: suppressResponse = false, - CHIP:DMG: InvokeResponseIBs = - CHIP:DMG: [ - CHIP:DMG: InvokeResponseIB = - CHIP:DMG: { - CHIP:DMG: CommandDataIB = - CHIP:DMG: { - CHIP:DMG: CommandPathIB = - CHIP:DMG: { - CHIP:DMG: EndpointId = 0x0, - CHIP:DMG: ClusterId = 0x3e, - CHIP:DMG: CommandId = 0x5, - CHIP:DMG: }, + CHIP:DMG: suppressResponse = false, + CHIP:DMG: InvokeResponseIBs = + CHIP:DMG: [ + CHIP:DMG: InvokeResponseIB = + CHIP:DMG: { + CHIP:DMG: CommandDataIB = + CHIP:DMG: { + CHIP:DMG: CommandPathIB = + CHIP:DMG: { + CHIP:DMG: EndpointId = 0x0, + CHIP:DMG: ClusterId = 0x3e, + CHIP:DMG: CommandId = 0x5, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: CommandData = - CHIP:DMG: { - CHIP:DMG: 0x0 = [ - CHIP:DMG: 0x15, 0x30, 0x1, 0xcd, 0x30, 0x81, 0xca, 0x30, 0x70, 0x2, 0x1, 0x0, 0x30, 0xe, 0x31, 0xc, 0x30, 0xa, 0x6, 0x3, 0x55, 0x4, 0xa, 0xc, 0x3, 0x43, 0x53, 0x52, 0x30, 0x59, 0x30, 0x13, 0x6, 0x7, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x2, 0x1, 0x6, 0x8, 0x2a, 0x86 - CHIP:DMG: ] - CHIP:DMG: 0x1 = [ - CHIP:DMG: 0xea, 0xd6, 0x96, 0x53, 0x4d, 0x46, 0x1d, 0xd6, 0xcc, 0x7f, 0x25, 0x50, 0x80, 0x4c, 0x2a, 0xe9, 0xc8, 0xb8, 0x1b, 0x34, 0xca, 0x98, 0x38, 0x42, 0x74, 0xc2, 0x13, 0xf4, 0x10, 0x4d, 0xa2, 0x44, 0x38, 0x98, 0x28, 0xb6, 0xb1, 0x94, 0x6b, 0xd, 0x29, 0x1b - CHIP:DMG: ] - CHIP:DMG: }, - CHIP:DMG: }, + CHIP:DMG: CommandFields = + CHIP:DMG: { + CHIP:DMG: 0x0 = [ + CHIP:DMG: 0x15, 0x30, 0x01, 0xca, 0x30, 0x81, 0xc7, 0x30, 0x70, 0x02, 0x01, 0x00, 0x30, 0x0e, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x03, 0x43, 0x53, 0x52, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xf1, 0xa2, 0x66, 0x01, 0xf7, 0xec, 0x41, 0x11, 0x82, 0x3f, 0xf6, 0x8f, 0x94, 0xe6, 0xeb, 0xe6, 0x6e, 0x6b, 0xbb, 0x2b, 0xad, 0x19, 0x7e, 0xb8, 0x11, 0xbb, 0xc8, 0xc8, 0xf8, 0x59, 0x73, 0x10, 0xd7, 0xff, 0x61, 0x01, 0x0e, 0x7d, 0x50, 0x6e, 0x9d, 0x66, 0xd3, 0x89, 0x83, 0x84, 0xfe, 0xe0, 0xee, 0x7b, 0xbf, 0xaa, 0xa6, 0x3c, 0x60, 0x0a, 0x8e, 0xda, 0xb1, 0xfc, 0xa4, 0xf5, 0xf2, 0xcb, 0xa0, 0x00, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0x23, 0x94, 0xd8, 0xc4, 0x00, 0x9a, 0xec, 0x9c, 0x0e, 0x11, 0x26, 0x7f, 0x9e, 0xea, 0x7b, 0xe3, 0x83, 0xde, 0xf8, 0xd3, 0xd3, 0xe7, 0x31, 0xeb, 0x3c, 0xf5, 0x73, 0x65, 0xcd, 0xd8, 0xc0, 0x48, 0x02, 0x20, 0x63, 0x5a, 0x67, 0x85, 0x71, 0xa9, 0x50, 0x30, 0x8e, 0x4c, 0x00, 0x0e, 0x65, 0x1e, 0x59, 0x53, 0x85, 0xb2, 0x6f, 0x5a, 0x01, 0x46, 0xda, 0xb5, 0x27, 0xea, 0x6b, 0x5c, 0x8a, 0x82, 0x48, 0x5e, 0x30, 0x02, 0x20, 0x08, 0x9b, 0x9c, 0xe3, 0xa4, 0xfd, 0xdb, 0xc5, 0xbd, 0x78, 0x36, 0x7c, 0x47, 0xd9, 0xaf, 0x57, 0x22, 0x5a, 0x70, 0xa8, 0x14, 0x86, 0xdd, 0xea, 0x1b, 0x44, 0x80, 0xbd, 0x39, 0x4f, 0xca, 0x76, 0x18, + CHIP:DMG: ] (242 bytes) + CHIP:DMG: 0x1 = [ + CHIP:DMG: 0xc1, 0xa1, 0xf7, 0xba, 0xe4, 0x5f, 0xd5, 0x62, 0x06, 0xb9, 0xe7, 0xf3, 0x64, 0x47, 0x36, 0x6f, 0xcb, 0xf5, 0x74, 0x97, 0x61, 0xf1, 0x54, 0xbc, 0x9a, 0x6c, 0x1b, 0x60, 0xa7, 0xf0, 0xb6, 0x5e, 0x9b, 0x05, 0x06, 0xd8, 0x9f, 0x0e, 0x47, 0xd9, 0x3a, 0xbf, 0x8d, 0x71, 0x61, 0xd4, 0xcf, 0xee, 0x38, 0x64, 0x0d, 0xc0, 0xf8, 0x44, 0xe7, 0x77, 0x08, 0x7d, 0x6b, 0x20, 0x1e, 0x40, 0x1f, 0x94, + CHIP:DMG: ] (64 bytes) + CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: ], + CHIP:DMG: ], CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 1 + CHIP:DMG: InteractionModelRevision = 11 CHIP:DMG: }, CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_003E Command=0x0000_0005 CHIP:CTL: Received certificate signing request from the device + CHIP:CTL: Successfully finished commissioning step 'SendOpCertSigningRequest' + CHIP:CTL: Commissioning stage next step: 'SendOpCertSigningRequest' -> 'ValidateCSR' + CHIP:CTL: Performing next commissioning step 'ValidateCSR' + CHIP:CTL: Successfully finished commissioning step 'ValidateCSR' + CHIP:CTL: Commissioning stage next step: 'ValidateCSR' -> 'GenerateNOCChain' + CHIP:CTL: Performing next commissioning step 'GenerateNOCChain' CHIP:CTL: Getting certificate chain for the device from the issuer CHIP:CTL: Verifying Certificate Signing Request CHIP:CTL: Generating NOC CHIP:CTL: Providing certificate chain to the commissioner - CHIP:CTL: Received callback from the CA for NOC Chain generation. Status ../../src/controller/ExampleOperationalCredentialsIssuer.cpp:225: Success + CHIP:CTL: Received callback from the CA for NOC Chain generation. Status src/controller/ExampleOperationalCredentialsIssuer.cpp:395: Success disabled: true - label: @@ -141,49 +179,48 @@ tests: verification: | Verify in TH(CHIP-TOOL) - [1651218829.220063][3273:3278] CHIP:CTL: Sending root certificate to the device - [1651218829.220201][3273:3278] CHIP:DMG: ICR moving to [AddingComm] - [1651218829.222415][3273:3278] CHIP:DMG: ICR moving to [AddedComma] - [1651218829.222549][3273:3278] CHIP:IN: Prepared secure message 0xffffb9ba6b98 to 0x0000000000000001 (1) of type 0x8 and protocolId (0, 1) on exchange 45043i with MessageCounter:12011389. - [1651218829.222616][3273:3278] CHIP:IN: Sending encrypted msg 0xffffb9ba6b98 with MessageCounter:12011389 to 0x0000000000000001 (1) at monotonic time: 305872 msec - [1651218829.222746][3273:3278] CHIP:DMG: ICR moving to [CommandSen] - [1651218829.222789][3273:3278] CHIP:CTL: Sent root certificate to the device - [1651218829.223121][3273:3278] CHIP:DMG: ICR moving to [AwaitingDe] - [1651218829.306861][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218829.404144][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218829.454121][3273:3276] CHIP:DL: Indication received, conn = 0xffffb0044210 - [1651218829.454352][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16389 - CHIP:EM: Received message of type 0x9 with protocolId (0, 1) and MessageCounter:8508041 on exchange 45043i - CHIP:EM: Found matching exchange: 45043i, Delegate: 0xffffa400def0 + CHIP:CTL: Sending root certificate to the device + CHIP:DMG: ICR moving to [AddingComm] + CHIP:DMG: ICR moving to [AddedComma] + CHIP:EM: <<< [E:11058i S:28473 M:98750544] (S) Msg TX to 0:FFFFFFFB00000000 [0000] [BLE] --- Type 0001:08 (IM:InvokeCommandRequest) + CHIP:DMG: ICR moving to [AwaitingRe] + CHIP:CTL: Sent root certificate to the device + CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: Indication received, conn = 0xffff81218b30 + CHIP:DL: HandlePlatformSpecificBLEEvent 16389 + CHIP:EM: >>> [E:11058i S:28473 M:31913566] (S) Msg RX from 0:FFFFFFFB00000000 [0000] --- Type 0001:09 (IM:InvokeCommandResponse) + CHIP:EM: Found matching exchange: 11058i, Delegate: 0xffff78c20b88 CHIP:DMG: ICR moving to [ResponseRe] CHIP:DMG: InvokeResponseMessage = CHIP:DMG: { - CHIP:DMG: suppressResponse = false, - CHIP:DMG: InvokeResponseIBs = - CHIP:DMG: [ - CHIP:DMG: InvokeResponseIB = - CHIP:DMG: { - CHIP:DMG: CommandStatusIB = - CHIP:DMG: { - CHIP:DMG: CommandPathIB = - CHIP:DMG: { - CHIP:DMG: EndpointId = 0x0, - CHIP:DMG: ClusterId = 0x3e, - CHIP:DMG: CommandId = 0xb, - CHIP:DMG: }, + CHIP:DMG: suppressResponse = false, + CHIP:DMG: InvokeResponseIBs = + CHIP:DMG: [ + CHIP:DMG: InvokeResponseIB = + CHIP:DMG: { + CHIP:DMG: CommandStatusIB = + CHIP:DMG: { + CHIP:DMG: CommandPathIB = + CHIP:DMG: { + CHIP:DMG: EndpointId = 0x0, + CHIP:DMG: ClusterId = 0x3e, + CHIP:DMG: CommandId = 0xb, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: StatusIB = - CHIP:DMG: { - CHIP:DMG: status = 0x0, - CHIP:DMG: }, + CHIP:DMG: StatusIB = + CHIP:DMG: { + CHIP:DMG: status = 0x00 (SUCCESS), + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: ], + CHIP:DMG: ], CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 1 + CHIP:DMG: InteractionModelRevision = 11 CHIP:DMG: }, CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003E Command=0x0000_000B Status=0x0 CHIP:CTL: Device confirmed that it has received the root certificate @@ -195,54 +232,53 @@ tests: verification: | Verify in TH(CHIP-TOOL) - [1651218829.457248][3273:3278] CHIP:CTL: Sending operational certificate chain to the device - [1651218829.457372][3273:3278] CHIP:DMG: ICR moving to [AddingComm] - [1651218829.460013][3273:3278] CHIP:DMG: ICR moving to [AddedComma] - [1651218829.460273][3273:3278] CHIP:IN: Prepared secure message 0xffffb9ba7828 to 0x0000000000000001 (1) of type 0x8 and protocolId (0, 1) on exchange 45044i with MessageCounter:12011390. - [1651218829.460374][3273:3278] CHIP:IN: Sending encrypted msg 0xffffb9ba7828 with MessageCounter:12011390 to 0x0000000000000001 (1) at monotonic time: 306110 msec - [1651218829.460602][3273:3278] CHIP:DMG: ICR moving to [CommandSen] - [1651218829.460684][3273:3278] CHIP:CTL: Sent operational certificate to the device - [1651218829.460778][3273:3278] CHIP:DMG: ICR moving to [AwaitingDe] - [1651218829.550574][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218829.648065][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218829.745594][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218833.988087][3273:3276] CHIP:DL: Indication received, conn = 0xffffb0044210 - [1651218833.988336][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16389 - [1651218833.988598][3273:3278] CHIP:EM: Received message of type 0x9 with protocolId (0, 1) and MessageCounter:8508042 on exchange 45044i - CHIP:EM: Found matching exchange: 45044i, Delegate: 0xffffb0040000 + CHIP:CTL: Performing next commissioning step 'SendNOC' + CHIP:DMG: ICR moving to [AddingComm] + CHIP:DMG: ICR moving to [AddedComma] + CHIP:EM: <<< [E:11059i S:28473 M:98750545] (S) Msg TX to 0:FFFFFFFB00000000 [0000] [BLE] --- Type 0001:08 (IM:InvokeCommandRequest) + CHIP:DMG: ICR moving to [AwaitingRe] + CHIP:CTL: Sent operational certificate to the device + CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: Indication received, conn = 0xffff81218b30 + CHIP:DL: HandlePlatformSpecificBLEEvent 16389 + CHIP:EM: >>> [E:11059i S:28473 M:31913567] (S) Msg RX from 0:FFFFFFFB00000000 [0000] --- Type 0001:09 (IM:InvokeCommandResponse) + CHIP:EM: Found matching exchange: 11059i, Delegate: 0xffff78c209c8 CHIP:DMG: ICR moving to [ResponseRe] CHIP:DMG: InvokeResponseMessage = CHIP:DMG: { - CHIP:DMG: suppressResponse = false, - CHIP:DMG: InvokeResponseIBs = - CHIP:DMG: [ - CHIP:DMG: InvokeResponseIB = - CHIP:DMG: { - CHIP:DMG: CommandDataIB = - CHIP:DMG: { - CHIP:DMG: CommandPathIB = - CHIP:DMG: { - CHIP:DMG: EndpointId = 0x0, - CHIP:DMG: ClusterId = 0x3e, - CHIP:DMG: CommandId = 0x8, - CHIP:DMG: }, + CHIP:DMG: suppressResponse = false, + CHIP:DMG: InvokeResponseIBs = + CHIP:DMG: [ + CHIP:DMG: InvokeResponseIB = + CHIP:DMG: { + CHIP:DMG: CommandDataIB = + CHIP:DMG: { + CHIP:DMG: CommandPathIB = + CHIP:DMG: { + CHIP:DMG: EndpointId = 0x0, + CHIP:DMG: ClusterId = 0x3e, + CHIP:DMG: CommandId = 0x8, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: CommandData = - CHIP:DMG: { - CHIP:DMG: 0x0 = 0, - CHIP:DMG: 0x1 = 1, - CHIP:DMG: }, - CHIP:DMG: }, + CHIP:DMG: CommandFields = + CHIP:DMG: { + CHIP:DMG: 0x0 = 0, + CHIP:DMG: 0x1 = 1, + CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: ], + CHIP:DMG: ], CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 1 + CHIP:DMG: InteractionModelRevision = 11 CHIP:DMG: }, CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_003E Command=0x0000_0008 CHIP:CTL: Device returned status 0 on receiving the NOC - CHIP:CTL: Operational credentials provisioned on device 0xffffa4001730 + CHIP:CTL: Operational credentials provisioned on device 0xffff7fe56480 disabled: true - label: @@ -251,50 +287,49 @@ tests: verification: | Verify in TH(CHIP-TOOL) - [1651218833.995054][3273:3278] CHIP:CTL: Adding thread network - [1651218833.995176][3273:3278] CHIP:DMG: ICR moving to [AddingComm] - [1651218833.995253][3273:3278] CHIP:DMG: ICR moving to [AddedComma] - [1651218833.995431][3273:3278] CHIP:IN: Prepared secure message 0xffffb9ba7848 to 0x0000000000000001 (1) of type 0x8 and protocolId (0, 1) on exchange 45045i with MessageCounter:12011391. - [1651218833.995523][3273:3278] CHIP:IN: Sending encrypted msg 0xffffb9ba7848 with MessageCounter:12011391 to 0x0000000000000001 (1) at monotonic time: 310645 msec - [1651218833.995723][3273:3278] CHIP:DMG: ICR moving to [CommandSen] - [1651218833.995823][3273:3278] CHIP:DMG: ICR moving to [AwaitingDe] - [1651218834.084548][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218834.134690][3273:3276] CHIP:DL: Indication received, conn = 0xffffb0044210 - [1651218834.134918][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16389 - CHIP:EM: Received message of type 0x9 with protocolId (0, 1) and MessageCounter:8508043 on exchange 45045i - CHIP:EM: Found matching exchange: 45045i, Delegate: 0xffffa400def0 + CHIP:CTL: Performing next commissioning step 'WiFiNetworkSetup' + CHIP:DMG: ICR moving to [AddingComm] + CHIP:DMG: ICR moving to [AddedComma] + CHIP:EM: <<< [E:11060i S:28473 M:98750546] (S) Msg TX to 0:FFFFFFFB00000000 [0000] [BLE] --- Type 0001:08 (IM:InvokeCommandRequest) + CHIP:DMG: ICR moving to [AwaitingRe] + CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: Indication received, conn = 0xffff81218b30 + CHIP:DL: HandlePlatformSpecificBLEEvent 16389 + CHIP:EM: >>> [E:11060i S:28473 M:31913568] (S) Msg RX from 0:FFFFFFFB00000000 [0000] --- Type 0001:09 (IM:InvokeCommandResponse) + CHIP:EM: Found matching exchange: 11060i, Delegate: 0xffff78c20808 CHIP:DMG: ICR moving to [ResponseRe] CHIP:DMG: InvokeResponseMessage = CHIP:DMG: { - CHIP:DMG: suppressResponse = false, - CHIP:DMG: InvokeResponseIBs = - CHIP:DMG: [ - CHIP:DMG: InvokeResponseIB = - CHIP:DMG: { - CHIP:DMG: CommandDataIB = - CHIP:DMG: { - CHIP:DMG: CommandPathIB = - CHIP:DMG: { - CHIP:DMG: EndpointId = 0x0, - CHIP:DMG: ClusterId = 0x31, - CHIP:DMG: CommandId = 0x5, - CHIP:DMG: }, + CHIP:DMG: suppressResponse = false, + CHIP:DMG: InvokeResponseIBs = + CHIP:DMG: [ + CHIP:DMG: InvokeResponseIB = + CHIP:DMG: { + CHIP:DMG: CommandDataIB = + CHIP:DMG: { + CHIP:DMG: CommandPathIB = + CHIP:DMG: { + CHIP:DMG: EndpointId = 0x0, + CHIP:DMG: ClusterId = 0x31, + CHIP:DMG: CommandId = 0x5, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: CommandData = - CHIP:DMG: { - CHIP:DMG: 0x0 = 0, - CHIP:DMG: 0x1 = "", - CHIP:DMG: }, - CHIP:DMG: }, + CHIP:DMG: CommandFields = + CHIP:DMG: { + CHIP:DMG: 0x0 = 0, + CHIP:DMG: 0x2 = 0, + CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: ], + CHIP:DMG: ], CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 1 + CHIP:DMG: InteractionModelRevision = 11 CHIP:DMG: }, CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0031 Command=0x0000_0005 - CHIP:CTL: Received NetworkConfig response + CHIP:CTL: Received NetworkConfig response, networkingStatus=0 disabled: true - label: @@ -303,118 +338,124 @@ tests: verification: | Verify in TH(CHIP-TOOL) - [1651218834.137891][3273:3278] CHIP:CTL: Enabling thread network - [1651218834.138014][3273:3278] CHIP:DMG: ICR moving to [AddingComm] - [1651218834.138086][3273:3278] CHIP:DMG: ICR moving to [AddedComma] - [1651218834.138236][3273:3278] CHIP:IN: Prepared secure message 0xffffb9ba7938 to 0x0000000000000001 (1) of type 0x8 and protocolId (0, 1) on exchange 45046i with MessageCounter:12011392. - [1651218834.138325][3273:3278] CHIP:IN: Sending encrypted msg 0xffffb9ba7938 with MessageCounter:12011392 to 0x0000000000000001 (1) at monotonic time: 310788 msec - [1651218834.138522][3273:3278] CHIP:DMG: ICR moving to [CommandSen] - [1651218834.138628][3273:3278] CHIP:DMG: ICR moving to [AwaitingDe] - [1651218834.231701][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16387 - [1651218834.426948][3273:3276] CHIP:DL: Indication received, conn = 0xffffb0044210 - [1651218834.427186][3273:3278] CHIP:DL: HandlePlatformSpecificBLEEvent 16389 - [1651218834.427443][3273:3278] CHIP:EM: Received message of type 0x9 with protocolId (0, 1) and MessageCounter:8508044 on exchange 45046i - CHIP:EM: Found matching exchange: 45046i, Delegate: 0xffffb0040000 + CHIP:CTL: SendCommand kWiFiNetworkEnable, supportsConcurrentConnection=0 + CHIP:DMG: ICR moving to [AddingComm] + CHIP:DMG: ICR moving to [AddedComma] + CHIP:EM: <<< [E:11062i S:28473 M:98750548] (S) Msg TX to 0:FFFFFFFB00000000 [0000] [BLE] --- Type 0001:08 (IM:InvokeCommandRequest) + CHIP:DMG: ICR moving to [AwaitingRe] + CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DL: Indication received, conn = 0xffff81218b30 + CHIP:DL: HandlePlatformSpecificBLEEvent 16389 + CHIP:EM: >>> [E:11062i S:28473 M:31913570] (S) Msg RX from 0:FFFFFFFB00000000 [0000] --- Type 0001:09 (IM:InvokeCommandResponse) + CHIP:EM: Found matching exchange: 11062i, Delegate: 0xffff78c20488 CHIP:DMG: ICR moving to [ResponseRe] CHIP:DMG: InvokeResponseMessage = CHIP:DMG: { - CHIP:DMG: suppressResponse = false, - CHIP:DMG: InvokeResponseIBs = - CHIP:DMG: [ - CHIP:DMG: InvokeResponseIB = - CHIP:DMG: { - CHIP:DMG: CommandDataIB = - CHIP:DMG: { - CHIP:DMG: CommandPathIB = - CHIP:DMG: { - CHIP:DMG: EndpointId = 0x0, - CHIP:DMG: ClusterId = 0x31, - CHIP:DMG: CommandId = 0x7, - CHIP:DMG: }, + CHIP:DMG: suppressResponse = false, + CHIP:DMG: InvokeResponseIBs = + CHIP:DMG: [ + CHIP:DMG: InvokeResponseIB = + CHIP:DMG: { + CHIP:DMG: CommandDataIB = + CHIP:DMG: { + CHIP:DMG: CommandPathIB = + CHIP:DMG: { + CHIP:DMG: EndpointId = 0x0, + CHIP:DMG: ClusterId = 0x31, + CHIP:DMG: CommandId = 0x7, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: CommandData = - CHIP:DMG: { - CHIP:DMG: 0x0 = 0, - CHIP:DMG: 0x1 = "", - CHIP:DMG: 0x2 = 0, - CHIP:DMG: }, - CHIP:DMG: }, + CHIP:DMG: CommandFields = + CHIP:DMG: { + CHIP:DMG: 0x0 = 0, + CHIP:DMG: 0x2 = NULL + CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: }, + CHIP:DMG: }, CHIP:DMG: - CHIP:DMG: ], + CHIP:DMG: ], CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 1 + CHIP:DMG: InteractionModelRevision = 11 CHIP:DMG: }, CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0031 Command=0x0000_0007 - CHIP:CTL: Received ConnectNetwork response + CHIP:CTL: Received ConnectNetwork response, networkingStatus=0 disabled: true - label: "Step 10: Commissioning channel between the Commissioner and - Commissionee is terminated." + Commissionee is closed." + verification: | + Cannot be verified in TH(CHIP-TOOL) + disabled: true + + - label: "Step 11: Commissionee starts the operational channel." verification: | - 1. Terminate the connection between the Commissionee and the Commissioner. (i.e. remove network access or terminate commissioning process) + Verify in TH(CHIP-TOOL) + + Inferred by successful completion of Step 12 disabled: true - label: - "Step 11: Commissioner starts discovery of DUT using Operational + "Step 12: Commissioner starts discovery of DUT using Operational Discovery" verification: | Verify in TH(CHIP-TOOL) - CHIP:DL: Avahi resolve found - CHIP:DIS: Node ID resolved for 0x0000000000000001 - CHIP:DIS: Addr 0: [fd11:22::9d96:8fcf:10cf:799e]:5540 - CHIP:CTL: OperationalDiscoveryComplete for device ID 0x0000000000000001 + CHIP:CTL: Performing next commissioning step 'FindOperational' + CHIP:IN: Expiring all sessions for node <00000000000007CE, 1>!! + CHIP:CSM: FindOrEstablishSession: PeerId = [1:00000000000007CE] + CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 1 --> 2 + CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DIS: Checking node lookup status after 200 ms + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DIS: UDP:[fe80::e65f:1ff:fec2:47af%eth0]:5540: new best score: 7 + CHIP:DIS: Lookup clearing interface for non LL address + CHIP:DIS: UDP:172.16.62.113%eth0:5540: new best score: 2 + CHIP:DIS: Checking node lookup status after 7151 ms + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: Updating device address to UDP:[fe80::e65f:1ff:fec2:47af%eth0]:5540 while in state 2 + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 2 --> 3 + CHIP:IN: SecureSession[0xffff7902f2c0]: Allocated Type:2 LSID:28474 disabled: true - label: - "Step 12: Commissioner opens a CASE session with DUT over operational + "Step 13: Commissioner opens a CASE session with DUT over operational network" verification: | Verify in TH(CHIP-TOOL) CHIP:SC: Sent Sigma1 msg - CHIP:CTL: Address resolved for node: 0x0000000000000001 - CHIP:EM: Received message of type 0x31 with protocolId (0, 0) and MessageCounter:1066460336 on exchange 45047i - CHIP:EM: Found matching exchange: 45047i, Delegate: 0xffffa400f7f8 - CHIP:EM: Rxd Ack; Removing MessageCounter:2352378411 from Retrans Table on exchange 45047i - CHIP:EM: Removed CHIP MessageCounter:2352378411 from RetransTable on exchange 45047i + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 3 --> 4 + CHIP:EM: Retransmitting MessageCounter:226454874 on exchange 11063i Send Cnt 1 + CHIP:EM: Retransmitting MessageCounter:226454874 on exchange 11063i Send Cnt 2 + CHIP:EM: Retransmitting MessageCounter:226454874 on exchange 11063i Send Cnt 3 + CHIP:EM: >>> [E:11063i S:0 M:192590746 (Ack:226454874)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:31 (SecureChannel:CASE_Sigma2) + CHIP:EM: Found matching exchange: 11063i, Delegate: 0xffff78207b08 + CHIP:EM: Rxd Ack; Removing MessageCounter:226454874 from Retrans Table on exchange 11063i CHIP:SC: Received Sigma2 msg - CHIP:SC: Peer assigned session session ID 2 - CHIP:SC: The device does not support GetClock_RealTimeMS() API. This will eventually result in CASE session setup failures. - CHIP:IN: Generating compressed fabric ID using uncompressed fabric ID 0x0000000000000001 and root pubkey - CHIP:IN: 0x04, 0x6e, 0x3e, 0x58, 0x9d, 0x08, 0xd6, 0xae, - CHIP:IN: 0xe9, 0xff, 0x9b, 0x8f, 0xba, 0x6f, 0x57, 0x73, - CHIP:IN: 0x21, 0xc4, 0xe2, 0x7b, 0x09, 0xe4, 0x24, 0x7f, - CHIP:IN: 0x55, 0x44, 0x3b, 0xf2, 0x7c, 0x13, 0x45, 0x3b, - CHIP:IN: 0x82, 0xa8, 0x42, 0x96, 0xb4, 0x36, 0x78, 0x20, - CHIP:IN: 0xa1, 0x37, 0x69, 0xf0, 0x20, 0xc9, 0x20, 0x7e, - CHIP:IN: 0x66, 0x45, 0x84, 0x53, 0x1b, 0x3e, 0xd2, 0x61, - CHIP:IN: 0xb6, 0x89, 0x27, 0xfd, 0xe8, 0x23, 0x69, 0x6d, - CHIP:IN: 0x93, - CHIP:IN: Generated compressed fabric ID - CHIP:IN: 0xa3, 0x54, 0xab, 0x2a, 0xa2, 0x1f, 0x8e, 0x48, + CHIP:SC: Peer assigned session session ID 24240 CHIP:SC: Found MRP parameters in the message CHIP:SC: Sending Sigma3 - CHIP:EM: Piggybacking Ack for MessageCounter:1066460336 on exchange: 45047i - CHIP:IN: Prepared unauthenticated message 0xaaaad7ce1bf8 to 0x0000000000000000 (0) of type 0x32 and protocolId (0, 0) on exchange 45047i with MessageCounter:2352378412. - CHIP:IN: Sending unauthenticated msg 0xaaaad7ce1bf8 with MessageCounter:2352378412 to 0x0000000000000000 at monotonic time: 315803 msec + CHIP:EM: <<< [E:11063i S:0 M:226454875 (Ack:192590746)] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::e65f:1ff:fec2:47af%eth0]:5540] --- Type 0000:32 (SecureChannel:CASE_Sigma3) CHIP:SC: Sent Sigma3 msg - CHIP:EM: Received message of type 0x40 with protocolId (0, 0) and MessageCounter:1066460337 on exchange 45047i - CHIP:EM: Found matching exchange: 45047i, Delegate: 0xffffa400f7f8 - CHIP:EM: Rxd Ack; Removing MessageCounter:2352378412 from Retrans Table on exchange 45047i - CHIP:EM: Removed CHIP MessageCounter:2352378412 from RetransTable on exchange 45047i + CHIP:EM: >>> [E:11063i S:0 M:192590747 (Ack:226454875)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:40 (SecureChannel:StatusReport) + CHIP:EM: Found matching exchange: 11063i, Delegate: 0xffff78207b08 + CHIP:EM: Rxd Ack; Removing MessageCounter:226454875 from Retrans Table on exchange 11063i CHIP:SC: Success status report received. Session was established - CHIP:IN: New secure session created for device 0x0000000000000001, LSID:2 PSID:2! + CHIP:SC: SecureSession[0xffff7902f2c0, LSID:28474]: State change 'kEstablishing' --> 'kActive' + CHIP:IN: SecureSession[0xffff7902f2c0]: Activated - Type:2 LSID:28474 + CHIP:IN: New secure session activated for device <00000000000007CE, 1>, LSID:28474 PSID:24240! + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 4 --> 5 + CHIP:CTL: Successfully finished commissioning step 'FindOperational' disabled: true - - label: "Step 13: Commissioner sends CommissioningComplete command" + - label: "Step 14: Commissioner sends CommissioningComplete command" verification: | Verify in TH(CHIP-TOOL) - CHIP:CTL: Received CommissioningComplete response - CHIP:CTL: Rendezvous cleanup - CHIP:TOO: Device commissioning completed with success + CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0030 Command=0x0000_0005 + CHIP:CTL: Received CommissioningComplete response, errorCode=0 + CHIP:CTL: Successfully finished commissioning step 'SendComplete' disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_DD_3_6.yaml b/src/app/tests/suites/certification/Test_TC_DD_3_6.yaml index 674808bfabb520..ad24d09cbbb9f8 100644 --- a/src/app/tests/suites/certification/Test_TC_DD_3_6.yaml +++ b/src/app/tests/suites/certification/Test_TC_DD_3_6.yaml @@ -28,6 +28,7 @@ tests: - label: "Note" verification: | Chip-tool command used below are an example to verify the DUT as commissioner test cases. For certification test, we expect DUT should have a capability or way to run the equivalent command. + Test Harness is a Commissionee device that is not connected to an operational network (i.e. Wi-Fi, or Ethernet) and is configured as a Non-concurrent device. disabled: true - label: "Preconditions" @@ -50,9 +51,11 @@ tests: verification: | Verify in TH (ALL-CLUSTER-APP) start BLE Advertising by specific DUT implementation - Verify in DUT(CHIP-TOOL) start commissioning process(need to obtain the Thread dataset first) + Verify in DUT(CHIP-TOOL) start commissioning process (either Thread or WiFi) ./chip-tool pairing ble-thread 1 hex:0e080000000000010000000300000f35060004001fffe0020811111111222222220708fd27e57b1b1e22d9051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f01021234041061e1206d2c2b46e079eb775f41fc72190c0402a0fff8 20202021 3840 + ./chip-tool pairing ble-wifi 20202021 3840 + disabled: true - label: @@ -64,6 +67,30 @@ tests: CHIP:SC: Received PBKDF param response disabled: true + - label: + "Step 3a: Commissioner reads commissioning information, including + SupportsConcurrentConnection attribute from General Commissioining + Cluster" + verification: | + Verify in TH that SupportsConcurrentConnection is false + + CHIP:IM: Received Read request + CHIP:DMG: ReadRequestMessage = + CHIP:DMG: { + CHIP:DMG: AttributePathIBs = + CHIP:DMG: [ + CHIP:DMG: AttributePathIB = + CHIP:DMG: { + CHIP:DMG: Endpoint = 0x0, + CHIP:DMG: Cluster = 0x30, + CHIP:DMG: Attribute = 0x0000_0004, + CHIP:DMG: } + CHIP:DMG: + CHIP:DMG: isFabricFiltered = false, + CHIP:DMG: InteractionModelRevision = 11 + CHIP:DMG: }, + disabled: true + - label: "Step 4: Commissioner SHALL re-arm Fail-safe timer on Commissionee within 60s (the autonomously Fail-safe timer length set by @@ -370,15 +397,9 @@ tests: - label: "Step 11: Commissioning channel between the Commissioner and - Commissionee is terminated." + Commissionee is closed, operational channel started." verification: | - Verify the channel was terminated on DUT as commissioner side: - [1651271753284] [23287:743790] CHIP: [CTL] Received CommissioningComplete response - [1651271753284] [23287:743790] CHIP: [CTL] Successfully finished commissioning step 'SendComplete' - [1651271753284] [23287:743790] CHIP: [CTL] Commissioning stage next step: 'SendComplete' -> 'Cleanup' - [1651271753284] [23287:743790] CHIP: [CTL] Performing next commissioning step 'Cleanup' - [1651271753284] [23287:743790] CHIP: [CTL] Successfully finished commissioning step 'Cleanup' - [1651271753284] [23287:743790] CHIP: [TOO] Device commissioning completed with success + Inferred by successful completion of Step 12 disabled: true - label: @@ -387,10 +408,21 @@ tests: verification: | Verify in DUT as commissioner side - CHIP:DL: Avahi resolve found - CHIP:DIS: Node ID resolved for 0x0000000000000001 - CHIP:DIS: Addr 0: [fd11:22::9d96:8fcf:10cf:799e]:5540 - CHIP:CTL: OperationalDiscoveryComplete for device ID 0x0000000000000001 + CHIP:CTL: Performing next commissioning step 'FindOperational' + CHIP:IN: Expiring all sessions for node <00000000000007CE, 1>!! + CHIP:CSM: FindOrEstablishSession: PeerId = [1:00000000000007CE] + CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 1 --> 2 + CHIP:DMG: ICR moving to [AwaitingDe] + CHIP:DIS: Checking node lookup status after 200 ms + CHIP:DL: HandlePlatformSpecificBLEEvent 16387 + CHIP:DIS: UDP:[fe80::e65f:1ff:fec2:47af%eth0]:5540: new best score: 7 + CHIP:DIS: Lookup clearing interface for non LL address + CHIP:DIS: UDP:172.16.62.113%eth0:5540: new best score: 2 + CHIP:DIS: Checking node lookup status after 7151 ms + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: Updating device address to UDP:[fe80::e65f:1ff:fec2:47af%eth0]:5540 while in state 2 + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 2 --> 3 + CHIP:IN: SecureSession[0xffff7902f2c0]: Allocated Type:2 LSID:28474 disabled: true - label: @@ -400,45 +432,35 @@ tests: Verify in DUT as commissioner side CHIP:SC: Sent Sigma1 msg - CHIP:CTL: Address resolved for node: 0x0000000000000001 - CHIP:EM: Received message of type 0x31 with protocolId (0, 0) and MessageCounter:1066460336 on exchange 45047i - CHIP:EM: Found matching exchange: 45047i, Delegate: 0xffffa400f7f8 - CHIP:EM: Rxd Ack; Removing MessageCounter:2352378411 from Retrans Table on exchange 45047i - CHIP:EM: Removed CHIP MessageCounter:2352378411 from RetransTable on exchange 45047i + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 3 --> 4 + CHIP:EM: Retransmitting MessageCounter:226454874 on exchange 11063i Send Cnt 1 + CHIP:EM: Retransmitting MessageCounter:226454874 on exchange 11063i Send Cnt 2 + CHIP:EM: Retransmitting MessageCounter:226454874 on exchange 11063i Send Cnt 3 + CHIP:EM: >>> [E:11063i S:0 M:192590746 (Ack:226454874)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:31 (SecureChannel:CASE_Sigma2) + CHIP:EM: Found matching exchange: 11063i, Delegate: 0xffff78207b08 + CHIP:EM: Rxd Ack; Removing MessageCounter:226454874 from Retrans Table on exchange 11063i CHIP:SC: Received Sigma2 msg - CHIP:SC: Peer assigned session session ID 2 - CHIP:SC: The device does not support GetClock_RealTimeMS() API. This will eventually result in CASE session setup failures. - CHIP:IN: Generating compressed fabric ID using uncompressed fabric ID 0x0000000000000001 and root pubkey - CHIP:IN: 0x04, 0x6e, 0x3e, 0x58, 0x9d, 0x08, 0xd6, 0xae, - CHIP:IN: 0xe9, 0xff, 0x9b, 0x8f, 0xba, 0x6f, 0x57, 0x73, - CHIP:IN: 0x21, 0xc4, 0xe2, 0x7b, 0x09, 0xe4, 0x24, 0x7f, - CHIP:IN: 0x55, 0x44, 0x3b, 0xf2, 0x7c, 0x13, 0x45, 0x3b, - CHIP:IN: 0x82, 0xa8, 0x42, 0x96, 0xb4, 0x36, 0x78, 0x20, - CHIP:IN: 0xa1, 0x37, 0x69, 0xf0, 0x20, 0xc9, 0x20, 0x7e, - CHIP:IN: 0x66, 0x45, 0x84, 0x53, 0x1b, 0x3e, 0xd2, 0x61, - CHIP:IN: 0xb6, 0x89, 0x27, 0xfd, 0xe8, 0x23, 0x69, 0x6d, - CHIP:IN: 0x93, - CHIP:IN: Generated compressed fabric ID - CHIP:IN: 0xa3, 0x54, 0xab, 0x2a, 0xa2, 0x1f, 0x8e, 0x48, + CHIP:SC: Peer assigned session session ID 24240 CHIP:SC: Found MRP parameters in the message CHIP:SC: Sending Sigma3 - CHIP:EM: Piggybacking Ack for MessageCounter:1066460336 on exchange: 45047i - CHIP:IN: Prepared unauthenticated message 0xaaaad7ce1bf8 to 0x0000000000000000 (0) of type 0x32 and protocolId (0, 0) on exchange 45047i with MessageCounter:2352378412. - CHIP:IN: Sending unauthenticated msg 0xaaaad7ce1bf8 with MessageCounter:2352378412 to 0x0000000000000000 at monotonic time: 315803 msec + CHIP:EM: <<< [E:11063i S:0 M:226454875 (Ack:192590746)] (U) Msg TX to 0:0000000000000000 [0000] [UDP:[fe80::e65f:1ff:fec2:47af%eth0]:5540] --- Type 0000:32 (SecureChannel:CASE_Sigma3) CHIP:SC: Sent Sigma3 msg - CHIP:EM: Received message of type 0x40 with protocolId (0, 0) and MessageCounter:1066460337 on exchange 45047i - CHIP:EM: Found matching exchange: 45047i, Delegate: 0xffffa400f7f8 - CHIP:EM: Rxd Ack; Removing MessageCounter:2352378412 from Retrans Table on exchange 45047i - CHIP:EM: Removed CHIP MessageCounter:2352378412 from RetransTable on exchange 45047i + CHIP:EM: >>> [E:11063i S:0 M:192590747 (Ack:226454875)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:40 (SecureChannel:StatusReport) + CHIP:EM: Found matching exchange: 11063i, Delegate: 0xffff78207b08 + CHIP:EM: Rxd Ack; Removing MessageCounter:226454875 from Retrans Table on exchange 11063i CHIP:SC: Success status report received. Session was established - CHIP:IN: New secure session created for device 0x0000000000000001, LSID:2 PSID:2! + CHIP:SC: SecureSession[0xffff7902f2c0, LSID:28474]: State change 'kEstablishing' --> 'kActive' + CHIP:IN: SecureSession[0xffff7902f2c0]: Activated - Type:2 LSID:28474 + CHIP:IN: New secure session activated for device <00000000000007CE, 1>, LSID:28474 PSID:24240! + CHIP:DIS: OperationalSessionSetup[1:00000000000007CE]: State change 4 --> 5 + CHIP:CTL: Successfully finished commissioning step 'FindOperational' disabled: true disabled: true - label: "Step 14: Commissioner sends CommissioningComplete command" verification: | Verify in DUT as commissioner side - CHIP:CTL: Received CommissioningComplete response - CHIP:CTL: Rendezvous cleanup - CHIP:TOO: Device commissioning completed with success + CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0030 Command=0x0000_0005 + CHIP:CTL: Received CommissioningComplete response, errorCode=0 + CHIP:CTL: Successfully finished commissioning step 'SendComplete' disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_DD_3_8.yaml b/src/app/tests/suites/certification/Test_TC_DD_3_8.yaml index 8410f4c0aab5eb..e9f48c1652e4a0 100644 --- a/src/app/tests/suites/certification/Test_TC_DD_3_8.yaml +++ b/src/app/tests/suites/certification/Test_TC_DD_3_8.yaml @@ -29,6 +29,7 @@ tests: - label: "Note" verification: | Chip-tool command used below are an example to verify the DUT as commissioner test cases. For certification test, we expect DUT should have a capability or way to run the equivalent command. + Test Harness is a Commissionee device that is not connected to an operational network (i.e. Wi-Fi, or Ethernet) and is configured as a Non-concurrent device. disabled: true - label: "Preconditions" @@ -50,9 +51,10 @@ tests: verification: | Verify in TH as server side: start BLE Advertising by specific DUT implementation - Verify in DUT as client side: start commissioning process(need to obtain the Thread dataset first) + Verify in DUT as client side: start commissioning process (either Thread or WiFi) ./chip-tool pairing ble-thread 1 hex:0e080000000000010000000300000f35060004001fffe0020811111111222222220708fd27e57b1b1e22d9051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f01021234041061e1206d2c2b46e079eb775f41fc72190c0402a0fff8 20202021 3840 + ./chip-tool pairing ble-wifi 20202021 3840 disabled: true - label: @@ -64,6 +66,30 @@ tests: CHIP:SC: Received PBKDF param response disabled: true + - label: + "Step 3a: Commissioner reads commissioning information, including + SupportsConcurrentConnection attribute from General Commissioning + Cluster" + verification: | + Verify in TH that SupportsConcurrentConnection is false + + CHIP:IM: Received Read request + CHIP:DMG: ReadRequestMessage = + CHIP:DMG: { + CHIP:DMG: AttributePathIBs = + CHIP:DMG: [ + CHIP:DMG: AttributePathIB = + CHIP:DMG: { + CHIP:DMG: Endpoint = 0x0, + CHIP:DMG: Cluster = 0x30, + CHIP:DMG: Attribute = 0x0000_0004, + CHIP:DMG: } + CHIP:DMG: + CHIP:DMG: isFabricFiltered = false, + CHIP:DMG: InteractionModelRevision = 11 + CHIP:DMG: }, + disabled: true + - label: "Step 4: Commissioner SHALL re-arm Fail-safe timer on Commissionee within 60s (the autonomously Fail-safe timer length set by @@ -372,18 +398,18 @@ tests: "Step 11: Commissioning channel between the Commissioner and Commissionee is terminated." verification: | - 1. Verify the channel was terminated on DUT=chip-tool - [1651271753284] [23287:743790] CHIP: [CTL] Received CommissioningComplete response - [1651271753284] [23287:743790] CHIP: [CTL] Successfully finished commissioning step 'SendComplete' - [1651271753284] [23287:743790] CHIP: [CTL] Commissioning stage next step: 'SendComplete' -> 'Cleanup' - [1651271753284] [23287:743790] CHIP: [CTL] Performing next commissioning step 'Cleanup' - [1651271753284] [23287:743790] CHIP: [CTL] Successfully finished commissioning step 'Cleanup' - [1651271753284] [23287:743790] CHIP: [TOO] Device commissioning completed with success + Verify in TH + + CHIP:SVR: Received kCloseAllBleConnections:32777 + CHIP:IN: Clearing BLE pending packets. + CHIP:BLE: Releasing end point's BLE connection back to application. + CHIP:BLE: Got notification regarding chip connection closure + CHIP:DL: wpa_supplicant: Start WiFi management disabled: true - label: "Step 12: Reboot TH and prepare for commissioning" verification: | - 1. Using TH=all-clusters-app, exit the app, re-launch app + 1. Using TH=all-clusters-app in non-concurrent mode, exit the app, re-launch app disabled: true - label: From 165da4691f114766262f54fcde093de655cec918 Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Tue, 20 Feb 2024 09:20:59 +0530 Subject: [PATCH 02/13] [ESP32] Read core dump from flash, for diagnostic crash logs (#32192) * [ESP32] Read core dump from flash, for diagnostic crash logs * Restyled by clang-format * Restyled by prettier-markdown * add espcoredump to .wordlist * Add some null checks and init the struct members --------- Co-authored-by: Restyled.io --- .github/.wordlist.txt | 3 +- .../esp32/README.md | 32 ++- .../esp32/main/CMakeLists.txt | 4 +- ...diagnostic-logs-provider-delegate-impl.cpp | 242 ++++++++++++++---- .../esp32/main/diagnostic_logs/crash.log | 21 -- .../diagnostic-logs-provider-delegate-impl.h | 54 +++- .../esp32/partitions.csv | 5 +- .../esp32/sdkconfig.defaults | 3 + 8 files changed, 286 insertions(+), 78 deletions(-) delete mode 100644 examples/temperature-measurement-app/esp32/main/diagnostic_logs/crash.log diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 58a06086679e06..155e909a43f526 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -523,6 +523,7 @@ epochStartTime eq errorValue esd +espcoredump ESPPORT Espressif esptool @@ -1621,4 +1622,4 @@ zephyrproject zhengyaohan Zigbee zigbeealliance -zigbeethread \ No newline at end of file +zigbeethread diff --git a/examples/temperature-measurement-app/esp32/README.md b/examples/temperature-measurement-app/esp32/README.md index 18d07ff639b06a..99347fc6ead9f4 100644 --- a/examples/temperature-measurement-app/esp32/README.md +++ b/examples/temperature-measurement-app/esp32/README.md @@ -51,9 +51,39 @@ chip-tool pairing ble-wifi 1 SSID PASSPHRASE 20202021 3840 chip-tool diagnosticlogs retrieve-logs-request 0 0 1 0 # Read network diagnostic using BDX protocol -chip-tool diagnosticlogs retrieve-logs-request 1 0 1 0 --TransferFileDesignator network-diag.log +chip-tool interactive start +> diagnosticlogs retrieve-logs-request 1 1 1 0 --TransferFileDesignator network-diag.log +# Retrieve crash over BDX +> diagnosticlogs retrieve-logs-request 1 1 1 0 --TransferFileDesignator crash.bin ``` +esp-idf supports storing and retrieving +[core dump in flash](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/core_dump.html#core-dump-to-flash). + +To support that, application needs to add core dump partition's entry in +[partitons.csv](partitions.csv#7) and we need to enable few menuconfig options. + +``` +CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH=y +CONFIG_ESP32_COREDUMP_DATA_FORMAT_ELF=y +``` + +This example's partition table and sdkconfig.default are already modified + +- Retrieve the core dump using diagnostic logs cluster + + ``` + # Read crash logs over BDX + chip-tool interactive start + > diagnosticlogs retrieve-logs-request 1 1 1 0 --TransferFileDesignator crash.bin + ``` + +- Decode the crash logs, using espcoredump.py + ``` + espcoredump.py --chip (CHIP) info_corefile --core /tmp/crash.bin \ + --core-format elf build/chip-temperature-measurement-app.elf + ``` + ## Optimization Optimization related to WiFi, BLuetooth, Asserts etc are the part of this diff --git a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt index 8953d34869b76a..062266652dc303 100644 --- a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt +++ b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt @@ -55,7 +55,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" ) -set(PRIV_REQUIRES_LIST chip QRCode bt nvs_flash) +set(PRIV_REQUIRES_LIST chip QRCode bt nvs_flash bootloader_support espcoredump) if (CONFIG_ENABLE_PW_RPC) # Append additional directories for RPC build @@ -83,7 +83,7 @@ endif (CONFIG_ENABLE_PW_RPC) idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} SRC_DIRS ${SRC_DIRS_LIST} PRIV_REQUIRES ${PRIV_REQUIRES_LIST} - EMBED_FILES diagnostic_logs/end_user_support.log diagnostic_logs/network_diag.log diagnostic_logs/crash.log) + EMBED_FILES diagnostic_logs/end_user_support.log diagnostic_logs/network_diag.log) include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") chip_app_component_codegen("${CHIP_ROOT}/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter") diff --git a/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp b/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp index 4bef0fbd86cc19..5034e3f928788f 100644 --- a/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp +++ b/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp @@ -19,10 +19,19 @@ #include #include +#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) +#include +#include +// Its a bit hackish but we need this in order to pull in the sizeof(core_dump_header_t) +// we can even use the static 20 but, what if that gets chagned? +#include "../include_core_dump/esp_core_dump_types.h" +#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + using namespace chip; using namespace chip::app::Clusters::DiagnosticLogs; LogProvider LogProvider::sInstance; +LogProvider::CrashLogContext LogProvider::sCrashLogContext; namespace { bool IsValidIntent(IntentEnum intent) @@ -30,24 +39,21 @@ bool IsValidIntent(IntentEnum intent) return intent != IntentEnum::kUnknownEnumValue; } -// end_user_support.log, network_diag.log, and crash.log files are embedded in the firmware +// end_user_support.log and network_diag.log files are embedded in the firmware extern const uint8_t endUserSupportLogStart[] asm("_binary_end_user_support_log_start"); extern const uint8_t endUserSupportLogEnd[] asm("_binary_end_user_support_log_end"); extern const uint8_t networkDiagnosticLogStart[] asm("_binary_network_diag_log_start"); extern const uint8_t networkDiagnosticLogEnd[] asm("_binary_network_diag_log_end"); - -extern const uint8_t crashLogStart[] asm("_binary_crash_log_start"); -extern const uint8_t crashLogEnd[] asm("_binary_crash_log_end"); } // namespace LogProvider::~LogProvider() { - for (auto sessionSpan : mSessionSpanMap) + for (auto sessionSpan : mSessionContextMap) { Platform::MemoryFree(sessionSpan.second); } - mSessionSpanMap.clear(); + mSessionContextMap.clear(); } CHIP_ERROR LogProvider::GetLogForIntent(IntentEnum intent, MutableByteSpan & outBuffer, Optional & outTimeStamp, @@ -69,93 +75,233 @@ CHIP_ERROR LogProvider::GetLogForIntent(IntentEnum intent, MutableByteSpan & out return CHIP_NO_ERROR; } -const uint8_t * LogProvider::GetDataStartForIntent(IntentEnum intent) +size_t LogProvider::GetSizeForIntent(IntentEnum intent) { switch (intent) { case IntentEnum::kEndUserSupport: - return &endUserSupportLogStart[0]; + return static_cast(endUserSupportLogEnd - endUserSupportLogStart); case IntentEnum::kNetworkDiag: - return &networkDiagnosticLogStart[0]; + return static_cast(networkDiagnosticLogEnd - networkDiagnosticLogStart); case IntentEnum::kCrashLogs: - return &crashLogStart[0]; + return GetCrashSize(); default: - return nullptr; + return 0; } } -size_t LogProvider::GetSizeForIntent(IntentEnum intent) +size_t LogProvider::GetCrashSize() { + size_t outSize = 0; + +#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + size_t unusedOutAddr; + esp_err_t esp_err = esp_core_dump_image_get(&unusedOutAddr, &outSize); + VerifyOrReturnValue(esp_err == ESP_OK, 0, ChipLogError(DeviceLayer, "Failed to get core dump image, esp_err:%d", esp_err)); +#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + + return outSize; +} + +CHIP_ERROR LogProvider::MapCrashPartition(CrashLogContext * context) +{ +#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + size_t outAddr, outSize; + esp_err_t esp_err = esp_core_dump_image_get(&outAddr, &outSize); + VerifyOrReturnError(esp_err == ESP_OK, CHIP_ERROR(ChipError::Range::kPlatform, esp_err), + ChipLogError(DeviceLayer, "Failed to get core dump image, esp_err:%d", esp_err)); + + /* map the full core dump parition, including the checksum. */ + esp_err = spi_flash_mmap(outAddr, outSize, SPI_FLASH_MMAP_DATA, &context->mappedAddress, &context->mappedHandle); + VerifyOrReturnError(esp_err == ESP_OK, CHIP_ERROR(ChipError::Range::kPlatform, esp_err), + ChipLogError(DeviceLayer, "Failed to mmap the crash partition, esp_err:%d", esp_err)); + + context->crashSize = static_cast(outSize); + return CHIP_NO_ERROR; +#else + return CHIP_ERROR_NOT_FOUND; +#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) +} + +CHIP_ERROR LogProvider::PrepareLogContextForIntent(LogContext * context, IntentEnum intent) +{ + context->intent = intent; + switch (intent) { + case IntentEnum::kEndUserSupport: { + context->EndUserSupport.span = + ByteSpan(&endUserSupportLogStart[0], static_cast(endUserSupportLogEnd - endUserSupportLogStart)); + } + break; + + case IntentEnum::kNetworkDiag: { + context->NetworkDiag.span = + ByteSpan(&networkDiagnosticLogStart[0], static_cast(networkDiagnosticLogEnd - networkDiagnosticLogStart)); + } + break; + + case IntentEnum::kCrashLogs: { +#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + sCrashLogContext.Reset(); + context->Crash.logContext = &sCrashLogContext; + + CHIP_ERROR err = MapCrashPartition(context->Crash.logContext); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, context->Crash.logContext = nullptr); + + context->Crash.logContext->readOffset = sizeof(core_dump_header_t); + context->Crash.logContext->isMapped = true; +#else + return CHIP_ERROR_NOT_FOUND; +#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + } + break; + + default: + return CHIP_ERROR_INVALID_ARGUMENT; + } + + return CHIP_NO_ERROR; +} + +void LogProvider::CleanupLogContextForIntent(LogContext * context) +{ + switch (context->intent) + { case IntentEnum::kEndUserSupport: - return static_cast(endUserSupportLogEnd - endUserSupportLogStart); + break; + case IntentEnum::kNetworkDiag: - return static_cast(networkDiagnosticLogEnd - networkDiagnosticLogStart); - case IntentEnum::kCrashLogs: - return static_cast(crashLogEnd - crashLogStart); + break; + + case IntentEnum::kCrashLogs: { +#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + CrashLogContext * logContext = context->Crash.logContext; + spi_flash_munmap(logContext->mappedHandle); + logContext->Reset(); +#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + } + break; + default: - return 0; + break; } } +CHIP_ERROR LogProvider::GetDataForIntent(LogContext * context, MutableByteSpan & outBuffer, bool & outIsEndOfLog) +{ + switch (context->intent) + { + case IntentEnum::kEndUserSupport: { + auto dataSize = context->EndUserSupport.span.size(); + auto count = std::min(dataSize, outBuffer.size()); + + VerifyOrReturnError(CanCastTo(count), CHIP_ERROR_INVALID_ARGUMENT, outBuffer.reduce_size(0)); + ReturnErrorOnFailure(CopySpanToMutableSpan(ByteSpan(context->EndUserSupport.span.data(), count), outBuffer)); + + outIsEndOfLog = dataSize == count; + if (!outIsEndOfLog) + { + // reduce the span after reading count bytes + context->EndUserSupport.span = context->EndUserSupport.span.SubSpan(count); + } + } + break; + + case IntentEnum::kNetworkDiag: { + auto dataSize = context->NetworkDiag.span.size(); + auto count = std::min(dataSize, outBuffer.size()); + + VerifyOrReturnError(CanCastTo(count), CHIP_ERROR_INVALID_ARGUMENT, outBuffer.reduce_size(0)); + ReturnErrorOnFailure(CopySpanToMutableSpan(ByteSpan(context->NetworkDiag.span.data(), count), outBuffer)); + + outIsEndOfLog = dataSize == count; + if (!outIsEndOfLog) + { + // reduce the span after reading count bytes + context->NetworkDiag.span = context->NetworkDiag.span.SubSpan(count); + } + } + break; + + case IntentEnum::kCrashLogs: { +#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + CrashLogContext * logContext = context->Crash.logContext; + size_t dataSize = logContext->crashSize - logContext->readOffset; + auto count = std::min(dataSize, outBuffer.size()); + + VerifyOrReturnError(CanCastTo(count), CHIP_ERROR_INVALID_ARGUMENT, outBuffer.reduce_size(0)); + + const uint8_t * readAddr = reinterpret_cast(logContext->mappedAddress) + logContext->readOffset; + memcpy(outBuffer.data(), readAddr, count); + outBuffer.reduce_size(count); + + logContext->readOffset += count; + outIsEndOfLog = dataSize == count; +#else + outBuffer.reduce_size(0); + return CHIP_ERROR_NOT_FOUND; +#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF) + } + break; + + default: + return CHIP_ERROR_INVALID_ARGUMENT; + } + + return CHIP_NO_ERROR; +} + CHIP_ERROR LogProvider::StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional & outTimeStamp, Optional & outTimeSinceBoot) { VerifyOrReturnValue(IsValidIntent(intent), CHIP_ERROR_INVALID_ARGUMENT); - const uint8_t * dataStart = GetDataStartForIntent(intent); - VerifyOrReturnError(dataStart, CHIP_ERROR_NOT_FOUND); - - size_t dataSize = GetSizeForIntent(intent); - VerifyOrReturnError(dataSize, CHIP_ERROR_NOT_FOUND); + // In case of crash logs we can only mmap at max once, so check before doing anything + if (intent == IntentEnum::kCrashLogs) + { + VerifyOrReturnError(sCrashLogContext.isMapped == false, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(DeviceLayer, "Crash partition already mapped")); + } - ByteSpan * span = reinterpret_cast(Platform::MemoryCalloc(1, sizeof(ByteSpan))); - VerifyOrReturnValue(span, CHIP_ERROR_NO_MEMORY); + LogContext * context = reinterpret_cast(Platform::MemoryCalloc(1, sizeof(LogContext))); + VerifyOrReturnValue(context != nullptr, CHIP_ERROR_NO_MEMORY); - *span = ByteSpan(dataStart, dataSize); + CHIP_ERROR err = PrepareLogContextForIntent(context, intent); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, Platform::MemoryFree(context)); mLogSessionHandle++; // If the session handle rolls over to UINT16_MAX which is invalid, reset to 0. VerifyOrDo(mLogSessionHandle != kInvalidLogSessionHandle, mLogSessionHandle = 0); - outHandle = mLogSessionHandle; - mSessionSpanMap[mLogSessionHandle] = span; + outHandle = mLogSessionHandle; + mSessionContextMap[mLogSessionHandle] = context; + return CHIP_NO_ERROR; } CHIP_ERROR LogProvider::EndLogCollection(LogSessionHandle sessionHandle) { VerifyOrReturnValue(sessionHandle != kInvalidLogSessionHandle, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnValue(mSessionSpanMap.count(sessionHandle), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnValue(mSessionContextMap.count(sessionHandle), CHIP_ERROR_INVALID_ARGUMENT); - ByteSpan * span = mSessionSpanMap[sessionHandle]; - mSessionSpanMap.erase(sessionHandle); + LogContext * context = mSessionContextMap[sessionHandle]; + VerifyOrReturnError(context, CHIP_ERROR_INCORRECT_STATE); + + CleanupLogContextForIntent(context); + Platform::MemoryFree(context); + mSessionContextMap.erase(sessionHandle); - Platform::MemoryFree(span); return CHIP_NO_ERROR; } CHIP_ERROR LogProvider::CollectLog(LogSessionHandle sessionHandle, MutableByteSpan & outBuffer, bool & outIsEndOfLog) { VerifyOrReturnValue(sessionHandle != kInvalidLogSessionHandle, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnValue(mSessionSpanMap.count(sessionHandle), CHIP_ERROR_INVALID_ARGUMENT); - - ByteSpan * span = mSessionSpanMap[sessionHandle]; - auto dataSize = span->size(); - auto count = std::min(dataSize, outBuffer.size()); - - VerifyOrReturnError(CanCastTo(count), CHIP_ERROR_INVALID_ARGUMENT, outBuffer.reduce_size(0)); - - ReturnErrorOnFailure(CopySpanToMutableSpan(ByteSpan(span->data(), count), outBuffer)); + VerifyOrReturnValue(mSessionContextMap.count(sessionHandle), CHIP_ERROR_INVALID_ARGUMENT); - outIsEndOfLog = dataSize == count; + LogContext * context = mSessionContextMap[sessionHandle]; + VerifyOrReturnError(context, CHIP_ERROR_INCORRECT_STATE); - if (!outIsEndOfLog) - { - // reduce the span after reading count bytes - *span = span->SubSpan(count); - } - - return CHIP_NO_ERROR; + return GetDataForIntent(context, outBuffer, outIsEndOfLog); } diff --git a/examples/temperature-measurement-app/esp32/main/diagnostic_logs/crash.log b/examples/temperature-measurement-app/esp32/main/diagnostic_logs/crash.log deleted file mode 100644 index 04089de8ce7afd..00000000000000 --- a/examples/temperature-measurement-app/esp32/main/diagnostic_logs/crash.log +++ /dev/null @@ -1,21 +0,0 @@ -W (5047Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled. - -Core 0 register dump: -PC : 0x4009579a PS : 0x00060c33 A0 : 0x800941e1 A1 : 0x3fff3630 -0x4009579a: uxListRemove at /opt/espressif/esp-idf/components/freertos/FreeRTOS-Kernel/list.c:195 - -A2 : 0x00000006 A3 : 0x00060c20 A4 : 0x00000000 A5 : 0x00060c23 -A6 : 0xb33fffff A7 : 0xb33fffff A8 : 0x800950f0 A9 : 0x3fff3600 -A10 : 0x00000001 A11 : 0x000000fe A12 : 0x00000000 A13 : 0x00000000 -A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c -EXCVADDR: 0x00000016 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff -0x4000c2e0: memcpy in ROM -0x4000c2f6: memcpy in ROM - -Backtrace: 0x40095797:0x3fff3630 0x400941de:0x3fff3650 0x40154b39:0x3fff3670 0x40154b53:0x3fff3690 0x4013e20d:0x3fff36b0 0x40094fa6:0x3fff36d0 -0x40095797: uxListRemove at /opt/espressif/esp-idf/components/freertos/FreeRTOS-Kernel/list.c:202 -0x400941de: vTaskDelete at /opt/espressif/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:1434 (discriminator 4) -0x40154b39: esp_nimble_disable at /opt/espressif/esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c:55 -0x40154b53: nimble_port_freertos_deinit at /opt/espressif/esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c:80 -0x4013e20d: chip::DeviceLayer::Internal::BLEManagerImpl::bleprph_host_task(void*) at /home/smart/projects/smp_matter/build/esp-idf/chip/../../../../../../../opt/espressif/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/platform/ESP32/nimble/BLEManagerImpl.cpp:864 -0x40094fa6: vPortTaskWrapper at /opt/espressif/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162 diff --git a/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h b/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h index d47dccafa6079d..c3d1bd389fb39b 100644 --- a/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h +++ b/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h @@ -20,6 +20,7 @@ #include #include +#include namespace chip { namespace app { @@ -54,12 +55,59 @@ class LogProvider : public DiagnosticLogsProviderDelegate LogProvider(const LogProvider &) = delete; LogProvider & operator=(const LogProvider &) = delete; - // This tracks the ByteSpan for each session - std::map mSessionSpanMap; + struct CrashLogContext + { + spi_flash_mmap_handle_t mappedHandle = 0; + const void * mappedAddress = nullptr; + uint32_t crashSize = 0; + uint32_t readOffset = 0; + bool isMapped = 0; + + void Reset() + { + this->mappedHandle = 0; + this->mappedAddress = nullptr; + this->crashSize = 0; + this->readOffset = 0; + this->isMapped = 0; + } + }; + + static CrashLogContext sCrashLogContext; + + struct LogContext + { + IntentEnum intent; + union + { + struct + { + ByteSpan span; + } EndUserSupport; + struct + { + ByteSpan span; + } NetworkDiag; + struct + { + // TODO: This be a ref counted, so that we can serve parallel queries for crash logs + CrashLogContext * logContext; + } Crash; + }; + }; + + // This tracks the ByteSpan for each session, need to change this to void * + std::map mSessionContextMap; LogSessionHandle mLogSessionHandle = kInvalidLogSessionHandle; - const uint8_t * GetDataStartForIntent(IntentEnum intent); + // Helpers for Retrieving Core Dump from flash + size_t GetCrashSize(); + CHIP_ERROR MapCrashPartition(CrashLogContext * crashLogContext); + + CHIP_ERROR PrepareLogContextForIntent(LogContext * context, IntentEnum intent); + void CleanupLogContextForIntent(LogContext * contex); + CHIP_ERROR GetDataForIntent(LogContext * context, MutableByteSpan & outBuffer, bool & outIsEndOfLog); }; } // namespace DiagnosticLogs diff --git a/examples/temperature-measurement-app/esp32/partitions.csv b/examples/temperature-measurement-app/esp32/partitions.csv index 8b0928187b8708..35c776d19e80fa 100644 --- a/examples/temperature-measurement-app/esp32/partitions.csv +++ b/examples/temperature-measurement-app/esp32/partitions.csv @@ -2,5 +2,6 @@ # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap nvs, data, nvs, , 0xC000, phy_init, data, phy, , 0x1000, -# Factory partition size about 1.9MB -factory, app, factory, , 1920K, +# Factory partition size about 1.5MB +factory, app, factory, , 1536K, +coredump, data, coredump,, 64K diff --git a/examples/temperature-measurement-app/esp32/sdkconfig.defaults b/examples/temperature-measurement-app/esp32/sdkconfig.defaults index 6d3243cabfeb8c..3dcab272b297db 100644 --- a/examples/temperature-measurement-app/esp32/sdkconfig.defaults +++ b/examples/temperature-measurement-app/esp32/sdkconfig.defaults @@ -99,3 +99,6 @@ CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 # Enable the diagnostic logs transfer over BDX protocol CONFIG_CHIP_ENABLE_BDX_LOG_TRANSFER=y + +CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH=y +CONFIG_ESP32_COREDUMP_DATA_FORMAT_ELF=y From 6b27278831f83c2bd151df8d948ab6c604a06b96 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:29:08 +0900 Subject: [PATCH 03/13] Fix Android interaction tool crash (#32197) --- .../clusterinteraction/ClusterDetailFragment.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt index 50c33bd35c60ba..eb14eee23770bd 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt @@ -199,10 +199,19 @@ class ClusterDetailFragment : Fragment() { private fun castStringToType(data: String, type: Class<*>, underlyingType: Class<*>): Any? { return when (type) { - Int::class.java -> data.toInt() - Boolean::class.java -> data.toBoolean() + Int::class.java, + java.lang.Integer::class.java -> data.toInt() + Boolean::class.java, + java.lang.Boolean::class.java -> data.toBoolean() ByteArray::class.java -> data.encodeToByteArray() - Long::class.java -> data.toLong() + Long::class.java, + java.lang.Long::class.java -> data.toLong() + Short::class.java, + java.lang.Short::class.java -> data.toShort() + Double::class.java, + java.lang.Double::class.java -> data.toDouble() + Float::class.java, + java.lang.Float::class.java -> data.toFloat() Optional::class.java -> if (data.isEmpty()) Optional.empty() else Optional.of(castStringToType(data, underlyingType, underlyingType)!!) From a3d0a86a204cc970c4e37307b5ae71043129125f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Feb 2024 04:56:48 -0500 Subject: [PATCH 04/13] Add more files to be managed and known by GN (#32140) * A first attempt at cleanup: moved ObjectList.h and some renames * Another rename pass * Final rename pass * Restyle * Fix typo in include * Fix typo and include dependencies * Remove handled files from linter check * Added 3 more mock files to be tracked by gn * Added some comments about layering issues and added EventManagement.h since that seems safe * Added more headers that are safe and restyle * Spell out what we could not add in IM because broken dependencies * Also track AppDelegate * Update the comments to not trigger the very basic linter we have * Fix typo * Restyle * Pull linkedlist into support rather than separate source set --- .github/workflows/lint.yml | 14 -------- src/app/AttributePathExpandIterator.cpp | 2 +- src/app/AttributePathExpandIterator.h | 4 +-- src/app/BUILD.gn | 26 +++++++++++++++ src/app/EventLoggingTypes.h | 10 +++--- src/app/EventManagement.cpp | 2 +- src/app/EventManagement.h | 4 +-- src/app/InteractionModelEngine.cpp | 32 ++++++++++--------- src/app/InteractionModelEngine.h | 26 +++++++-------- src/app/ReadHandler.cpp | 2 +- src/app/ReadHandler.h | 14 ++++---- src/app/SubscriptionResumptionStorage.h | 12 +++---- src/app/common/BUILD.gn | 2 ++ src/app/data-model/BUILD.gn | 2 +- src/app/reporting/Engine.cpp | 2 +- src/app/reporting/Engine.h | 2 +- src/app/server/BUILD.gn | 1 + .../tests/TestAttributePathExpandIterator.cpp | 24 +++++++------- src/app/tests/TestEventLogging.cpp | 8 ++--- src/app/tests/TestEventLoggingNoUTCTime.cpp | 8 ++--- .../tests/TestFabricScopedEventLogging.cpp | 8 ++--- src/app/tests/TestInteractionModelEngine.cpp | 12 +++---- src/app/util/BUILD.gn | 8 +++++ src/app/util/mock/BUILD.gn | 3 ++ src/lib/support/BUILD.gn | 1 + .../ObjectList.h => lib/support/LinkedList.h} | 7 ++-- 26 files changed, 132 insertions(+), 104 deletions(-) rename src/{app/ObjectList.h => lib/support/LinkedList.h} (90%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 189f63837c841e..d811fe05fa888f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -93,35 +93,25 @@ jobs: --known-failure app/AttributeAccessInterface.h \ --known-failure app/AttributeAccessToken.h \ --known-failure app/att-storage.h \ - --known-failure app/BufferedReadCallback.h \ --known-failure app/CommandHandler.h \ --known-failure app/CommandHandlerInterface.h \ - --known-failure app/CommandPathParams.h \ - --known-failure app/CommandPathRegistry.h \ - --known-failure app/CommandResponseSender.h \ --known-failure app/CommandSender.h \ --known-failure app/CommandSenderLegacyCallback.h \ --known-failure app/CompatEnumNames.h \ - --known-failure app/ConcreteAttributePath.h \ - --known-failure app/ConcreteCommandPath.h \ --known-failure app/data-model/ListLargeSystemExtensions.h \ --known-failure app/EventHeader.h \ --known-failure app/EventLoggingDelegate.h \ --known-failure app/EventLogging.h \ --known-failure app/EventLoggingTypes.h \ - --known-failure app/EventManagement.h \ --known-failure app/InteractionModelHelper.h \ - --known-failure app/ObjectList.h \ --known-failure app/ReadClient.h \ --known-failure app/ReadHandler.h \ --known-failure app/ReadPrepareParams.h \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ --known-failure app/reporting/tests/MockReportScheduler.h \ - --known-failure app/server/AppDelegate.h \ --known-failure app/TestEventTriggerDelegate.h \ --known-failure app/util/af.h \ --known-failure app/util/af-types.h \ - --known-failure app/util/attribute-metadata.h \ --known-failure app/util/attribute-storage.cpp \ --known-failure app/util/attribute-storage.h \ --known-failure app/util/attribute-storage-null-handling.h \ @@ -141,11 +131,7 @@ jobs: --known-failure app/util/im-client-callbacks.h \ --known-failure app/util/MatterCallbacks.h \ --known-failure app/util/message.cpp \ - --known-failure app/util/mock/Constants.h \ - --known-failure app/util/mock/Functions.h \ - --known-failure app/util/mock/MockNodeConfig.h \ --known-failure app/util/odd-sized-integers.h \ - --known-failure app/util/types_stub.h \ --known-failure app/util/util.cpp \ --known-failure app/util/util.h \ --known-failure app/WriteClient.h \ diff --git a/src/app/AttributePathExpandIterator.cpp b/src/app/AttributePathExpandIterator.cpp index 5c1bb50c179f47..784499a41c4d74 100644 --- a/src/app/AttributePathExpandIterator.cpp +++ b/src/app/AttributePathExpandIterator.cpp @@ -52,7 +52,7 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index); namespace chip { namespace app { -AttributePathExpandIterator::AttributePathExpandIterator(ObjectList * aAttributePath) +AttributePathExpandIterator::AttributePathExpandIterator(SingleLinkedListNode * aAttributePath) { mpAttributePath = aAttributePath; diff --git a/src/app/AttributePathExpandIterator.h b/src/app/AttributePathExpandIterator.h index dbf8382014ce9c..f11e6793822f84 100644 --- a/src/app/AttributePathExpandIterator.h +++ b/src/app/AttributePathExpandIterator.h @@ -69,7 +69,7 @@ namespace app { class AttributePathExpandIterator { public: - AttributePathExpandIterator(ObjectList * aAttributePath); + AttributePathExpandIterator(SingleLinkedListNode * aAttributePath); /** * Proceed the iterator to the next attribute path in the given cluster info. @@ -105,7 +105,7 @@ class AttributePathExpandIterator inline bool Valid() const { return mpAttributePath != nullptr; } private: - ObjectList * mpAttributePath; + SingleLinkedListNode * mpAttributePath; ConcreteAttributePath mOutputPath; diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index c0f30493824f3a..3dfbbbffe56daf 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -87,7 +87,11 @@ source_set("revision_info") { source_set("paths") { sources = [ "AttributePathParams.h", + "CommandPathParams.h", + "CommandPathRegistry.h", + "ConcreteAttributePath.h", "ConcreteClusterPath.h", + "ConcreteCommandPath.h", "ConcreteEventPath.h", "DataVersionFilter.h", "EventPathParams.h", @@ -96,6 +100,7 @@ source_set("paths") { # This source sets also depends on basic-types.h that is not in any dependency we can use public_deps = [ ":app_config", + "${chip_root}/src/app/util:types", "${chip_root}/src/lib/core", "${chip_root}/src/lib/core:types", ] @@ -222,12 +227,14 @@ static_library("app") { "CommandHandler.cpp", "CommandResponseHelper.h", "CommandResponseSender.cpp", + "CommandResponseSender.h", "CommandSender.cpp", "DefaultAttributePersistenceProvider.cpp", "DefaultAttributePersistenceProvider.h", "DeferredAttributePersistenceProvider.cpp", "DeferredAttributePersistenceProvider.h", "EventManagement.cpp", + "EventManagement.h", "FailSafeContext.cpp", "FailSafeContext.h", "OTAUserConsentCommon.h", @@ -242,6 +249,21 @@ static_library("app") { "TimerDelegates.h", "WriteClient.cpp", "WriteHandler.cpp", + + # TODO: the following items cannot be included due to interaction-model circularity + # (app depending on im and im including these headers): + # Name with _ so that linter does not recognize it + # "CommandHandler._h" + # "CommandSender._h", + # "ReadClient._h", + # "ReadHandler._h", + # "WriteClient._h", + # "WriteHandler._h" + + # TODO: the following items cannot be included due to platform includes not being + # able to depend on src/app + # Name with _ so that linter does not recognize it + # "_AttributeAccessInterface._h", ] public_deps = [ @@ -261,9 +283,13 @@ static_library("app") { if (chip_enable_read_client) { sources += [ "BufferedReadCallback.cpp", + "BufferedReadCallback.h", "ClusterStateCache.cpp", "ClusterStateCache.h", "ReadClient.cpp", + + # TODO: cannot include "ReadClient._h" because interaction-model backreference + # Name with _ so that linter does not recognize it ] } diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 35fd37a25045ca..04a843ebcfbd60 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -19,11 +19,11 @@ #include #include -#include #include #include #include #include +#include #include inline constexpr size_t kNumPriorityLevel = 3; @@ -151,10 +151,10 @@ struct EventLoadOutContext EventNumber mStartingEventNumber = 0; Timestamp mPreviousTime; Timestamp mCurrentTime; - EventNumber mCurrentEventNumber = 0; - size_t mEventCount = 0; - const ObjectList * mpInterestedEventPaths = nullptr; - bool mFirst = true; + EventNumber mCurrentEventNumber = 0; + size_t mEventCount = 0; + const SingleLinkedListNode * mpInterestedEventPaths = nullptr; + bool mFirst = true; Access::SubjectDescriptor mSubjectDescriptor; }; } // namespace app diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index aa3abd67f828d8..8e6d53c24c9636 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -639,7 +639,7 @@ CHIP_ERROR EventManagement::CopyEventsSince(const TLVReader & aReader, size_t aD return err; } -CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, const ObjectList * apEventPathList, +CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, const SingleLinkedListNode * apEventPathList, EventNumber & aEventMin, size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor) { diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 228c26cca94a68..950efdc2bae867 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -31,10 +31,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -359,7 +359,7 @@ class EventManagement * available. * */ - CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const ObjectList * apEventPathList, + CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const SingleLinkedListNode * apEventPathList, EventNumber & aEventMin, size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor); /** diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index ddc8a984f16b72..8e4b5a80e3df7d 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -450,7 +450,7 @@ CHIP_ERROR InteractionModelEngine::ParseAttributePaths(const Access::SubjectDesc // This avoids the 'parse all paths' approach that is employed in ReadHandler since we want to // avoid allocating out of the path store during this minimal initial processing stage. // - ObjectList paramsList; + SingleLinkedListNode paramsList; ReturnErrorOnFailure(path.Init(pathReader)); ReturnErrorOnFailure(path.ParsePath(paramsList.mValue)); @@ -1513,12 +1513,12 @@ bool InteractionModelEngine::HasConflictWriteRequests(const WriteHandler * apWri return false; } -void InteractionModelEngine::ReleaseAttributePathList(ObjectList *& aAttributePathList) +void InteractionModelEngine::ReleaseAttributePathList(SingleLinkedListNode *& aAttributePathList) { ReleasePool(aAttributePathList, mAttributePathPool); } -CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList *& aAttributePathList, +CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(SingleLinkedListNode *& aAttributePathList, AttributePathParams & aAttributePath) { CHIP_ERROR err = PushFront(aAttributePathList, aAttributePath, mAttributePathPool); @@ -1530,10 +1530,10 @@ CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList *& aAttributePaths) +void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(SingleLinkedListNode *& aAttributePaths) { - ObjectList * prev = nullptr; - auto * path1 = aAttributePaths; + SingleLinkedListNode * prev = nullptr; + auto * path1 = aAttributePaths; while (path1 != nullptr) { @@ -1585,12 +1585,12 @@ void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(ObjectList *& aEventPathList) +void InteractionModelEngine::ReleaseEventPathList(SingleLinkedListNode *& aEventPathList) { ReleasePool(aEventPathList, mEventPathPool); } -CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList *& aEventPathList, +CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(SingleLinkedListNode *& aEventPathList, EventPathParams & aEventPath) { CHIP_ERROR err = PushFront(aEventPathList, aEventPath, mEventPathPool); @@ -1602,12 +1602,12 @@ CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList *& aDataVersionFilterList) +void InteractionModelEngine::ReleaseDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList) { ReleasePool(aDataVersionFilterList, mDataVersionFilterPool); } -CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, +CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList, DataVersionFilter & aDataVersionFilter) { CHIP_ERROR err = PushFront(aDataVersionFilterList, aDataVersionFilter, mDataVersionFilterPool); @@ -1620,12 +1620,13 @@ CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList -void InteractionModelEngine::ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool) +void InteractionModelEngine::ReleasePool(SingleLinkedListNode *& aObjectList, + ObjectPool, N> & aObjectPool) { - ObjectList * current = aObjectList; + SingleLinkedListNode * current = aObjectList; while (current != nullptr) { - ObjectList * nextObject = current->mpNext; + SingleLinkedListNode * nextObject = current->mpNext; aObjectPool.ReleaseObject(current); current = nextObject; } @@ -1634,9 +1635,10 @@ void InteractionModelEngine::ReleasePool(ObjectList *& aObjectList, ObjectPoo } template -CHIP_ERROR InteractionModelEngine::PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool) +CHIP_ERROR InteractionModelEngine::PushFront(SingleLinkedListNode *& aObjectList, T & aData, + ObjectPool, N> & aObjectPool) { - ObjectList * object = aObjectPool.CreateObject(); + SingleLinkedListNode * object = aObjectPool.CreateObject(); if (object == nullptr) { return CHIP_ERROR_NO_MEMORY; diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index b222087867380f..1c05767299dfbb 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -54,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -187,22 +187,22 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } - void ReleaseAttributePathList(ObjectList *& aAttributePathList); + void ReleaseAttributePathList(SingleLinkedListNode *& aAttributePathList); - CHIP_ERROR PushFrontAttributePathList(ObjectList *& aAttributePathList, + CHIP_ERROR PushFrontAttributePathList(SingleLinkedListNode *& aAttributePathList, AttributePathParams & aAttributePath); // If a concrete path indicates an attribute that is also referenced by a wildcard path in the request, // the path SHALL be removed from the list. - void RemoveDuplicateConcreteAttributePath(ObjectList *& aAttributePaths); + void RemoveDuplicateConcreteAttributePath(SingleLinkedListNode *& aAttributePaths); - void ReleaseEventPathList(ObjectList *& aEventPathList); + void ReleaseEventPathList(SingleLinkedListNode *& aEventPathList); - CHIP_ERROR PushFrontEventPathParamsList(ObjectList *& aEventPathList, EventPathParams & aEventPath); + CHIP_ERROR PushFrontEventPathParamsList(SingleLinkedListNode *& aEventPathList, EventPathParams & aEventPath); - void ReleaseDataVersionFilterList(ObjectList *& aDataVersionFilterList); + void ReleaseDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList); - CHIP_ERROR PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, + CHIP_ERROR PushFrontDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList, DataVersionFilter & aDataVersionFilter); CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); @@ -576,9 +576,9 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, static void ResumeSubscriptionsTimerCallback(System::Layer * apSystemLayer, void * apAppState); template - void ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool); + void ReleasePool(SingleLinkedListNode *& aObjectList, ObjectPool, N> & aObjectPool); template - CHIP_ERROR PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool); + CHIP_ERROR PushFront(SingleLinkedListNode *& aObjectList, T & aData, ObjectPool, N> & aObjectPool); Messaging::ExchangeManager * mpExchangeMgr = nullptr; @@ -606,13 +606,13 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, "CHIP_IM_MAX_NUM_READS is too small to match the requirements of spec 8.5.1"); #endif - ObjectPool, + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS> mAttributePathPool; - ObjectPool, + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS> mEventPathPool; - ObjectPool, + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS> mDataVersionFilterPool; diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index b5fc34484ea8ff..63da2a53aa7470 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -134,7 +134,7 @@ void ReadHandler::OnSubscriptionResumed(const SessionHandle & sessionHandle, MoveToState(HandlerState::CanStartReporting); - ObjectList * attributePath = mpAttributePathList; + SingleLinkedListNode * attributePath = mpAttributePathList; while (attributePath) { mManagementCallback.GetInteractionModelEngine()->GetReportingEngine().SetDirty(attributePath->mValue); diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index 71070c357147df..c597bac8a58d70 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -45,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -224,9 +224,9 @@ class ReadHandler : public Messaging::ExchangeDelegate ReadHandler(ManagementCallback & apCallback, Observer * observer); #endif - const ObjectList * GetAttributePathList() const { return mpAttributePathList; } - const ObjectList * GetEventPathList() const { return mpEventPathList; } - const ObjectList * GetDataVersionFilterList() const { return mpDataVersionFilterList; } + const SingleLinkedListNode * GetAttributePathList() const { return mpAttributePathList; } + const SingleLinkedListNode * GetEventPathList() const { return mpEventPathList; } + const SingleLinkedListNode * GetDataVersionFilterList() const { return mpDataVersionFilterList; } void GetReportingIntervals(uint16_t & aMinInterval, uint16_t & aMaxInterval) const { @@ -550,9 +550,9 @@ class ReadHandler : public Messaging::ExchangeDelegate Messaging::ExchangeManager * mExchangeMgr = nullptr; #endif // CHIP_CONFIG_UNSAFE_SUBSCRIPTION_EXCHANGE_MANAGER_USE - ObjectList * mpAttributePathList = nullptr; - ObjectList * mpEventPathList = nullptr; - ObjectList * mpDataVersionFilterList = nullptr; + SingleLinkedListNode * mpAttributePathList = nullptr; + SingleLinkedListNode * mpEventPathList = nullptr; + SingleLinkedListNode * mpDataVersionFilterList = nullptr; ManagementCallback & mManagementCallback; diff --git a/src/app/SubscriptionResumptionStorage.h b/src/app/SubscriptionResumptionStorage.h index 316adc3bd3c2e3..19342599f36bbc 100644 --- a/src/app/SubscriptionResumptionStorage.h +++ b/src/app/SubscriptionResumptionStorage.h @@ -78,15 +78,15 @@ class SubscriptionResumptionStorage bool mFabricFiltered; Platform::ScopedMemoryBufferWithSize mAttributePaths; Platform::ScopedMemoryBufferWithSize mEventPaths; - CHIP_ERROR SetAttributePaths(const ObjectList * pAttributePathList) + CHIP_ERROR SetAttributePaths(const SingleLinkedListNode * pAttributePathList) { mAttributePaths.Free(); if (!pAttributePathList) { return CHIP_NO_ERROR; } - const ObjectList * attributePath = pAttributePathList; - size_t attributePathCount = 0; + const SingleLinkedListNode * attributePath = pAttributePathList; + size_t attributePathCount = 0; while (attributePath) { attributePathCount++; @@ -103,15 +103,15 @@ class SubscriptionResumptionStorage } return CHIP_NO_ERROR; } - CHIP_ERROR SetEventPaths(const ObjectList * pEventPathList) + CHIP_ERROR SetEventPaths(const SingleLinkedListNode * pEventPathList) { mEventPaths.Free(); if (!pEventPathList) { return CHIP_NO_ERROR; } - const ObjectList * eventPath = pEventPathList; - size_t eventPathCount = 0; + const SingleLinkedListNode * eventPath = pEventPathList; + size_t eventPathCount = 0; while (eventPath) { eventPathCount++; diff --git a/src/app/common/BUILD.gn b/src/app/common/BUILD.gn index 193d4c362e537e..1af268a477efaf 100644 --- a/src/app/common/BUILD.gn +++ b/src/app/common/BUILD.gn @@ -27,7 +27,9 @@ static_library("cluster-objects") { ] public_deps = [ + "${chip_root}/src/app:paths", "${chip_root}/src/app/data-model", + "${chip_root}/src/app/util:types", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/protocols/interaction_model", diff --git a/src/app/data-model/BUILD.gn b/src/app/data-model/BUILD.gn index 49a49033f0e9f2..9b04882a60ec9c 100644 --- a/src/app/data-model/BUILD.gn +++ b/src/app/data-model/BUILD.gn @@ -37,8 +37,8 @@ source_set("data-model") { # of this, in part due to zap-generated code dependency. # # - app/util/attribute-storage-null-handling.h - # - app/ConcreteAttributePath.h # + "${chip_root}/src/app:paths", "${chip_root}/src/app/common:enums", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 80dec7ed6d3cd1..2dd730c358fe0a 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -58,7 +58,7 @@ void Engine::Shutdown() mGlobalDirtySet.ReleaseAll(); } -bool Engine::IsClusterDataVersionMatch(const ObjectList * aDataVersionFilterList, +bool Engine::IsClusterDataVersionMatch(const SingleLinkedListNode * aDataVersionFilterList, const ConcreteReadAttributePath & aPath) { bool existPathMatch = false; diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 47483d9096bfec..fccf9e08ab020f 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -179,7 +179,7 @@ class Engine // of those will fail to match. This function should return false if either nothing in the list matches the given // endpoint+cluster in the path or there is an entry in the list that matches the endpoint+cluster in the path but does not // match the current data version of that cluster. - bool IsClusterDataVersionMatch(const ObjectList * aDataVersionFilterList, + bool IsClusterDataVersionMatch(const SingleLinkedListNode * aDataVersionFilterList, const ConcreteReadAttributePath & aPath); /** diff --git a/src/app/server/BUILD.gn b/src/app/server/BUILD.gn index 4d63afda77ad42..7c661464bbaea3 100644 --- a/src/app/server/BUILD.gn +++ b/src/app/server/BUILD.gn @@ -30,6 +30,7 @@ static_library("server") { sources = [ "AclStorage.cpp", "AclStorage.h", + "AppDelegate.h", "CommissioningModeProvider.h", "CommissioningWindowManager.cpp", "CommissioningWindowManager.h", diff --git a/src/app/tests/TestAttributePathExpandIterator.cpp b/src/app/tests/TestAttributePathExpandIterator.cpp index d4da4fc95a2b8c..e5505320193b81 100644 --- a/src/app/tests/TestAttributePathExpandIterator.cpp +++ b/src/app/tests/TestAttributePathExpandIterator.cpp @@ -20,12 +20,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include @@ -41,7 +41,7 @@ using P = app::ConcreteAttributePath; void TestAllWildcard(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; app::ConcreteAttributePath path; P paths[] = { @@ -144,7 +144,7 @@ void TestAllWildcard(nlTestSuite * apSuite, void * apContext) void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mClusterId = Test::MockClusterId(3); clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); @@ -167,7 +167,7 @@ void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; @@ -193,7 +193,7 @@ void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; @@ -219,7 +219,7 @@ void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo.mValue.mClusterId = Test::MockClusterId(3); @@ -252,7 +252,7 @@ void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) void TestNoWildcard(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo.mValue.mClusterId = Test::MockClusterId(3); clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); @@ -277,21 +277,21 @@ void TestNoWildcard(nlTestSuite * apSuite, void * apContext) void TestMultipleClusInfo(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo1; + SingleLinkedListNode clusInfo1; - app::ObjectList clusInfo2; + SingleLinkedListNode clusInfo2; clusInfo2.mValue.mClusterId = Test::MockClusterId(3); clusInfo2.mValue.mAttributeId = Test::MockAttributeId(3); - app::ObjectList clusInfo3; + SingleLinkedListNode clusInfo3; clusInfo3.mValue.mEndpointId = Test::kMockEndpoint3; clusInfo3.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; - app::ObjectList clusInfo4; + SingleLinkedListNode clusInfo4; clusInfo4.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo4.mValue.mClusterId = Test::MockClusterId(3); - app::ObjectList clusInfo5; + SingleLinkedListNode clusInfo5; clusInfo5.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo5.mValue.mClusterId = Test::MockClusterId(3); clusInfo5.mValue.mAttributeId = Test::MockAttributeId(3); diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index 08f950517acfde..baf43d6b398707 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +133,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ObjectList * clusterInfo) + size_t expectedNumEvents, chip::SingleLinkedListNode * clusterInfo) { CHIP_ERROR err; chip::TLV::TLVReader reader; @@ -236,7 +236,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid4 + 1) == eid5); NL_TEST_ASSERT(apSuite, (eid5 + 1) == eid6); - chip::app::ObjectList paths[2]; + chip::SingleLinkedListNode paths[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; @@ -257,7 +257,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC // interested paths are path list, expect to retrieve all events for those interested paths CheckLogReadOut(apSuite, logMgmt, 0, 6, paths); - chip::app::ObjectList pathsWithWildcard[2]; + chip::SingleLinkedListNode pathsWithWildcard[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; diff --git a/src/app/tests/TestEventLoggingNoUTCTime.cpp b/src/app/tests/TestEventLoggingNoUTCTime.cpp index 43df98a790e2ba..8360f9a0813e98 100644 --- a/src/app/tests/TestEventLoggingNoUTCTime.cpp +++ b/src/app/tests/TestEventLoggingNoUTCTime.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -177,7 +177,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ObjectList * clusterInfo) + size_t expectedNumEvents, chip::SingleLinkedListNode * clusterInfo) { CHIP_ERROR err; chip::TLV::TLVReader reader; @@ -279,7 +279,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid4 + 1) == eid5); NL_TEST_ASSERT(apSuite, (eid5 + 1) == eid6); - chip::app::ObjectList paths[2]; + chip::SingleLinkedListNode paths[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; @@ -300,7 +300,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC // interested paths are path list, expect to retrieve all events for those interested paths CheckLogReadOut(apSuite, logMgmt, 0, 6, paths); - chip::app::ObjectList pathsWithWildcard[2]; + chip::SingleLinkedListNode pathsWithWildcard[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; diff --git a/src/app/tests/TestFabricScopedEventLogging.cpp b/src/app/tests/TestFabricScopedEventLogging.cpp index f55ac63b687491..d016ad5183e1c0 100644 --- a/src/app/tests/TestFabricScopedEventLogging.cpp +++ b/src/app/tests/TestFabricScopedEventLogging.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -137,7 +137,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ObjectList * clusterInfo, + size_t expectedNumEvents, chip::SingleLinkedListNode * clusterInfo, const chip::Access::SubjectDescriptor & aSubjectDescriptor) { CHIP_ERROR err; @@ -220,7 +220,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid2 + 1) == eid3); NL_TEST_ASSERT(apSuite, (eid3 + 1) == eid4); - chip::app::ObjectList paths[2]; + chip::SingleLinkedListNode paths[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; @@ -247,7 +247,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC CheckLogReadOut(apSuite, logMgmt, 0, 1, paths, descriptor); // Fabric event + wildcard test, only have one fabric-scoped event with fabric 2 - chip::app::ObjectList pathsWithWildcard[2]; + chip::SingleLinkedListNode pathsWithWildcard[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index f4450635ac0b8f..fcdc7d53e1594f 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -52,13 +52,13 @@ class TestInteractionModelEngine #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS && CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION static void TestSubscriptionResumptionTimer(nlTestSuite * apSuite, void * apContext); #endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS && CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION - static int GetAttributePathListLength(ObjectList * apattributePathParamsList); + static int GetAttributePathListLength(SingleLinkedListNode * apattributePathParamsList); }; -int TestInteractionModelEngine::GetAttributePathListLength(ObjectList * apAttributePathParamsList) +int TestInteractionModelEngine::GetAttributePathListLength(SingleLinkedListNode * apAttributePathParamsList) { - int length = 0; - ObjectList * runner = apAttributePathParamsList; + int length = 0; + SingleLinkedListNode * runner = apAttributePathParamsList; while (runner != nullptr) { runner = runner->mpNext; @@ -74,7 +74,7 @@ void TestInteractionModelEngine::TestAttributePathParamsPushRelease(nlTestSuite err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager(), &ctx.GetFabricTable(), app::reporting::GetDefaultReportScheduler()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ObjectList * attributePathParamsList = nullptr; + SingleLinkedListNode * attributePathParamsList = nullptr; AttributePathParams attributePathParams1; AttributePathParams attributePathParams2; AttributePathParams attributePathParams3; @@ -112,7 +112,7 @@ void TestInteractionModelEngine::TestRemoveDuplicateConcreteAttribute(nlTestSuit err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager(), &ctx.GetFabricTable(), app::reporting::GetDefaultReportScheduler()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ObjectList * attributePathParamsList = nullptr; + SingleLinkedListNode * attributePathParamsList = nullptr; AttributePathParams attributePathParams1; AttributePathParams attributePathParams2; AttributePathParams attributePathParams3; diff --git a/src/app/util/BUILD.gn b/src/app/util/BUILD.gn index 31d6b9e881956a..821ba51a9badcc 100644 --- a/src/app/util/BUILD.gn +++ b/src/app/util/BUILD.gn @@ -14,3 +14,11 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/app/common_flags.gni") + +source_set("types") { + sources = [ + "attribute-metadata.h", + "basic-types.h", + "types_stub.h", + ] +} diff --git a/src/app/util/mock/BUILD.gn b/src/app/util/mock/BUILD.gn index 5918318107fd35..be56bc69032844 100644 --- a/src/app/util/mock/BUILD.gn +++ b/src/app/util/mock/BUILD.gn @@ -20,7 +20,10 @@ config("mock_include") { source_set("mock_ember") { sources = [ + "Constants.h", + "Functions.h", "MockNodeConfig.cpp", + "MockNodeConfig.h", "attribute-storage.cpp", ] diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 2342b26ae66d70..02ca1eef593def 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -212,6 +212,7 @@ static_library("support") { "Iterators.h", "LambdaBridge.h", "LifetimePersistedCounter.h", + "LinkedList.h", "ObjectLifeCycle.h", "OwnerOf.h", "PersistedCounter.h", diff --git a/src/app/ObjectList.h b/src/lib/support/LinkedList.h similarity index 90% rename from src/app/ObjectList.h rename to src/lib/support/LinkedList.h index 416db0bb70a6b5..d830c2b3a23351 100644 --- a/src/app/ObjectList.h +++ b/src/lib/support/LinkedList.h @@ -22,13 +22,13 @@ #include namespace chip { -namespace app { +/// A very basic single-linked list template -struct ObjectList +struct SingleLinkedListNode { T mValue; - ObjectList * mpNext = nullptr; + SingleLinkedListNode * mpNext = nullptr; size_t Count() const { @@ -41,5 +41,4 @@ struct ObjectList } }; -} // namespace app } // namespace chip From 19c49a8699403ae0f2da2083ec506408b6a4ae31 Mon Sep 17 00:00:00 2001 From: William Date: Tue, 20 Feb 2024 13:34:07 +0000 Subject: [PATCH 05/13] Run RVC test against the RVC example app in CI. (#32079) * Run RVC test against the RVC example app in CI. * Restyled by gn * Added the RVC example app to the built examples. * Removed -app to make things consistent with other appliences. * Added missing copy instructons and fixed typos in the rvc app name. * Added the rvc-app pics values to the ci-pics-values since the tests are run against the rvc-app and there isn't currently a way to select a different YICS file when running the yaml tests. * Added missing PICS to the ci-pics-values. * Fixed typos in the tests workflow. * Update src/app/tests/suites/certification/ci-pics-values Co-authored-by: Petru Lauric <81822411+plauric@users.noreply.github.com> * Added 1 ms sleep after sending pipe commands form the test scripts. This removes the test flakyness in CI. * Restyled by autopep8 * Restyled by isort * Removed the RVC and MWO apps from the cirque tests as they are not needed following review comments. * Added todo with link to issue. --------- Co-authored-by: Restyled.io Co-authored-by: Petru Lauric <81822411+plauric@users.noreply.github.com> --- .github/workflows/darwin-tests.yaml | 2 + .github/workflows/tests.yaml | 18 +- BUILD.gn | 12 ++ .../docker/images/chip-cert-bins/Dockerfile | 4 + scripts/build/builders/host.py | 4 +- scripts/build/gn_gen_cirque.sh | 2 +- scripts/tests/chiptest/__init__.py | 2 + scripts/tests/chiptest/linux.py | 1 + scripts/tests/chiptest/test_definition.py | 6 +- scripts/tests/run_test_suite.py | 9 +- .../tests/suites/certification/ci-pics-values | 161 +++++++++++------- src/python_testing/TC_RVCCLEANM_2_1.py | 4 + src/python_testing/TC_RVCCLEANM_2_2.py | 5 + src/python_testing/TC_RVCOPSTATE_2_1.py | 4 + src/python_testing/TC_RVCOPSTATE_2_3.py | 3 + src/python_testing/TC_RVCOPSTATE_2_4.py | 4 + src/python_testing/TC_RVCRUNM_2_1.py | 4 + src/python_testing/TC_RVCRUNM_2_2.py | 5 + 18 files changed, 180 insertions(+), 70 deletions(-) diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 05943be5b0e155..e6e14ec4929a11 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -100,6 +100,7 @@ jobs: --target darwin-x64-bridge-${BUILD_VARIANT} \ --target darwin-x64-lit-icd-${BUILD_VARIANT} \ --target darwin-x64-microwave-oven-${BUILD_VARIANT} \ + --target darwin-x64-rvc-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -120,6 +121,7 @@ jobs: --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ --bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run OTA Test run: | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f083cd70bccd7c..83d921c2fa4188 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -213,6 +213,7 @@ jobs: --target linux-x64-bridge-${BUILD_VARIANT} \ --target linux-x64-lit-icd-${BUILD_VARIANT} \ --target linux-x64-microwave-oven-${BUILD_VARIANT} \ + --target linux-x64-rvc-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -234,6 +235,7 @@ jobs: --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run purposeful failure tests using the python parser sending commands to chip-tool @@ -274,6 +276,7 @@ jobs: --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run Tests using chip-repl (including slow) if: github.event_name == 'push' @@ -292,6 +295,7 @@ jobs: --bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Uploading core files uses: actions/upload-artifact@v4 @@ -359,6 +363,7 @@ jobs: --target darwin-x64-bridge-${BUILD_VARIANT} \ --target darwin-x64-lit-icd-${BUILD_VARIANT} \ --target darwin-x64-microwave-oven-${BUILD_VARIANT} \ + --target darwin-x64-rvc-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -381,6 +386,7 @@ jobs: --bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ + --rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ " - name: Run purposeful failure tests using the python parser sending commands to chip-tool @@ -460,6 +466,7 @@ jobs: --target linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test \ + --target linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-python-bindings \ build \ --copy-artifacts-to objdir-clone \ @@ -504,8 +511,6 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_4_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_10.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' @@ -543,6 +548,15 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} diff --git a/BUILD.gn b/BUILD.gn index 838ea743f348c8..a96f2a2e67265a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -363,6 +363,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { enable_linux_lit_icd_app_build = enable_default_builds && (host_os == "linux" || host_os == "mac") + # Build the Linux RVC app example. + enable_linux_rvc_app_build = + enable_default_builds && (host_os == "linux" || host_os == "mac") + # Build the cc13x2x7_26x2x7 lock app example. enable_cc13x2x7_26x2x7_lock_app_build = enable_ti_simplelink_builds @@ -744,6 +748,14 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { extra_build_deps += [ ":genio_shell_app" ] } + if (enable_linux_rvc_app_build) { + group("linux_rvc_app") { + deps = [ "${chip_root}/examples/rvc-app/linux(${standalone_toolchain})" ] + } + + extra_build_deps += [ ":linux_rvc_app" ] + } + group("default") { deps = extra_build_deps + builds } diff --git a/integrations/docker/images/chip-cert-bins/Dockerfile b/integrations/docker/images/chip-cert-bins/Dockerfile index 33662e66d3a9ba..dff19ccd0137ef 100644 --- a/integrations/docker/images/chip-cert-bins/Dockerfile +++ b/integrations/docker/images/chip-cert-bins/Dockerfile @@ -194,6 +194,7 @@ RUN case ${TARGETPLATFORM} in \ --target linux-x64-lit-icd-ipv6only \ --target linux-x64-energy-management-ipv6only \ --target linux-x64-microwave-oven-ipv6only \ + --target linux-x64-rvc-ipv6only \ build \ && mv out/linux-x64-chip-tool-ipv6only-platform-mdns/chip-tool out/chip-tool \ && mv out/linux-x64-shell-ipv6only-platform-mdns/chip-shell out/chip-shell \ @@ -213,6 +214,7 @@ RUN case ${TARGETPLATFORM} in \ && mv out/linux-x64-lit-icd-ipv6only/lit-icd-app out/lit-icd-app \ && mv out/linux-x64-energy-management-ipv6only/chip-energy-management-app out/chip-energy-management-app \ && mv out/linux-x64-microwave-oven-ipv6only/chip-microwave-oven-app out/chip-microwave-oven-app \ + && mv out/linux-x64-rvc-ipv6only/chip-rvc-app out/chip-rvc-app \ ;; \ "linux/arm64")\ set -x \ @@ -255,6 +257,7 @@ RUN case ${TARGETPLATFORM} in \ && mv out/linux-arm64-lit-icd-ipv6only/lit-icd-app out/lit-icd-app \ && mv out/linux-arm64-energy-management-ipv6only/chip-energy-management-app out/chip-energy-management-app \ && mv out/linux-arm64-microwave-oven-ipv6only/chip-microwave-oven-app out/chip-microwave-oven-app \ + && mv out/linux-arm64-rvc-ipv6only/chip-rvc-app out/chip-rvc-app \ ;; \ *) ;; \ esac @@ -287,6 +290,7 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-app1 chip-app1 COPY --from=chip-build-cert-bins /root/connectedhomeip/out/lit-icd-app lit-icd-app COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-energy-management-app chip-energy-management-app COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-microwave-oven-app chip-microwave-oven-app +COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-rvc-app chip-rvc-app # Stage 3.1: Setup the Matter Python environment COPY --from=chip-build-cert-bins /root/connectedhomeip/out/python_lib python_lib diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index a6ad8f343e0b16..fcb609c70e941f 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -234,8 +234,8 @@ def OutputNames(self): yield 'refrigerator-app' yield 'refrigerator-app.map' elif self == HostApp.RVC: - yield 'rvc-app' - yield 'rvc-app.map' + yield 'chip-rvc-app' + yield 'chip-rvc-app.map' elif self == HostApp.AIR_PURIFIER: yield 'air-purifier-app' yield 'air-purifier-app.map' diff --git a/scripts/build/gn_gen_cirque.sh b/scripts/build/gn_gen_cirque.sh index a0713f571189ab..d6f6bd86905a0e 100755 --- a/scripts/build/gn_gen_cirque.sh +++ b/scripts/build/gn_gen_cirque.sh @@ -36,7 +36,7 @@ echo "Setup build environment" source "./scripts/activate.sh" echo "Build: GN configure" -gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args out/debug --args='target_os="all"'"chip_build_tests=false chip_enable_wifi=false chip_im_force_fabric_quota_check=true enable_default_builds=false enable_host_gcc_build=true enable_standalone_chip_tool_build=true enable_linux_all_clusters_app_build=true enable_linux_lighting_app_build=true enable_microwave_oven_app_build=true enable_linux_lit_icd_app_build=true" +gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args out/debug --args='target_os="all"'"chip_build_tests=false chip_enable_wifi=false chip_im_force_fabric_quota_check=true enable_default_builds=false enable_host_gcc_build=true enable_standalone_chip_tool_build=true enable_linux_all_clusters_app_build=true enable_linux_lighting_app_build=true enable_linux_lit_icd_app_build=true" echo "Build: Ninja build" time ninja -C out/debug all check diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 505a5e163cc5c4..ecfd98be618480 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -313,6 +313,8 @@ def target_for_name(name: str): return TestTarget.LIT_ICD if name.startswith("Test_TC_MWOCTRL_") or name.startswith("Test_TC_MWOM_"): return TestTarget.MWO + if name.startswith("Test_TC_RVCRUNM_") or name.startswith("Test_TC_RVCCLEANM_") or name.startswith("Test_TC_RVCOPSTATE_"): + return TestTarget.RVC return TestTarget.ALL_CLUSTERS diff --git a/scripts/tests/chiptest/linux.py b/scripts/tests/chiptest/linux.py index 1d679ee236a3fd..3dbd851be26b47 100644 --- a/scripts/tests/chiptest/linux.py +++ b/scripts/tests/chiptest/linux.py @@ -183,6 +183,7 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths: tv_app='ip netns exec app'.split() + paths.tv_app, lit_icd_app='ip netns exec app'.split() + paths.lit_icd_app, microwave_oven_app='ip netns exec app'.split() + paths.microwave_oven_app, + rvc_app='ip netns exec app'.split() + paths.rvc_app, bridge_app='ip netns exec app'.split() + paths.bridge_app, chip_repl_yaml_tester_cmd='ip netns exec tool'.split() + paths.chip_repl_yaml_tester_cmd, chip_tool_with_python_cmd='ip netns exec tool'.split() + paths.chip_tool_with_python_cmd, diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 95f7a631928ba4..12c59cfad0cc41 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -176,6 +176,7 @@ class TestTarget(Enum): BRIDGE = auto() LIT_ICD = auto() MWO = auto() + RVC = auto() @dataclass @@ -191,10 +192,11 @@ class ApplicationPaths: microwave_oven_app: typing.List[str] chip_repl_yaml_tester_cmd: typing.List[str] chip_tool_with_python_cmd: typing.List[str] + rvc_app: typing.List[str] def items(self): return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app, - self.tv_app, self.bridge_app, self.lit_icd_app, self.microwave_oven_app, self.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd] + self.tv_app, self.bridge_app, self.lit_icd_app, self.microwave_oven_app, self.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd, self.rvc_app] @dataclass @@ -305,6 +307,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, target_app = paths.lit_icd_app elif self.target == TestTarget.MWO: target_app = paths.microwave_oven_app + elif self.target == TestTarget.RVC: + target_app = paths.rvc_app else: raise Exception("Unknown test target - " "don't know which application to run") diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index 9dbe01d9dbcfa0..2df88cd6740653 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -257,6 +257,9 @@ def cmd_list(context): @click.option( '--microwave-oven-app', help='what microwave oven app to use') +@click.option( + '--rvc-app', + help='what rvc app to use') @click.option( '--chip-repl-yaml-tester', help='what python script to use for running yaml tests using chip-repl as controller') @@ -288,7 +291,7 @@ def cmd_list(context): help='Number of tests that are expected to fail in each iteration. Overall test will pass if the number of failures matches this. Nonzero values require --keep-going') @click.pass_context def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app, - tv_app, bridge_app, lit_icd_app, microwave_oven_app, chip_repl_yaml_tester, chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures): + tv_app, bridge_app, lit_icd_app, microwave_oven_app, rvc_app, chip_repl_yaml_tester, chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures): if expected_failures != 0 and not keep_going: logging.exception(f"'--expected-failures {expected_failures}' used without '--keep-going'") sys.exit(2) @@ -321,6 +324,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o if microwave_oven_app is None: microwave_oven_app = paths_finder.get('chip-microwave-oven-app') + if rvc_app is None: + rvc_app = paths_finder.get('chip-rvc-app') + if chip_repl_yaml_tester is None: chip_repl_yaml_tester = paths_finder.get('yamltest_with_chip_repl_tester.py') @@ -341,6 +347,7 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o bridge_app=[bridge_app], lit_icd_app=[lit_icd_app], microwave_oven_app=[microwave_oven_app], + rvc_app=[rvc_app], chip_repl_yaml_tester_cmd=['python3'] + [chip_repl_yaml_tester], chip_tool_with_python_cmd=['python3'] + [chip_tool_with_python], ) diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index f200ad302931ff..021f52e6547ec8 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2477,97 +2477,132 @@ REFALM.S.E00=1 REFALM.S.C00.Rsp=1 REFALM.S.C01.Rsp=1 -# RVC CLEAN MODE CLUSTER - +# PICS for the RVC app +# These are required to be here because currently there isn't a way to select a different PICS +# file when running the yaml tests in CI RVCCLEANM.S=1 - -#Server RVCCLEANM.S.A0000=1 RVCCLEANM.S.A0001=1 - -#Feature -RVCCLEANM.S.F00=0 - -#commands RVCCLEANM.S.C00.Rsp=1 RVCCLEANM.S.C01.Tx=1 - +RVCCLEANM.S.F00=0 RVCCLEANM.S.M.CAN_TEST_MODE_FAILURE=1 -#PIXIT -PIXIT.RVCCLEANM.MODE_CHANGE_FAIL=1 -PIXIT.RVCCLEANM.MODE_CHANGE_OK=1 - -# RVC OPERATIONAL STATE CLUSTER RVCOPSTATE.S=1 -RVCOPSTATE.C=1 - -#ManuallyControlled -# These are the PICS supported by the all-clusters-app - -RVCOPSTATE.S.M.ST_STOPPED=1 -RVCOPSTATE.S.M.ST_RUNNING=1 -RVCOPSTATE.S.M.ST_PAUSED=1 -RVCOPSTATE.S.M.ST_ERROR=0 -RVCOPSTATE.S.M.ST_SEEKING_CHARGER=0 -RVCOPSTATE.S.M.ST_CHARGING=0 -RVCOPSTATE.S.M.ST_DOCKED=0 -RVCOPSTATE.S.M.ERR_NO_ERROR=1 -RVCOPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME=0 -RVCOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION=0 -RVCOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE=0 -RVCOPSTATE.S.M.ERR_FAILED_TO_FIND_CHARGING_DOCK=0 -RVCOPSTATE.S.M.ERR_STUCK=0 -RVCOPSTATE.S.M.ERR_DUST_BIN_MISSING=0 -RVCOPSTATE.S.M.ERR_DUST_BIN_FULL=0 -RVCOPSTATE.S.M.ERR_WATER_TANK_EMPTY=0 -RVCOPSTATE.S.M.ERR_WATER_TANK_MISSING=0 -RVCOPSTATE.S.M.ERR_WATER_TANK_LID_OPEN=0 -RVCOPSTATE.S.M.ERR_MOP_CLEANING_PAD_MISSING=0 - -#Events -RVCOPSTATE.S.E00=1 -RVCOPSTATE.S.E01=1 - -#Server RVCOPSTATE.S.A0000=1 RVCOPSTATE.S.A0001=1 -RVCOPSTATE.S.A0002=1 +RVCOPSTATE.S.A0002=0 RVCOPSTATE.S.A0003=1 RVCOPSTATE.S.A0004=1 RVCOPSTATE.S.A0005=1 - -#Commands +RVCOPSTATE.S.E00=1 +RVCOPSTATE.S.E01=1 RVCOPSTATE.S.C00.Rsp=1 RVCOPSTATE.S.C01.Rsp=0 RVCOPSTATE.S.C02.Rsp=0 RVCOPSTATE.S.C03.Rsp=1 RVCOPSTATE.S.C04.Tx=1 RVCOPSTATE.S.C128.Rsp=1 -RVCOPSTATE.C.C00.Tx=1 -RVCOPSTATE.C.C01.Tx=1 -RVCOPSTATE.C.C02.Tx=1 -RVCOPSTATE.C.C04.Tx=1 - +RVCOPSTATE.S.M.ST_STOPPED=1 +RVCOPSTATE.S.M.ST_RUNNING=1 +RVCOPSTATE.S.M.ST_PAUSED=1 +RVCOPSTATE.S.M.ST_ERROR=1 +RVCOPSTATE.S.M.ST_SEEKING_CHARGER=1 +RVCOPSTATE.S.M.ST_CHARGING=1 +RVCOPSTATE.S.M.ST_DOCKED=1 +RVCOPSTATE.S.M.ERR_NO_ERROR=1 +RVCOPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME=1 +RVCOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION=1 +RVCOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE=1 +RVCOPSTATE.S.M.ERR_FAILED_TO_FIND_CHARGING_DOCK=1 +RVCOPSTATE.S.M.ERR_STUCK=1 +RVCOPSTATE.S.M.ERR_DUST_BIN_MISSING=1 +RVCOPSTATE.S.M.ERR_DUST_BIN_FULL=1 +RVCOPSTATE.S.M.ERR_WATER_TANK_EMPTY=1 +RVCOPSTATE.S.M.ERR_WATER_TANK_MISSING=1 +RVCOPSTATE.S.M.ERR_WATER_TANK_LID_OPEN=1 +RVCOPSTATE.S.M.ERR_MOP_CLEANING_PAD_MISSING=1 +RVCOPSTATE.C=0 +RVCOPSTATE.C.C00.Tx=0 +RVCOPSTATE.C.C01.Tx=0 +RVCOPSTATE.C.C02.Tx=0 +RVCOPSTATE.C.C04.Tx=0 -# RVC RUN MODE CLUSTER RVCRUNM.S=1 -RVCRUNM.S.F00=0 - -#Server RVCRUNM.S.A0000=1 RVCRUNM.S.A0001=1 - -#Commands RVCRUNM.S.C00.Rsp=1 RVCRUNM.S.C01.Tx=1 - +RVCRUNM.S.F00=0 RVCRUNM.S.M.CAN_TEST_MODE_FAILURE=1 RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED=1 -#PIXIT -PIXIT.RVCRUNM.MODE_CHANGE_FAIL=1 -PIXIT.RVCRUNM.MODE_CHANGE_OK=1 +# These are useless as these values are set where the python tests are run. +# They are only here because a list test wants then to be. +PIXIT.RVCCLEANM.MODE_CHANGE_FAIL=0 +PIXIT.RVCCLEANM.MODE_CHANGE_OK=0 +PIXIT.RVCRUNM.MODE_CHANGE_FAIL=0 +PIXIT.RVCRUNM.MODE_CHANGE_OK=0 + +# These are the RVC PICS for the all-clustrs-app. +# These PICS are commented out because the yaml tests are being run against the rvc-app. +# RVCCLEANM.S=1 +# RVCCLEANM.S.A0000=1 +# RVCCLEANM.S.A0001=1 +# RVCCLEANM.S.F00=0 +# RVCCLEANM.S.C00.Rsp=1 +# RVCCLEANM.S.C01.Tx=1 +# RVCCLEANM.S.M.CAN_TEST_MODE_FAILURE=1 + +# RVCOPSTATE.S=1 +# RVCOPSTATE.C=1 +# RVCOPSTATE.S.M.ST_STOPPED=1 +# RVCOPSTATE.S.M.ST_RUNNING=1 +# RVCOPSTATE.S.M.ST_PAUSED=1 +# RVCOPSTATE.S.M.ST_ERROR=0 +# RVCOPSTATE.S.M.ST_SEEKING_CHARGER=0 +# RVCOPSTATE.S.M.ST_CHARGING=0 +# RVCOPSTATE.S.M.ST_DOCKED=0 +# RVCOPSTATE.S.M.ERR_NO_ERROR=1 +# RVCOPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME=0 +# RVCOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION=0 +# RVCOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE=0 +# RVCOPSTATE.S.M.ERR_FAILED_TO_FIND_CHARGING_DOCK=0 +# RVCOPSTATE.S.M.ERR_STUCK=0 +# RVCOPSTATE.S.M.ERR_DUST_BIN_MISSING=0 +# RVCOPSTATE.S.M.ERR_DUST_BIN_FULL=0 +# RVCOPSTATE.S.M.ERR_WATER_TANK_EMPTY=0 +# RVCOPSTATE.S.M.ERR_WATER_TANK_MISSING=0 +# RVCOPSTATE.S.M.ERR_WATER_TANK_LID_OPEN=0 +# RVCOPSTATE.S.M.ERR_MOP_CLEANING_PAD_MISSING=0 +# RVCOPSTATE.S.E00=1 +# RVCOPSTATE.S.E01=1 +# RVCOPSTATE.S.A0000=1 +# RVCOPSTATE.S.A0001=1 +# RVCOPSTATE.S.A0002=1 +# RVCOPSTATE.S.A0003=1 +# RVCOPSTATE.S.A0004=1 +# RVCOPSTATE.S.A0005=1 +# RVCOPSTATE.S.C00.Rsp=1 +# RVCOPSTATE.S.C01.Rsp=0 +# RVCOPSTATE.S.C02.Rsp=0 +# RVCOPSTATE.S.C03.Rsp=1 +# RVCOPSTATE.S.C04.Tx=1 +# RVCOPSTATE.S.C128.Rsp=1 +# RVCOPSTATE.C.C00.Tx=1 +# RVCOPSTATE.C.C01.Tx=1 +# RVCOPSTATE.C.C02.Tx=1 +# RVCOPSTATE.C.C04.Tx=1 + +# RVCRUNM.S=1 +# RVCRUNM.S.F00=0 +# RVCRUNM.S.A0000=1 +# RVCRUNM.S.A0001=1 +# RVCRUNM.S.C00.Rsp=1 +# RVCRUNM.S.C01.Tx=1 +# RVCRUNM.S.M.CAN_TEST_MODE_FAILURE=1 +# RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED=1 + #Refrigerator and Temperature Controlled Cabinet Mode Cluster(TCCM) diff --git a/src/python_testing/TC_RVCCLEANM_2_1.py b/src/python_testing/TC_RVCCLEANM_2_1.py index d000f0d5af697d..6ef91d89a06729 100644 --- a/src/python_testing/TC_RVCCLEANM_2_1.py +++ b/src/python_testing/TC_RVCCLEANM_2_1.py @@ -16,6 +16,7 @@ # import logging +from time import sleep import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches @@ -56,6 +57,9 @@ async def send_run_change_to_mode_cmd(self, newMode) -> Clusters.Objects.RvcRunM def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests are flaky) + # TODO(#31239): centralize pipe write logic and remove the need of sleep + sleep(0.001) def pics_TC_RVCCLEANM_2_1(self) -> list[str]: return ["RVCCLEANM.S"] diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index ae5c268d7a9668..7e1fa6aaf2667e 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -15,6 +15,8 @@ # limitations under the License. # +from time import sleep + import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main from mobly import asserts @@ -70,6 +72,9 @@ def pics_TC_RVCCLEANM_2_2(self) -> list[str]: def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests are flaky) + # TODO(#31239): centralize pipe write logic and remove the need of sleep + sleep(0.001) @async_test_body async def test_TC_RVCCLEANM_2_2(self): diff --git a/src/python_testing/TC_RVCOPSTATE_2_1.py b/src/python_testing/TC_RVCOPSTATE_2_1.py index b0d753ad216164..e9dd4659059fa0 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_1.py +++ b/src/python_testing/TC_RVCOPSTATE_2_1.py @@ -16,6 +16,7 @@ # import logging +from time import sleep import chip.clusters as Clusters from chip.clusters.Types import NullValue @@ -63,6 +64,9 @@ async def send_pause_cmd(self) -> Clusters.Objects.RvcOperationalState.Commands. def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Allow some time for the command to take effect. + # This removes the test flakyness which is very annoying for everyone in CI. + sleep(0.001) def TC_RVCOPSTATE_2_1(self) -> list[str]: return ["RVCOPSTATE.S"] diff --git a/src/python_testing/TC_RVCOPSTATE_2_3.py b/src/python_testing/TC_RVCOPSTATE_2_3.py index 4d275ac5adc5b9..aa755315fb7d46 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_3.py +++ b/src/python_testing/TC_RVCOPSTATE_2_3.py @@ -130,6 +130,9 @@ async def send_run_change_to_mode_cmd(self, new_mode) -> Clusters.Objects.RvcRun def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests are flaky) + # TODO(#31239): centralize pipe write logic and remove the need of sleep + sleep(0.001) # Prints the instruction and waits for a user input to continue def print_instruction(self, step_number, instruction): diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index 3314eaade876bb..7352fbd089f172 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -16,6 +16,7 @@ # import logging +from time import sleep import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches @@ -81,6 +82,9 @@ async def send_run_change_to_mode_cmd(self, new_mode): def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests are flaky) + # TODO(#31239): centralize pipe write logic and remove the need of sleep + sleep(0.001) def pics_TC_RVCOPSTATE_2_4(self) -> list[str]: return ["RVCOPSTATE.S"] diff --git a/src/python_testing/TC_RVCRUNM_2_1.py b/src/python_testing/TC_RVCRUNM_2_1.py index a9b4c44ba4f88c..1f3bccb528f137 100644 --- a/src/python_testing/TC_RVCRUNM_2_1.py +++ b/src/python_testing/TC_RVCRUNM_2_1.py @@ -16,6 +16,7 @@ # import logging +from time import sleep import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches @@ -51,6 +52,9 @@ async def send_change_to_mode_cmd(self, newMode) -> Clusters.Objects.RvcRunMode. def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests are flaky) + # TODO(#31239): centralize pipe write logic and remove the need of sleep + sleep(0.001) def pics_TC_RVCRUNM_2_1(self) -> list[str]: return ["RVCRUNM.S"] diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index 4868865c367d19..d85d1ae53cb928 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -15,6 +15,8 @@ # limitations under the License. # +from time import sleep + import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main from mobly import asserts @@ -91,6 +93,9 @@ async def read_op_state_operational_state(self) -> Clusters.Objects.RvcOperation def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: app_pipe.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests are flaky) + # TODO(#31239): centralize pipe write logic and remove the need of sleep + sleep(0.001) def pics_TC_RVCRUNM_2_2(self) -> list[str]: return ["RVCRUNM.S"] From f7baa582598763a3ff0ebbcba2f418b502beae20 Mon Sep 17 00:00:00 2001 From: "tianfeng.yang" <130436698+tianfeng-yang@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:41:17 +0800 Subject: [PATCH 06/13] Restore state before restart dnssd (#31985) * Restore state before restart dnssd * Needs to call Shutdown --- src/lib/dnssd/Discovery_ImplPlatform.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index abbc4647ff3805..3369f8c00b3b3b 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -420,8 +420,13 @@ void DiscoveryImplPlatform::HandleDnssdInit(void * context, CHIP_ERROR initError void DiscoveryImplPlatform::HandleDnssdError(void * context, CHIP_ERROR error) { + DiscoveryImplPlatform * publisher = static_cast(context); + if (error == CHIP_ERROR_FORCED_RESET) { + // Restore dnssd state before restart, also needs to call ChipDnssdShutdown() + publisher->Shutdown(); + DeviceLayer::ChipDeviceEvent event; event.Type = DeviceLayer::DeviceEventType::kDnssdRestartNeeded; error = DeviceLayer::PlatformMgr().PostEvent(&event); From d09f68ef570ef68b178332cc18450e2f1935299a Mon Sep 17 00:00:00 2001 From: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com> Date: Tue, 20 Feb 2024 06:53:35 -0800 Subject: [PATCH 07/13] Messages cluster sample app for android (#32162) * sample app for java * present and list messages * address feedback * Restyle [in-dev] Messages cluster sample app for android (#32163) * Restyled by whitespace * Restyled by google-java-format --------- Co-authored-by: Restyled.io * Restyled by google-java-format (#32195) Co-authored-by: Restyled.io * address feedback --------- Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com> Co-authored-by: Restyled.io --- .../tv/server/service/MatterServant.java | 3 + examples/tv-app/android/BUILD.gn | 6 + .../tv-app/android/java/ChannelManager.cpp | 20 +- .../java/ContentAppAttributeDelegate.cpp | 2 + .../java/ContentAppCommandDelegate.cpp | 2 + .../android/java/ContentLauncherManager.cpp | 11 + .../android/java/KeypadInputManager.cpp | 1 + examples/tv-app/android/java/LevelManager.cpp | 1 + .../tv-app/android/java/LowPowerManager.cpp | 1 + .../tv-app/android/java/MediaInputManager.cpp | 14 +- .../android/java/MediaPlaybackManager.cpp | 18 +- .../tv-app/android/java/MessagesManager.cpp | 454 ++++++++++++++++++ .../tv-app/android/java/MessagesManager.h | 63 +++ .../android/java/MyUserPrompter-JNI.cpp | 4 + examples/tv-app/android/java/OnOffManager.cpp | 1 + examples/tv-app/android/java/TVApp-JNI.cpp | 6 + .../tv-app/android/java/WakeOnLanManager.cpp | 1 + .../com/matter/tv/server/tvapp/Clusters.java | 2 +- .../com/matter/tv/server/tvapp/Message.java | 46 ++ .../server/tvapp/MessageResponseOption.java | 28 ++ .../tv/server/tvapp/MessagesManager.java | 36 ++ .../tv/server/tvapp/MessagesManagerStub.java | 82 ++++ .../src/com/matter/tv/server/tvapp/TvApp.java | 2 + 23 files changed, 799 insertions(+), 5 deletions(-) create mode 100644 examples/tv-app/android/java/MessagesManager.cpp create mode 100644 examples/tv-app/android/java/MessagesManager.h create mode 100644 examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Message.java create mode 100644 examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessageResponseOption.java create mode 100644 examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManager.java create mode 100644 examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java diff --git a/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/service/MatterServant.java b/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/service/MatterServant.java index 79b02f01386769..540798aae913b7 100644 --- a/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/service/MatterServant.java +++ b/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/service/MatterServant.java @@ -41,6 +41,7 @@ import com.matter.tv.server.tvapp.LowPowerManagerStub; import com.matter.tv.server.tvapp.MediaInputManagerStub; import com.matter.tv.server.tvapp.MediaPlaybackManagerStub; +import com.matter.tv.server.tvapp.MessagesManagerStub; import com.matter.tv.server.tvapp.OnOffManagerStub; import com.matter.tv.server.tvapp.TvApp; import com.matter.tv.server.tvapp.WakeOnLanManagerStub; @@ -96,6 +97,8 @@ public void init(@NonNull Context context) { app.setMediaPlaybackManager(endpoint, new MediaPlaybackManagerStub(endpoint)); } else if (clusterId == Clusters.ClusterId_Channel) { app.setChannelManager(endpoint, new ChannelManagerStub(endpoint)); + } else if (clusterId == Clusters.ClusterId_Messaging) { + app.setMessagesManager(endpoint, new MessagesManagerStub(endpoint)); } else if (clusterId == Clusters.ClusterId_OnOff) { mOnOffEndpoint = endpoint; app.setOnOffManager(endpoint, new OnOffManagerStub(endpoint)); diff --git a/examples/tv-app/android/BUILD.gn b/examples/tv-app/android/BUILD.gn index 63de5a515b0754..47157a271edfe8 100644 --- a/examples/tv-app/android/BUILD.gn +++ b/examples/tv-app/android/BUILD.gn @@ -69,6 +69,8 @@ shared_library("jni") { "java/MediaInputManager.h", "java/MediaPlaybackManager.cpp", "java/MediaPlaybackManager.h", + "java/MessagesManager.cpp", + "java/MessagesManager.h", "java/MyUserPrompter-JNI.cpp", "java/MyUserPrompter-JNI.h", "java/MyUserPrompterResolver-JNI.cpp", @@ -143,6 +145,10 @@ android_library("java") { "java/src/com/matter/tv/server/tvapp/MediaPlaybackManagerStub.java", "java/src/com/matter/tv/server/tvapp/MediaPlaybackPosition.java", "java/src/com/matter/tv/server/tvapp/MediaTrack.java", + "java/src/com/matter/tv/server/tvapp/Message.java", + "java/src/com/matter/tv/server/tvapp/MessageResponseOption.java", + "java/src/com/matter/tv/server/tvapp/MessagesManager.java", + "java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java", "java/src/com/matter/tv/server/tvapp/OnOffManager.java", "java/src/com/matter/tv/server/tvapp/OnOffManagerStub.java", "java/src/com/matter/tv/server/tvapp/TvApp.java", diff --git a/examples/tv-app/android/java/ChannelManager.cpp b/examples/tv-app/android/java/ChannelManager.cpp index 3c0efcab9f8cdc..c7067132e46e9d 100644 --- a/examples/tv-app/android/java/ChannelManager.cpp +++ b/examples/tv-app/android/java/ChannelManager.cpp @@ -57,6 +57,7 @@ void ChannelManager::NewManager(jint endpoint, jobject manager) CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -66,6 +67,8 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder VerifyOrExit(mChannelManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetChannelListMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { jobjectArray channelInfoList = (jobjectArray) env->CallObjectMethod(mChannelManagerObject.ObjectRef(), mGetChannelListMethod); @@ -134,6 +137,7 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; chip::app::Clusters::Channel::Structs::LineupInfoStruct::Type lineupInfo; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -144,6 +148,8 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder) VerifyOrExit(mChannelManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetLineupMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + { jobject channelLineupObject = env->CallObjectMethod(mChannelManagerObject.ObjectRef(), mGetLineupMethod); if (channelLineupObject != nullptr) @@ -197,6 +203,7 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder) CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; chip::app::Clusters::Channel::Structs::ChannelInfoStruct::Type channelInfo; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -207,6 +214,8 @@ CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEnco VerifyOrExit(mChannelManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetCurrentChannelMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + { jobject channelInfoObject = env->CallObjectMethod(mChannelManagerObject.ObjectRef(), mGetCurrentChannelMethod); if (channelInfoObject != nullptr) @@ -273,6 +282,7 @@ CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEnco void ChannelManager::HandleChangeChannel(CommandResponseHelper & helper, const CharSpan & match) { + DeviceLayer::StackUnlock unlock; std::string name(match.data(), match.size()); JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -282,9 +292,10 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelperExceptionClear(); + { UtfString jniname(env, name.c_str()); - env->ExceptionClear(); jobject channelObject = env->CallObjectMethod(mChannelManagerObject.ObjectRef(), mChangeChannelMethod, jniname.jniValue()); if (env->ExceptionCheck()) { @@ -319,6 +330,7 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper> & externalIdList, const chip::Optional & data) { + DeviceLayer::StackUnlock unlock; ProgramGuideResponseType response; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -394,6 +408,8 @@ void ChannelManager::HandleGetProgramGuide( VerifyOrExit(mChannelManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetProgramGuideMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + { // NOTE: this example app does not pass the Data, PageToken, ChannelsArray or ExternalIdList through to the Java layer UtfString jData(env, ""); @@ -591,6 +607,7 @@ bool ChannelManager::HandleRecordProgram(const chip::CharSpan & programIdentifie const DataModel::DecodableList & externalIdList, const chip::ByteSpan & data) { + DeviceLayer::StackUnlock unlock; jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -628,6 +645,7 @@ bool ChannelManager::HandleCancelRecordProgram(const chip::CharSpan & programIde const DataModel::DecodableList & externalIdList, const chip::ByteSpan & data) { + DeviceLayer::StackUnlock unlock; jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); diff --git a/examples/tv-app/android/java/ContentAppAttributeDelegate.cpp b/examples/tv-app/android/java/ContentAppAttributeDelegate.cpp index 84e7d9933ad022..00b4ca7a225b2c 100644 --- a/examples/tv-app/android/java/ContentAppAttributeDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppAttributeDelegate.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include namespace chip { @@ -43,6 +44,7 @@ std::string ContentAppAttributeDelegate::Read(const chip::app::ConcreteReadAttri return ""; } + DeviceLayer::StackUnlock unlock; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); ChipLogProgress(Zcl, "ContentAppAttributeDelegate::Read being called for endpoint %d cluster %d attribute %d", aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId); diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp index 3963140d1b5e65..2e5dcbe0f3b5e1 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include namespace chip { @@ -50,6 +51,7 @@ void ContentAppCommandDelegate::InvokeCommand(CommandHandlerInterface::HandlerCo { if (handlerContext.mRequestPath.mEndpointId >= FIXED_ENDPOINT_COUNT) { + DeviceLayer::StackUnlock unlock; TLV::TLVReader readerForJson; readerForJson.Init(handlerContext.mPayload); diff --git a/examples/tv-app/android/java/ContentLauncherManager.cpp b/examples/tv-app/android/java/ContentLauncherManager.cpp index caa14b04f9e938..f68e1131fa6fb8 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -51,6 +51,7 @@ void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper playbackPreferences, bool useCurrentContext) { + DeviceLayer::StackUnlock unlock; Commands::LauncherResponse::Type response; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -61,6 +62,7 @@ void ContentLauncherManager::HandleLaunchContent(CommandResponseHelperExceptionClear(); { UtfString jData(env, data); @@ -106,6 +108,7 @@ void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelperExceptionClear(); + { UtfString jContentUrl(env, contentUrl); UtfString jDisplayString(env, displayString); @@ -160,6 +165,7 @@ void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelper acceptedHeadersList; @@ -170,6 +176,8 @@ CHIP_ERROR ContentLauncherManager::HandleGetAcceptHeaderList(AttributeValueEncod VerifyOrExit(mContentLauncherManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetAcceptHeaderMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { jobjectArray acceptedHeadersArray = (jobjectArray) env->CallObjectMethod(mContentLauncherManagerObject.ObjectRef(), mGetAcceptHeaderMethod); @@ -203,6 +211,7 @@ CHIP_ERROR ContentLauncherManager::HandleGetAcceptHeaderList(AttributeValueEncod uint32_t ContentLauncherManager::HandleGetSupportedStreamingProtocols() { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); uint32_t supportedStreamingProtocols = 0; @@ -213,6 +222,8 @@ uint32_t ContentLauncherManager::HandleGetSupportedStreamingProtocols() VerifyOrExit(mContentLauncherManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetSupportedStreamingProtocolsMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + { jlong jSupportedStreamingProtocols = env->CallLongMethod(mContentLauncherManagerObject.ObjectRef(), mGetSupportedStreamingProtocolsMethod); diff --git a/examples/tv-app/android/java/KeypadInputManager.cpp b/examples/tv-app/android/java/KeypadInputManager.cpp index a43a56cb860978..2382397fc351d9 100644 --- a/examples/tv-app/android/java/KeypadInputManager.cpp +++ b/examples/tv-app/android/java/KeypadInputManager.cpp @@ -44,6 +44,7 @@ void KeypadInputManager::NewManager(jint endpoint, jobject manager) void KeypadInputManager::HandleSendKey(CommandResponseHelper & helper, const CECKeyCodeEnum & keyCode) { + DeviceLayer::StackUnlock unlock; Commands::SendKeyResponse::Type response; jint ret = -1; diff --git a/examples/tv-app/android/java/LevelManager.cpp b/examples/tv-app/android/java/LevelManager.cpp index b79f150c7ae20e..f9be7578e830ab 100644 --- a/examples/tv-app/android/java/LevelManager.cpp +++ b/examples/tv-app/android/java/LevelManager.cpp @@ -112,6 +112,7 @@ CHIP_ERROR LevelManager::InitializeWithObjects(jobject managerObject) void LevelManager::HandleLevelChanged(uint8_t value) { + DeviceLayer::StackUnlock unlock; ChipLogProgress(Zcl, "LevelManager::HandleLevelChanged"); JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); diff --git a/examples/tv-app/android/java/LowPowerManager.cpp b/examples/tv-app/android/java/LowPowerManager.cpp index 12e234964d4c5e..5c6906fcd1d659 100644 --- a/examples/tv-app/android/java/LowPowerManager.cpp +++ b/examples/tv-app/android/java/LowPowerManager.cpp @@ -64,6 +64,7 @@ void LowPowerManager::InitializeWithObjects(jobject managerObject) bool LowPowerManager::HandleSleep() { + DeviceLayer::StackUnlock unlock; jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); JniLocalReferenceScope scope(env); diff --git a/examples/tv-app/android/java/MediaInputManager.cpp b/examples/tv-app/android/java/MediaInputManager.cpp index bbc575b6eab378..0f1c922243c2be 100644 --- a/examples/tv-app/android/java/MediaInputManager.cpp +++ b/examples/tv-app/android/java/MediaInputManager.cpp @@ -51,6 +51,7 @@ void MediaInputManager::NewManager(jint endpoint, jobject manager) CHIP_ERROR MediaInputManager::HandleGetInputList(chip::app::AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NO_ENV, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -60,6 +61,8 @@ CHIP_ERROR MediaInputManager::HandleGetInputList(chip::app::AttributeValueEncode VerifyOrExit(mMediaInputManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetInputListMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { jobjectArray inputArray = (jobjectArray) env->CallObjectMethod(mMediaInputManagerObject.ObjectRef(), mGetInputListMethod); if (env->ExceptionCheck()) @@ -121,6 +124,7 @@ CHIP_ERROR MediaInputManager::HandleGetInputList(chip::app::AttributeValueEncode uint8_t MediaInputManager::HandleGetCurrentInput() { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; jint index = -1; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -130,7 +134,8 @@ uint8_t MediaInputManager::HandleGetCurrentInput() ChipLogProgress(Zcl, "Received MediaInputManager::HandleGetCurrentInput"); VerifyOrExit(mMediaInputManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetCurrentInputMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); + + env->ExceptionClear(); { index = env->CallIntMethod(mMediaInputManagerObject.ObjectRef(), mGetCurrentInputMethod); @@ -154,6 +159,7 @@ uint8_t MediaInputManager::HandleGetCurrentInput() bool MediaInputManager::HandleSelectInput(const uint8_t index) { + DeviceLayer::StackUnlock unlock; jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -179,6 +185,7 @@ bool MediaInputManager::HandleSelectInput(const uint8_t index) bool MediaInputManager::HandleShowInputStatus() { + DeviceLayer::StackUnlock unlock; jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -204,6 +211,7 @@ bool MediaInputManager::HandleShowInputStatus() bool MediaInputManager::HandleHideInputStatus() { + DeviceLayer::StackUnlock unlock; jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -229,6 +237,7 @@ bool MediaInputManager::HandleHideInputStatus() bool MediaInputManager::HandleRenameInput(const uint8_t index, const chip::CharSpan & name) { + DeviceLayer::StackUnlock unlock; std::string inputname(name.data(), name.size()); jboolean ret = JNI_FALSE; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -239,9 +248,10 @@ bool MediaInputManager::HandleRenameInput(const uint8_t index, const chip::CharS VerifyOrExit(mMediaInputManagerObject.HasValidObjectRef(), ChipLogError(Zcl, "mMediaInputManagerObject is not valid")); VerifyOrExit(mRenameInputMethod != nullptr, ChipLogError(Zcl, "mHideInputStatusMethod null")); + env->ExceptionClear(); + { UtfString jniInputname(env, inputname.data()); - env->ExceptionClear(); ret = env->CallBooleanMethod(mMediaInputManagerObject.ObjectRef(), mRenameInputMethod, static_cast(index), jniInputname.jniValue()); if (env->ExceptionCheck()) diff --git a/examples/tv-app/android/java/MediaPlaybackManager.cpp b/examples/tv-app/android/java/MediaPlaybackManager.cpp index 62abeb12ec30eb..667ab2ec41b382 100644 --- a/examples/tv-app/android/java/MediaPlaybackManager.cpp +++ b/examples/tv-app/android/java/MediaPlaybackManager.cpp @@ -97,6 +97,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetActiveAudioTrack(AttributeValueEncoder CHIP_ERROR MediaPlaybackManager::HandleGetActiveTrack(bool audio, AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; Structs::TrackStruct::Type response; Structs::TrackAttributesStruct::Type trackAttributes; response.trackAttributes = Nullable(trackAttributes); @@ -170,6 +171,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetAvailableAudioTracks(AttributeValueEnc CHIP_ERROR MediaPlaybackManager::HandleGetAvailableTracks(bool audio, AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); @@ -179,6 +181,8 @@ CHIP_ERROR MediaPlaybackManager::HandleGetAvailableTracks(bool audio, AttributeV VerifyOrExit(mMediaPlaybackManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetAvailableTracksMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + return aEncoder.EncodeList([this, env, audio](const auto & encoder) -> CHIP_ERROR { jobjectArray trackList = (jobjectArray) env->CallObjectMethod(mMediaPlaybackManagerObject.ObjectRef(), mGetAvailableTracksMethod, static_cast(audio)); @@ -317,6 +321,7 @@ bool MediaPlaybackManager::HandleActivateAudioTrack(const chip::CharSpan & track bool MediaPlaybackManager::HandleActivateTrack(bool audio, const chip::CharSpan & trackId) { + DeviceLayer::StackUnlock unlock; std::string id(trackId.data(), trackId.size()); jint ret = -1; @@ -328,9 +333,11 @@ bool MediaPlaybackManager::HandleActivateTrack(bool audio, const chip::CharSpan ChipLogProgress(Zcl, "MediaPlaybackManager::HandleActivateAudioTrack"); VerifyOrExit(mMediaPlaybackManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mActivateTrackMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + env->ExceptionClear(); + { UtfString jniid(env, id.c_str()); - env->ExceptionClear(); ret = env->CallIntMethod(mMediaPlaybackManagerObject.ObjectRef(), mActivateTrackMethod, static_cast(audio), jniid.jniValue()); if (env->ExceptionCheck()) @@ -351,6 +358,7 @@ bool MediaPlaybackManager::HandleActivateTextTrack(const chip::CharSpan & trackI bool MediaPlaybackManager::HandleDeactivateTextTrack() { + DeviceLayer::StackUnlock unlock; jint ret = -1; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -439,6 +447,7 @@ void MediaPlaybackManager::InitializeWithObjects(jobject managerObject) uint64_t MediaPlaybackManager::HandleMediaRequestGetAttribute(MediaPlaybackRequestAttribute attribute) { + DeviceLayer::StackUnlock unlock; uint64_t ret = std::numeric_limits::max(); jlong jAttributeValue = -1; CHIP_ERROR err = CHIP_NO_ERROR; @@ -450,6 +459,8 @@ uint64_t MediaPlaybackManager::HandleMediaRequestGetAttribute(MediaPlaybackReque VerifyOrExit(mMediaPlaybackManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetAttributeMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + jAttributeValue = env->CallLongMethod(mMediaPlaybackManagerObject.ObjectRef(), mGetAttributeMethod, static_cast(attribute)); if (env->ExceptionCheck()) @@ -480,6 +491,7 @@ uint64_t MediaPlaybackManager::HandleMediaRequestGetAttribute(MediaPlaybackReque long MediaPlaybackManager::HandleMediaRequestGetLongAttribute(MediaPlaybackRequestAttribute attribute) { + DeviceLayer::StackUnlock unlock; long ret = 0; jlong jAttributeValue = -1; CHIP_ERROR err = CHIP_NO_ERROR; @@ -491,6 +503,8 @@ long MediaPlaybackManager::HandleMediaRequestGetLongAttribute(MediaPlaybackReque VerifyOrExit(mMediaPlaybackManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mGetAttributeMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->ExceptionClear(); + jAttributeValue = env->CallLongMethod(mMediaPlaybackManagerObject.ObjectRef(), mGetAttributeMethod, static_cast(attribute)); if (env->ExceptionCheck()) @@ -516,6 +530,7 @@ Commands::PlaybackResponse::Type MediaPlaybackManager::HandleMediaRequest(MediaP uint64_t deltaPositionMilliseconds) { + DeviceLayer::StackUnlock unlock; Commands::PlaybackResponse::Type response; jint ret = -1; @@ -553,6 +568,7 @@ Commands::PlaybackResponse::Type MediaPlaybackManager::HandleMediaRequest(MediaP CHIP_ERROR MediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; Structs::PlaybackPositionStruct::Type response; response.updatedAt = 0; response.position = Nullable(0); diff --git a/examples/tv-app/android/java/MessagesManager.cpp b/examples/tv-app/android/java/MessagesManager.cpp new file mode 100644 index 00000000000000..9203d7b54510f5 --- /dev/null +++ b/examples/tv-app/android/java/MessagesManager.cpp @@ -0,0 +1,454 @@ +/** + * + * Copyright (c) 2024 Project CHIP Authors + * + * 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. + */ + +#include "MessagesManager.h" +#include "TvApp-JNI.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::Messages; +using namespace chip::Uint8; +using MessageResponseOption = chip::app::Clusters::Messages::Structs::MessageResponseOptionStruct::Type; + +/** @brief Messages Cluster Init + * + * This function is called when a specific cluster is initialized. It gives the + * application an opportunity to take care of cluster initialization procedures. + * It is called exactly once for each endpoint where cluster is present. + * + */ +void emberAfMessagesClusterInitCallback(EndpointId endpoint) +{ + ChipLogProgress(Zcl, "------------TV Android App: Messages::PostClusterInit"); + TvAppJNIMgr().PostClusterInit(chip::app::Clusters::Messages::Id, endpoint); +} + +void MessagesManager::NewManager(jint endpoint, jobject manager) +{ + ChipLogProgress(Zcl, "-----TV Android App: Messages::SetDefaultDelegate"); + MessagesManager * mgr = new MessagesManager(); + VerifyOrReturn(mgr != nullptr, ChipLogError(Zcl, "Failed to create MessagesManager")); + mgr->InitializeWithObjects(manager); + chip::app::Clusters::Messages::SetDefaultDelegate(static_cast(endpoint), mgr); +} + +void MessagesManager::InitializeWithObjects(jobject managerObject) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Failed to GetEnvForCurrentThread for MessagesManager")); + + VerifyOrReturn(mMessagesManagerObject.Init(managerObject) == CHIP_NO_ERROR, + ChipLogError(Zcl, "Failed to init mMessagesManagerObject")); + + jclass managerClass = env->GetObjectClass(managerObject); + VerifyOrReturn(managerClass != nullptr, ChipLogError(Zcl, "Failed to get MessagesManager Java class")); + + mGetMessagesMethod = env->GetMethodID(managerClass, "getMessages", "()[Lcom/matter/tv/server/tvapp/Message;"); + if (mGetMessagesMethod == nullptr) + { + ChipLogError(Zcl, "Failed to access MessagesManager 'getMessages' method"); + env->ExceptionClear(); + } + + mPresentMessagesMethod = + env->GetMethodID(managerClass, "presentMessages", "(Ljava/lang/String;IIJILjava/lang/String;Ljava/util/HashMap;)Z"); + if (mPresentMessagesMethod == nullptr) + { + ChipLogError(Zcl, "Failed to access MessagesManager 'presentMessages' method"); + env->ExceptionClear(); + } + + mCancelMessagesMethod = env->GetMethodID(managerClass, "cancelMessage", "(Ljava/lang/String;)Z"); + if (mCancelMessagesMethod == nullptr) + { + ChipLogError(Zcl, "Failed to access MessagesManager 'cancelMessage' method"); + env->ExceptionClear(); + } +} + +uint32_t MessagesManager::GetFeatureMap(chip::EndpointId endpoint) +{ + if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT) + { + return kEndpointFeatureMap; + } + + BitMask FeatureMap; + FeatureMap.Set(Feature::kReceivedConfirmation); + FeatureMap.Set(Feature::kConfirmationResponse); + FeatureMap.Set(Feature::kConfirmationReply); + FeatureMap.Set(Feature::kProtectedMessages); + + uint32_t featureMap = FeatureMap.Raw(); + // forcing to all features since this implementation supports all + // Attributes::FeatureMap::Get(endpoint, &featureMap); + return featureMap; +} + +CHIP_ERROR MessagesManager::HandleGetMessages(AttributeValueEncoder & aEncoder) +{ + DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); + JniLocalReferenceScope scope(env); + + env->ExceptionClear(); + + ChipLogProgress(Zcl, "Received MessagesManager::HandleGetMessages"); + VerifyOrExit(mMessagesManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mGetMessagesMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { + jobjectArray messagesList = + static_cast(env->CallObjectMethod(mMessagesManagerObject.ObjectRef(), mGetMessagesMethod)); + if (env->ExceptionCheck()) + { + ChipLogError(Zcl, "Java exception in MessagesManager::HandleGetMessages"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return CHIP_ERROR_INCORRECT_STATE; + } + + jint length = env->GetArrayLength(messagesList); + + for (jint i = 0; i < length; i++) + { + std::vector options; + std::vector optionLabels; + uint8_t buf[kMessageIdLength]; + + chip::app::Clusters::Messages::Structs::MessageStruct::Type message; + jobject messageObject = env->GetObjectArrayElement(messagesList, i); + jclass messageClass = env->GetObjectClass(messageObject); + + jfieldID getMessageIdField = env->GetFieldID(messageClass, "messageId", "Ljava/lang/String;"); + jstring jmessageId = static_cast(env->GetObjectField(messageObject, getMessageIdField)); + JniUtfString messageId(env, jmessageId); + if (jmessageId != nullptr) + { + VerifyOrReturnValue(chip::Encoding::HexToBytes(messageId.charSpan().data(), messageId.charSpan().size(), buf, + sizeof(buf)) == sizeof(buf), + CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(Zcl, "HexToBytes failed")); + message.messageID = ByteSpan(buf, sizeof(buf)); + } + + jfieldID getMessageTextField = env->GetFieldID(messageClass, "messageText", "Ljava/lang/String;"); + jstring jmessageText = static_cast(env->GetObjectField(messageObject, getMessageTextField)); + JniUtfString messageText(env, jmessageText); + if (jmessageText != nullptr) + { + message.messageText = messageText.charSpan(); + } + + jfieldID messageControlField = env->GetFieldID(messageClass, "messageControl", "I"); + jint jmessageControl = env->GetIntField(messageObject, messageControlField); + message.messageControl = static_cast>(static_cast(jmessageControl)); + + jfieldID priorityField = env->GetFieldID(messageClass, "priority", "I"); + jint jpriority = env->GetIntField(messageObject, priorityField); + if (jpriority >= 0) + { + message.priority = MessagePriorityEnum(static_cast(jpriority)); + } + + jfieldID startTimeField = env->GetFieldID(messageClass, "startTime", "J"); + jlong jstartTime = env->GetLongField(messageObject, startTimeField); + if (jstartTime >= 0) + { + message.startTime = DataModel::Nullable(static_cast(jstartTime)); + } + + jfieldID durationField = env->GetFieldID(messageClass, "duration", "I"); + jint jduration = env->GetIntField(messageObject, durationField); + if (jduration >= 0) + { + message.duration = DataModel::Nullable(static_cast(jduration)); + } + + jfieldID getResponseOptionsField = + env->GetFieldID(messageClass, "responseOptions", "[Lcom/matter/tv/server/tvapp/MessageResponseOption;"); + + jobjectArray responsesArray = static_cast(env->GetObjectField(messageObject, getResponseOptionsField)); + jint size = env->GetArrayLength(responsesArray); + if (size > 0) + { + for (jint j = 0; j < size; j++) + { + MessageResponseOption option; + + jobject responseOptionObject = env->GetObjectArrayElement(responsesArray, j); + jclass responseOptionClass = env->GetObjectClass(responseOptionObject); + + jfieldID idField = env->GetFieldID(responseOptionClass, "id", "J"); + jlong jid = env->GetLongField(responseOptionObject, idField); + option.messageResponseID = Optional(static_cast(jid)); + + jfieldID getLabelField = env->GetFieldID(responseOptionClass, "label", "Ljava/lang/String;"); + jstring jlabelText = static_cast(env->GetObjectField(responseOptionObject, getLabelField)); + VerifyOrReturnValue(jlabelText != nullptr, CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(Zcl, "jlabelText null")); + JniUtfString * label = new JniUtfString(env, jlabelText); + VerifyOrReturnValue(label != nullptr, CHIP_ERROR_NO_MEMORY, ChipLogError(Zcl, "label null")); + + optionLabels.push_back(label); + + option.label = Optional(label->charSpan()); + + options.push_back(option); + } + + message.responses = Optional>( + DataModel::List(options.data(), options.size())); + } + ReturnErrorOnFailure(encoder.Encode(message)); + for (JniUtfString * optionLabel : optionLabels) + { + delete optionLabel; + } + } + + return CHIP_NO_ERROR; + }); + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "MessagesManager::HandleGetMessages status error: %s", err.AsString()); + } + return err; +} + +CHIP_ERROR MessagesManager::HandleGetActiveMessageIds(AttributeValueEncoder & aEncoder) +{ + DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); + JniLocalReferenceScope scope(env); + + ChipLogProgress(Zcl, "Received MessagesManager::HandleGetActiveMessageIds"); + VerifyOrExit(mMessagesManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mGetMessagesMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + env->ExceptionClear(); + + return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { + jobjectArray messagesList = + static_cast(env->CallObjectMethod(mMessagesManagerObject.ObjectRef(), mGetMessagesMethod)); + if (env->ExceptionCheck()) + { + ChipLogError(Zcl, "Java exception in MessagesManager::HandleGetActiveMessageIds"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return CHIP_ERROR_INCORRECT_STATE; + } + + jint length = env->GetArrayLength(messagesList); + + for (jint i = 0; i < length; i++) + { + jobject messageObject = env->GetObjectArrayElement(messagesList, i); + jclass messageClass = env->GetObjectClass(messageObject); + + jfieldID getMessageIdField = env->GetFieldID(messageClass, "messageId", "Ljava/lang/String;"); + jstring jmessageId = static_cast(env->GetObjectField(messageObject, getMessageIdField)); + JniUtfString messageId(env, jmessageId); + if (jmessageId != nullptr) + { + uint8_t buf[kMessageIdLength]; + VerifyOrReturnValue(chip::Encoding::HexToBytes(messageId.charSpan().data(), messageId.charSpan().size(), buf, + sizeof(buf)) == sizeof(buf), + CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(Zcl, "HexToBytes failed")); + + ReturnErrorOnFailure(encoder.Encode(ByteSpan(buf, sizeof(buf)))); + } + } + + return CHIP_NO_ERROR; + }); + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "MessagesManager::HandleGetMessages status error: %s", err.AsString()); + } + + return err; +} + +CHIP_ERROR MessagesManager::HandlePresentMessagesRequest( + const ByteSpan & messageId, const MessagePriorityEnum & priority, const BitMask & messageControl, + const DataModel::Nullable & startTime, const DataModel::Nullable & duration, const CharSpan & messageText, + const Optional> & responses) +{ + DeviceLayer::StackUnlock unlock; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); + JniLocalReferenceScope scope(env); + + ChipLogProgress(Zcl, "Received MessagesManager::HandlePresentMessagesRequest"); + VerifyOrReturnError(mMessagesManagerObject.HasValidObjectRef(), CHIP_ERROR_INCORRECT_STATE, + ChipLogError(Zcl, "Invalid mMessagesManagerObject")); + VerifyOrReturnError(mPresentMessagesMethod != nullptr, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(Zcl, "mPresentMessagesMethod null")); + + env->ExceptionClear(); + { + char hex_buf[(kMessageIdLength * 2) + 1]; + VerifyOrReturnError( + CHIP_NO_ERROR == + chip::Encoding::BytesToUppercaseHexString(messageId.data(), messageId.size(), hex_buf, sizeof(hex_buf)), + CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "BytesToUppercaseHexString failed")); + + jstring jid = env->NewStringUTF(hex_buf); + if (jid == nullptr) + { + return CHIP_ERROR_INTERNAL; + } + + std::string smessageText(messageText.data(), messageText.size()); + jstring jmessageText = env->NewStringUTF(smessageText.c_str()); + if (jmessageText == nullptr) + { + return CHIP_ERROR_INTERNAL; + } + + jint jcontrol = static_cast(messageControl.Raw()); + jint jduration = -1; + if (!duration.IsNull()) + { + jduration = static_cast(duration.Value()); + } + jlong jstartTime = -1; + if (!startTime.IsNull()) + { + jstartTime = static_cast(startTime.Value()); + } + + jint jpriority = static_cast(priority); + + jclass hashMapClass = env->FindClass("java/util/HashMap"); + VerifyOrReturnError(hashMapClass != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Could not find class HashMap")); + jmethodID hashMapCtor = env->GetMethodID(hashMapClass, "", "()V"); + VerifyOrReturnError(hashMapCtor != nullptr, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(Zcl, "Could not find HashMap constructor")); + jobject joptions = env->NewObject(hashMapClass, hashMapCtor); + VerifyOrReturnError(joptions != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Could not create HashMap")); + + if (responses.HasValue()) + { + jmethodID hashMapPut = + env->GetMethodID(hashMapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + VerifyOrReturnError(hashMapPut != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Could not find HashMap put")); + + jclass longClass = env->FindClass("java/lang/Long"); + VerifyOrReturnError(longClass != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Could not find class Long")); + jmethodID longCtor = env->GetMethodID(longClass, "", "(J)V"); + VerifyOrReturnError(longCtor != nullptr, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(Zcl, "Could not find Long constructor")); + + auto iter = responses.Value().begin(); + while (iter.Next()) + { + auto & response = iter.GetValue(); + + std::string label(response.label.Value().data(), response.label.Value().size()); + jstring jlabel = env->NewStringUTF(label.c_str()); + if (jlabel == nullptr) + { + return CHIP_ERROR_INTERNAL; + } + + jobject jlong = env->NewObject(longClass, longCtor, response.messageResponseID.Value()); + VerifyOrReturnError(jlong != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Could not create Long")); + + // add to HashMap + env->CallObjectMethod(joptions, hashMapPut, jlong, jlabel); + if (env->ExceptionCheck()) + { + ChipLogError(DeviceLayer, "Java exception in MessagesManager::HandlePresentMessagesRequest"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return CHIP_ERROR_INTERNAL; + } + } + } + + env->CallBooleanMethod(mMessagesManagerObject.ObjectRef(), mPresentMessagesMethod, jid, jpriority, jcontrol, jstartTime, + jduration, jmessageText, joptions); + if (env->ExceptionCheck()) + { + ChipLogError(DeviceLayer, "Java exception in MessagesManager::HandlePresentMessagesRequest"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return CHIP_ERROR_INTERNAL; + } + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR MessagesManager::HandleCancelMessagesRequest(const DataModel::DecodableList & messageIds) +{ + DeviceLayer::StackUnlock unlock; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread")); + JniLocalReferenceScope scope(env); + + ChipLogProgress(Zcl, "Received MessagesManager::HandleCancelMessagesRequest"); + VerifyOrReturnError(mMessagesManagerObject.HasValidObjectRef(), CHIP_ERROR_INCORRECT_STATE, + ChipLogError(Zcl, "Invalid mMessagesManagerObject")); + VerifyOrReturnError(mCancelMessagesMethod != nullptr, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(Zcl, "mCancelMessagesMethod null")); + + env->ExceptionClear(); + + auto iter = messageIds.begin(); + while (iter.Next()) + { + auto & id = iter.GetValue(); + + char hex_buf[(kMessageIdLength * 2) + 1]; + VerifyOrReturnError(CHIP_NO_ERROR == + chip::Encoding::BytesToUppercaseHexString(id.data(), id.size(), hex_buf, sizeof(hex_buf)), + CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "BytesToUppercaseHexString failed")); + + jstring jid = env->NewStringUTF(hex_buf); + if (jid == nullptr) + { + return CHIP_ERROR_INTERNAL; + } + + env->CallBooleanMethod(mMessagesManagerObject.ObjectRef(), mCancelMessagesMethod, jid); + if (env->ExceptionCheck()) + { + ChipLogError(DeviceLayer, "Java exception in MessagesManager::HandleCancelMessagesRequest"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return CHIP_ERROR_INTERNAL; + } + } + return CHIP_NO_ERROR; +} diff --git a/examples/tv-app/android/java/MessagesManager.h b/examples/tv-app/android/java/MessagesManager.h new file mode 100644 index 00000000000000..563192a542bdf6 --- /dev/null +++ b/examples/tv-app/android/java/MessagesManager.h @@ -0,0 +1,63 @@ +/** + * + * Copyright (c) 2024 Project CHIP Authors + * + * 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 + +class MessagesManager : public chip::app::Clusters::Messages::Delegate +{ +public: + static void NewManager(jint endpoint, jobject manager); + void InitializeWithObjects(jobject managerObject); + + // Commands + CHIP_ERROR HandlePresentMessagesRequest( + const chip::ByteSpan & messageId, const chip::app::Clusters::Messages::MessagePriorityEnum & priority, + const chip::BitMask & messageControl, + const chip::app::DataModel::Nullable & startTime, const chip::app::DataModel::Nullable & duration, + const chip::CharSpan & messageText, + const chip::Optional< + chip::app::DataModel::DecodableList> & + responses) override; + CHIP_ERROR HandleCancelMessagesRequest(const chip::app::DataModel::DecodableList & messageIds) override; + + // Attributes + CHIP_ERROR HandleGetMessages(chip::app::AttributeValueEncoder & aEncoder) override; + CHIP_ERROR HandleGetActiveMessageIds(chip::app::AttributeValueEncoder & aEncoder) override; + + // Global Attributes + uint32_t GetFeatureMap(chip::EndpointId endpoint) override; + // uint16_t GetClusterRevision(chip::EndpointId endpoint) override; + +private: + chip::JniGlobalReference mMessagesManagerObject; + jmethodID mGetMessagesMethod = nullptr; + + jmethodID mPresentMessagesMethod = nullptr; + jmethodID mCancelMessagesMethod = nullptr; + + // TODO: set this based upon meta data from app + static constexpr uint32_t kEndpointFeatureMap = 15; + // static constexpr uint16_t kClusterRevision = 1; +}; diff --git a/examples/tv-app/android/java/MyUserPrompter-JNI.cpp b/examples/tv-app/android/java/MyUserPrompter-JNI.cpp index d2c83b28a1ce8f..82b06e210d7853 100644 --- a/examples/tv-app/android/java/MyUserPrompter-JNI.cpp +++ b/examples/tv-app/android/java/MyUserPrompter-JNI.cpp @@ -78,6 +78,7 @@ JNIMyUserPrompter::JNIMyUserPrompter(jobject provider) */ void JNIMyUserPrompter::PromptForCommissionOKPermission(uint16_t vendorId, uint16_t productId, const char * commissioneeName) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); std::string stringCommissioneeName(commissioneeName); @@ -119,6 +120,7 @@ void JNIMyUserPrompter::PromptForCommissionOKPermission(uint16_t vendorId, uint1 void JNIMyUserPrompter::PromptForCommissionPasscode(uint16_t vendorId, uint16_t productId, const char * commissioneeName, uint16_t pairingHint, const char * pairingInstruction) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); std::string stringCommissioneeName(commissioneeName); @@ -198,6 +200,7 @@ void JNIMyUserPrompter::PromptCommissioningStarted(uint16_t vendorId, uint16_t p */ void JNIMyUserPrompter::PromptCommissioningSucceeded(uint16_t vendorId, uint16_t productId, const char * commissioneeName) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); std::string stringCommissioneeName(commissioneeName); @@ -234,6 +237,7 @@ void JNIMyUserPrompter::PromptCommissioningSucceeded(uint16_t vendorId, uint16_t */ void JNIMyUserPrompter::PromptCommissioningFailed(const char * commissioneeName, CHIP_ERROR error) { + DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); std::string stringCommissioneeName(commissioneeName); diff --git a/examples/tv-app/android/java/OnOffManager.cpp b/examples/tv-app/android/java/OnOffManager.cpp index 9a330754aa4a16..db694748e8a11b 100644 --- a/examples/tv-app/android/java/OnOffManager.cpp +++ b/examples/tv-app/android/java/OnOffManager.cpp @@ -113,6 +113,7 @@ CHIP_ERROR OnOffManager::InitializeWithObjects(jobject managerObject) void OnOffManager::HandleOnOffChanged(bool value) { + DeviceLayer::StackUnlock unlock; ChipLogProgress(Zcl, "OnOffManager::HandleOnOffChanged"); JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 6bbc35ed297415..72279c49dca9d7 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -27,6 +27,7 @@ #include "LowPowerManager.h" #include "MediaInputManager.h" #include "MediaPlaybackManager.h" +#include "MessagesManager.h" #include "MyUserPrompter-JNI.h" #include "OnOffManager.h" #include "WakeOnLanManager.h" @@ -137,6 +138,11 @@ JNI_METHOD(void, setMediaPlaybackManager)(JNIEnv *, jobject, jint endpoint, jobj MediaPlaybackManager::NewManager(endpoint, manager); } +JNI_METHOD(void, setMessagesManager)(JNIEnv *, jobject, jint endpoint, jobject manager) +{ + MessagesManager::NewManager(endpoint, manager); +} + JNI_METHOD(void, setChannelManager)(JNIEnv *, jobject, jint endpoint, jobject manager) { ChannelManager::NewManager(endpoint, manager); diff --git a/examples/tv-app/android/java/WakeOnLanManager.cpp b/examples/tv-app/android/java/WakeOnLanManager.cpp index 5a3093aca53332..a50ddca72bbb3e 100644 --- a/examples/tv-app/android/java/WakeOnLanManager.cpp +++ b/examples/tv-app/android/java/WakeOnLanManager.cpp @@ -51,6 +51,7 @@ void WakeOnLanManager::NewManager(jint endpoint, jobject manager) CHIP_ERROR WakeOnLanManager::HandleGetMacAddress(chip::app::AttributeValueEncoder & aEncoder) { + DeviceLayer::StackUnlock unlock; jobject javaMac; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Clusters.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Clusters.java index d699ca68ea6365..5928c1b10181c7 100644 --- a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Clusters.java +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Clusters.java @@ -129,7 +129,7 @@ public class Clusters { public static final long ClusterId_ApplicationBasic = 0x0000050D; public static final long ClusterId_AccountLogin = 0x0000050E; public static final long ClusterId_TestCluster = 0xFFF1FC05; - public static final long ClusterId_Messaging = 0x00000703; + public static final long ClusterId_Messaging = 0x00000097; public static final long ClusterId_ApplianceIdentification = 0x00000B00; public static final long ClusterId_MeterIdentification = 0x00000B01; public static final long ClusterId_ApplianceEventsAndAlert = 0x00000B02; diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Message.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Message.java new file mode 100644 index 00000000000000..c194ffb44f9ee1 --- /dev/null +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/Message.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 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. + * + */ +package com.matter.tv.server.tvapp; + +public class Message { + + public String messageId; + public int priority; + public int messageControl; + public long startTime; + public int duration; + public String messageText; + public MessageResponseOption responseOptions[]; + + public Message( + String messageId, + int priority, + int messageControl, + long startTime, + int duration, + String messageText, + MessageResponseOption responseOptions[]) { + this.messageId = messageId; + this.priority = priority; + this.messageControl = messageControl; + this.startTime = startTime; + this.duration = duration; + this.messageText = messageText; + this.responseOptions = responseOptions; + } +} diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessageResponseOption.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessageResponseOption.java new file mode 100644 index 00000000000000..5d8e77d1e91389 --- /dev/null +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessageResponseOption.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 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. + * + */ +package com.matter.tv.server.tvapp; + +public class MessageResponseOption { + public long id = -1; + public String label = "na"; + + public MessageResponseOption(long id, String label) { + this.id = id; + this.label = label; + } +} diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManager.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManager.java new file mode 100644 index 00000000000000..0a5680866714c6 --- /dev/null +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManager.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 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. + * + */ +package com.matter.tv.server.tvapp; + +import java.util.HashMap; + +public interface MessagesManager { + + Message[] getMessages(); + + boolean presentMessages( + String messageId, + int priority, + int messageControl, + long startTime, + int duration, + String messageText, + HashMap responseOptions); + + boolean cancelMessage(String messageId); +} diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java new file mode 100644 index 00000000000000..63fef69d35c936 --- /dev/null +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 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. + * + */ +package com.matter.tv.server.tvapp; + +import android.util.Log; +import java.util.HashMap; +import java.util.Map; + +public class MessagesManagerStub implements MessagesManager { + private static final String TAG = MessagesManagerStub.class.getSimpleName(); + + private int endpoint = -1; + + private Map messages = new HashMap(); + + public MessagesManagerStub(int endpoint) { + this.endpoint = endpoint; + Log.d(TAG, "MessagesManagerStub: at " + this.endpoint); + + HashMap responseOptions = new HashMap(); + responseOptions.put(new Long(1), "Yes"); + responseOptions.put(new Long(2), "No"); + presentMessages( + "31323334353637383930313233343536", 1, 1, 30, 60, "TestMessage", responseOptions); + Log.d(TAG, "MessagesManagerStub: added dummy message"); + } + + @Override + public Message[] getMessages() { + Log.d(TAG, "getMessages: at " + this.endpoint); + return messages.values().toArray(new Message[0]); + } + + @Override + public boolean presentMessages( + String messageId, + int priority, + int messageControl, + long startTime, + int duration, + String messageText, + HashMap responseOptions) { + Log.d( + TAG, "presentMessages: at " + this.endpoint + " id:" + messageId + " text:" + messageText); + MessageResponseOption[] options = new MessageResponseOption[responseOptions.size()]; + int i = 0; + + for (Map.Entry set : responseOptions.entrySet()) { + Log.d(TAG, "presentMessages option: key:" + set.getKey() + " value:" + set.getValue()); + options[i] = new MessageResponseOption(set.getKey().longValue(), set.getValue()); + i++; + } + + messages.put( + messageId, + new Message( + messageId, priority, messageControl, startTime, duration, messageText, options)); + return true; + } + + @Override + public boolean cancelMessage(String messageId) { + Log.d(TAG, "cancelMessage: at " + this.endpoint + " messageId:" + messageId); + messages.remove(messageId); + return true; // per spec, succeed unless error + } +} diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/TvApp.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/TvApp.java index d8bb564370afa4..eaf207e45f3618 100644 --- a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/TvApp.java +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/TvApp.java @@ -57,6 +57,8 @@ private void postClusterInit(long clusterId, int endpoint) { public native void setMediaPlaybackManager(int endpoint, MediaPlaybackManager manager); + public native void setMessagesManager(int endpoint, MessagesManager manager); + public native void setChannelManager(int endpoint, ChannelManager manager); public native void setOnOffManager(int endpoint, OnOffManager manager); From 65a86ee652ef39beef8370c41446b5a5b4bcc3eb Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Feb 2024 10:42:47 -0500 Subject: [PATCH 08/13] Bump cloudbuild image version to 36 (#32222) * Bump cloudbuild image version to 36 * Undo submodule update --------- Co-authored-by: Andrei Litvin --- integrations/cloudbuild/build-all.yaml | 6 +++--- integrations/cloudbuild/smoke-test.yaml | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/integrations/cloudbuild/build-all.yaml b/integrations/cloudbuild/build-all.yaml index 6590630957d902..cdefbcf1ddbe15 100644 --- a/integrations/cloudbuild/build-all.yaml +++ b/integrations/cloudbuild/build-all.yaml @@ -6,7 +6,7 @@ steps: - "--init" - "--recursive" id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -21,7 +21,7 @@ steps: path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -85,7 +85,7 @@ steps: --target k32w-shell build --create-archives /workspace/artifacts/ - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index f05bbd0e369d2d..87e22dbbea99d0 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" git submodule update --init --recursive id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -22,7 +22,7 @@ steps: path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -43,7 +43,7 @@ steps: volumes: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -64,7 +64,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -86,7 +86,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -139,7 +139,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:35" + - name: "ghcr.io/project-chip/chip-build-vscode:36" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv From 5569f26b64cbeba74e8c7140d96e2de55ae5b809 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:44:05 -0500 Subject: [PATCH 09/13] Bump third_party/ot-br-posix/repo from `c5a7a35` to `9bdaa91` (#32200) Bumps [third_party/ot-br-posix/repo](https://github.com/openthread/ot-br-posix) from `c5a7a35` to `9bdaa91`. - [Release notes](https://github.com/openthread/ot-br-posix/releases) - [Commits](https://github.com/openthread/ot-br-posix/compare/c5a7a35e3bd2f3da8cce1e2e2a3bbe5cdeedb729...9bdaa9101663c2ce9016fb5e2b5010442b17ca26) --- updated-dependencies: - dependency-name: third_party/ot-br-posix/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/ot-br-posix/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/ot-br-posix/repo b/third_party/ot-br-posix/repo index c5a7a35e3bd2f3..9bdaa9101663c2 160000 --- a/third_party/ot-br-posix/repo +++ b/third_party/ot-br-posix/repo @@ -1 +1 @@ -Subproject commit c5a7a35e3bd2f3da8cce1e2e2a3bbe5cdeedb729 +Subproject commit 9bdaa9101663c2ce9016fb5e2b5010442b17ca26 From 932db7f1eeb5e22a98845f34e02aad12aeeae27b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:45:27 +0000 Subject: [PATCH 10/13] Bump third_party/mbedtls/repo from `ede909f` to `039c903` (#32202) Bumps [third_party/mbedtls/repo](https://github.com/ARMmbed/mbedtls) from `ede909f` to `039c903`. - [Release notes](https://github.com/ARMmbed/mbedtls/releases) - [Commits](https://github.com/ARMmbed/mbedtls/compare/ede909f99ab6e6a958a41e365251c2a1d2c4ed4d...039c903e7b2882af8e85ce5e090fd44e6a9d2289) --- updated-dependencies: - dependency-name: third_party/mbedtls/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/mbedtls/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index ede909f99ab6e6..039c903e7b2882 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit ede909f99ab6e6a958a41e365251c2a1d2c4ed4d +Subproject commit 039c903e7b2882af8e85ce5e090fd44e6a9d2289 From 9fca5a71c1b11789035cd8dcd028a8eedb798d2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:45:37 +0000 Subject: [PATCH 11/13] Bump third_party/openthread/repo from `b212a0a` to `33574ad` (#32203) Bumps [third_party/openthread/repo](https://github.com/openthread/openthread) from `b212a0a` to `33574ad`. - [Release notes](https://github.com/openthread/openthread/releases) - [Commits](https://github.com/openthread/openthread/compare/b212a0a748070ccbda765c3ebed2aab8b6b08fce...33574ad4175ffb088bcca047f4c8d5fb240d1495) --- updated-dependencies: - dependency-name: third_party/openthread/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/openthread/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/openthread/repo b/third_party/openthread/repo index b212a0a748070c..33574ad4175ffb 160000 --- a/third_party/openthread/repo +++ b/third_party/openthread/repo @@ -1 +1 @@ -Subproject commit b212a0a748070ccbda765c3ebed2aab8b6b08fce +Subproject commit 33574ad4175ffb088bcca047f4c8d5fb240d1495 From 02f5674e53f2711446ef7e07ea99308986d801b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:48:56 -0500 Subject: [PATCH 12/13] Bump third_party/libwebsockets/repo from `49bfef2` to `b71a662` (#32204) Bumps [third_party/libwebsockets/repo](https://github.com/warmcat/libwebsockets) from `49bfef2` to `b71a662`. - [Commits](https://github.com/warmcat/libwebsockets/compare/49bfef2ecd51b854b63e35d913849b6bb518a7f6...b71a6621b0b14bfc8fcbe804b036a9543af5e910) --- updated-dependencies: - dependency-name: third_party/libwebsockets/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/libwebsockets/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/libwebsockets/repo b/third_party/libwebsockets/repo index 49bfef2ecd51b8..b71a6621b0b14b 160000 --- a/third_party/libwebsockets/repo +++ b/third_party/libwebsockets/repo @@ -1 +1 @@ -Subproject commit 49bfef2ecd51b854b63e35d913849b6bb518a7f6 +Subproject commit b71a6621b0b14bfc8fcbe804b036a9543af5e910 From a2e2c8a71818cdf4c0a3efc842bfe3f4457a056b Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:06:06 +0100 Subject: [PATCH 13/13] [devcontainer] forcing devcontainer to execute docker build script using bash (#32193) --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 94ad9314b9a56c..4d5be76434e8f8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,7 @@ "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], - "initializeCommand": ".devcontainer/build.sh --tag matter-dev-environment:local --version 22", + "initializeCommand": "bash .devcontainer/build.sh --tag matter-dev-environment:local --version 22", "image": "matter-dev-environment:local", "remoteUser": "vscode", "customizations": {