Skip to content

Commit 694132b

Browse files
authored
Merge branch 'master' into feature/re-invent-app-installation-flow
2 parents 98235b2 + 7c04979 commit 694132b

File tree

83 files changed

+2085
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2085
-372
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ jobs:
332332
scripts/run_in_build_env.sh 'scripts/examples/gn_build_example.sh examples/chip-tool out/'
333333
scripts/run_in_build_env.sh 'virtualenv pyenv'
334334
source pyenv/bin/activate
335-
pip3 install -r src/setup_payload/python/requirements.txt
335+
pip3 install -r scripts/setup/requirements.setuppayload.txt
336336
python3 src/setup_payload/tests/run_python_setup_payload_test.py out/chip-tool
337337
338338
build_linux_python_lighting_device:

.github/workflows/tests.yaml

+20-20
Large diffs are not rendered by default.

config/nxp/chip-module/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ if (CONFIG_CHIP_OTA_REQUESTOR)
237237
COMMAND
238238
cp ${PROJECT_BINARY_DIR}/../modules/connectedhomeip/build_mcuboot/zephyr/zephyr.bin ${PROJECT_BINARY_DIR}/zephyr.mcuboot.bin
239239
)
240-
240+
add_dependencies(build_mcuboot ${ZEPHYR_FINAL_EXECUTABLE})
241241
set(BLOCK_SIZE "1024")
242242
dt_nodelabel(dts_partition_path NODELABEL "boot_partition")
243243
dt_reg_size(mcuboot_size PATH ${dts_partition_path})
@@ -249,7 +249,7 @@ if (CONFIG_CHIP_OTA_REQUESTOR)
249249
COMMAND
250250
dd if=${PROJECT_BINARY_DIR}/${ZEPHYR_OUTPUT_NAME}.bin of=${PROJECT_BINARY_DIR}/zephyr_full.bin bs=${BLOCK_SIZE} seek=${boot_blocks}
251251
)
252-
add_dependencies(merge_mcuboot ${ZEPHYR_FINAL_EXECUTABLE})
252+
add_dependencies(merge_mcuboot build_mcuboot)
253253

254254
if (CONFIG_CHIP_OTA_IMAGE_BUILD)
255255
chip_ota_image(chip-ota-image

config/nxp/chip-module/Kconfig.defaults

+5-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ config BT_BUF_ACL_TX_SIZE
205205

206206
config BT_RX_STACK_SIZE
207207
default 2048 if NO_OPTIMIZATIONS && DEBUG
208-
default 1536
208+
default 1600
209209

210210
config BT_DEVICE_NAME_GATT_WRITABLE
211211
bool
@@ -217,6 +217,9 @@ config HCI_NXP_ENABLE_AUTO_SLEEP
217217
config CHIP_OTA_REQUESTOR
218218
default n
219219

220+
config CHIP_DEVICE_SOFTWARE_VERSION
221+
default 1
222+
220223
# Enable extended discovery
221224
config CHIP_EXTENDED_DISCOVERY
222225
default y
@@ -225,7 +228,7 @@ config NVS_LOOKUP_CACHE
225228
default y
226229

227230
config NVS_LOOKUP_CACHE_SIZE
228-
default 512
231+
default 1024
229232

230233
if CHIP_WIFI
231234

docs/guides/nxp/nxp_zephyr_ota_software_update.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ The same procedure can be followed from the
157157
sub-section, replacing `CONFIG_CHIP_DEVICE_SOFTWARE_VERSION` with a number
158158
greater than the initial one used on the active application (Candidate
159159
application version number should be greater than the one used on the active
160-
application). By default the value is set to 0, try resetting this option to 1
160+
application). By default the value is set to 1, try resetting this option to 2
161161
to generate the OTA update Image. You can do this by adding
162-
`-DCONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1` to the west build command.
162+
`-DCONFIG_CHIP_DEVICE_SOFTWARE_VERSION=2` to the west build command.
163163

164164
The current implementation automates the following procedures:
165165

examples/platform/nxp/common/app_task/source/AppTaskZephyr.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <zephyr/logging/log.h>
3030

3131
#ifdef CONFIG_CHIP_WIFI
32-
#include <platform/nxp/zephyr/wifi/NxpWifiDriver.h>
32+
#include <platform/Zephyr/wifi/ZephyrWifiDriver.h>
3333
#endif
3434

3535
#if CONFIG_CHIP_FACTORY_DATA
@@ -62,14 +62,16 @@ K_MSGQ_DEFINE(sAppEventQueue, sizeof(AppEvent), kAppEventQueueSize, alignof(AppE
6262
#if defined(CONFIG_CHIP_WIFI)
6363
chip::DeviceLayer::NetworkCommissioning::WiFiDriver * chip::NXP::App::AppTaskZephyr::GetWifiDriverInstance()
6464
{
65-
return static_cast<chip::DeviceLayer::NetworkCommissioning::WiFiDriver *>(&(NetworkCommissioning::NxpWifiDriver::Instance()));
65+
return static_cast<chip::DeviceLayer::NetworkCommissioning::WiFiDriver *>(
66+
&(NetworkCommissioning::ZephyrWifiDriver::Instance()));
6667
}
6768
#endif // CONFIG_CHIP_WIFI
6869

6970
CHIP_ERROR chip::NXP::App::AppTaskZephyr::Start()
7071
{
71-
72+
PreInitMatterStack();
7273
ReturnErrorOnFailure(Init());
74+
PostInitMatterStack();
7375

7476
AppEvent event{};
7577

examples/platform/nxp/common/icd/source/ICDUtil.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2023 Project CHIP Authors
3+
* Copyright (c) 2023-2024 Project CHIP Authors
44
* All rights reserved.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +17,9 @@
1717
*/
1818

1919
#include "ICDUtil.h"
20+
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
21+
#include "OTARequestorInitiator.h"
22+
#endif
2023

2124
chip::NXP::App::ICDUtil chip::NXP::App::ICDUtil::sICDUtil;
2225

@@ -32,5 +35,8 @@ CHIP_ERROR chip::NXP::App::ICDUtil::OnSubscriptionRequested(chip::app::ReadHandl
3235
{
3336
agreedMaxInterval = requestedMaxInterval;
3437
}
38+
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
39+
chip::NXP::App::OTARequestorInitiator::Instance().gImageProcessor.SetRebootDelaySec(requestedMinInterval);
40+
#endif
3541
return aReadHandler.SetMaxReportingInterval(agreedMaxInterval);
3642
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include "AppFactoryData.h"
20+
21+
#include <credentials/DeviceAttestationCredsProvider.h>
22+
#include <platform/CommissionableDataProvider.h>
23+
#include <platform/DeviceInstanceInfoProvider.h>
24+
25+
#if CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA
26+
#include "FactoryDataProvider.h"
27+
/*
28+
* Test key used to encrypt factory data before storing it to the flash.
29+
* The software key should be used only during development stage.
30+
* For production usage, it is recommended to use the OTP key which needs to be fused in the RT1060 SW_GP2.
31+
*/
32+
static const uint8_t aes128TestKey[]
33+
__attribute__((aligned)) = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
34+
#else
35+
#include <credentials/examples/DeviceAttestationCredsExample.h>
36+
#endif
37+
38+
#if CONFIG_CHIP_FACTORY_DATA
39+
#include <platform/nxp/common/factory_data/FactoryDataProvider.h>
40+
#else
41+
#include <platform/nxp/zephyr/DeviceInstanceInfoProviderImpl.h>
42+
#endif
43+
44+
#if CONFIG_CHIP_FACTORY_DATA && CONFIG_CHIP_ENCRYPTED_FACTORY_DATA
45+
#ifdef CONFIG_CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY
46+
47+
#define KEY CONFIG_CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY
48+
#define HEXTONIBBLE(c) (*(c) >= 'A' ? (*(c) - 'A') + 10 : (*(c) - '0'))
49+
#define HEXTOBYTE(c) (HEXTONIBBLE(c) * 16 + HEXTONIBBLE(c + 1))
50+
#define AES128_KEY_ARRAY \
51+
HEXTOBYTE(KEY + 0), HEXTOBYTE(KEY + 2), HEXTOBYTE(KEY + 4), HEXTOBYTE(KEY + 6), HEXTOBYTE(KEY + 8), HEXTOBYTE(KEY + 10), \
52+
HEXTOBYTE(KEY + 12), HEXTOBYTE(KEY + 14), HEXTOBYTE(KEY + 16), HEXTOBYTE(KEY + 18), HEXTOBYTE(KEY + 20), \
53+
HEXTOBYTE(KEY + 22), HEXTOBYTE(KEY + 24), HEXTOBYTE(KEY + 26), HEXTOBYTE(KEY + 28), HEXTOBYTE(KEY + 30)
54+
#else
55+
#define AES128_KEY_ARRAY 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
56+
#endif /* CONFIG_CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY */
57+
58+
/*
59+
* Test key used to encrypt factory data before storing it to the flash.
60+
*/
61+
static const uint8_t aes128TestKey[] __attribute__((aligned)) = { AES128_KEY_ARRAY };
62+
63+
#endif /* CONFIG_CHIP_FACTORY_DATA && CONFIG_CHIP_ENCRYPTED_FACTORY_DATA */
64+
65+
using namespace chip;
66+
using namespace ::chip::Credentials;
67+
using namespace ::chip::DeviceLayer;
68+
69+
/**
70+
* Allows to register Matter factory data before initializing the Matter stack
71+
* Load factory data from the flash to the RAM.
72+
* Needs to be done before starting other Matter modules to avoid concurrent access issues with DCP hardware module.
73+
*
74+
* This example demonstrates the usage of the ecb with a software key, to use other encryption mode,
75+
* or to use hardware keys, check available methodes from the FactoryDataProviderImpl class.
76+
*/
77+
CHIP_ERROR NXP::App::AppFactoryData_PreMatterStackInit(void)
78+
{
79+
return CHIP_NO_ERROR;
80+
}
81+
82+
/**
83+
* Allows to register Matter factory data after initializing the Matter stack
84+
*/
85+
CHIP_ERROR NXP::App::AppFactoryData_PostMatterStackInit(void)
86+
{
87+
#if CONFIG_CHIP_FACTORY_DATA
88+
#if CONFIG_CHIP_ENCRYPTED_FACTORY_DATA
89+
FactoryDataPrvdImpl().SetEncryptionMode(FactoryDataProvider::encrypt_ecb);
90+
FactoryDataPrvdImpl().SetAes128Key(&aes128TestKey[0]);
91+
#endif /* CONFIG_CHIP_ENCRYPTED_FACTORY_DATA */
92+
ReturnErrorOnFailure(FactoryDataPrvdImpl().Init());
93+
SetDeviceInstanceInfoProvider(&FactoryDataPrvd());
94+
SetDeviceAttestationCredentialsProvider(&FactoryDataPrvd());
95+
SetCommissionableDataProvider(&FactoryDataPrvd());
96+
#else
97+
SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl());
98+
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
99+
#endif /* CONFIG_CHIP_FACTORY_DATA */
100+
return CHIP_NO_ERROR;
101+
}

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java

+24-7
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,40 @@
1313
*/
1414
package com.matter.casting.support;
1515

16-
/** @brief A container struct for User Directed Commissioning (UDC) callbacks. */
16+
/** @brief A container class for User Directed Commissioning (UDC) callbacks. */
1717
public class ConnectionCallbacks {
1818

19-
/** (Required) The callback called when the connection is established successfully. */
19+
/** The callback called when the connection is established successfully. */
2020
public final MatterCallback<Void> onSuccess;
2121

22-
/** (Required) The callback called with MatterError when the connection is fails to establish. */
22+
/** The callback called with MatterError when the connection is fails to establish. */
2323
public final MatterCallback<MatterError> onFailure;
2424

2525
/**
26-
* (Optional) The callback called when the Client/Commissionee receives a CommissionerDeclaration
27-
* message from the CastingPlayer/Commissioner. This callback is needed to support UDC features
28-
* where a reply from the Commissioner is expected. It provides information indicating the
29-
* Commissioner’s pre-commissioning state.
26+
* The callback called when the Client/Commissionee receives a CommissionerDeclaration message
27+
* from the CastingPlayer/Commissioner. This callback is needed to support UDC features where a
28+
* reply from the Commissioner is expected. It provides information indicating the Commissioner’s
29+
* pre-commissioning state.
3030
*/
3131
public MatterCallback<CommissionerDeclaration> onCommissionerDeclaration;
3232

33+
/**
34+
* The constructor for ConnectionCallbacks, the container class for User Directed Commissioning
35+
* (UDC) callbacks.
36+
*
37+
* @param onSuccess (Required) The callback called when the connection is established
38+
* successfully.
39+
* @param onFailure (Required) The callback called with MatterError when the connection is fails
40+
* to establish.
41+
* @param onCommissionerDeclaration (Optional) The callback called when the Client/Commissionee
42+
* receives a CommissionerDeclaration message from the CastingPlayer/Commissioner. This
43+
* callback is needed to support UDC features where a reply from the Commissioner is expected.
44+
* It provides information indicating the Commissioner’s pre-commissioning state.
45+
* <p>For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the
46+
* Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed
47+
* and CommissionerPasscode set to true. Given these Commissioner state details, the client is
48+
* expected to perform some actions and responf accrdingly.
49+
*/
3350
public ConnectionCallbacks(
3451
MatterCallback<Void> onSuccess,
3552
MatterCallback<MatterError> onFailure,

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
/**
2121
* This class contains the optional parameters used in the IdentificationDeclaration Message, sent
22-
* by the Commissionee to the Commissioner. The options specify information relating to the
23-
* requested UDC commissioning session.
22+
* by the Commissionee (CastingApp) to the Commissioner (CastingPlayer). The options specify
23+
* information relating to the requested UDC commissioning session.
2424
*/
2525
public class IdentificationDeclarationOptions {
2626
private final String TAG = IdentificationDeclarationOptions.class.getSimpleName();

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
package com.matter.casting.support;
1515

1616
/**
17-
* Feature: Target Content Application - The set of content app Vendor IDs (and optionally, Product
18-
* IDs) that can be used for authentication.
17+
* Feature: Target Content Application - An entry in the IdentificationDeclarationOptions.java
18+
* TargetAppList which contains a TargetVendorId and an optional TargetProductId.
1919
*/
2020
public class TargetAppInfo {
2121
/** Target Target Content Application Vendor ID, null means unspecified */

examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h

+7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ class MatterCastingPlayerJNI
5050
private:
5151
friend MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr();
5252
static MatterCastingPlayerJNI sInstance;
53+
54+
// Handles the connection complete event and calls the ConnectionCallbacks onSuccess or onFailure callback provided by the Java
55+
// client. This callback is called by the cpp layer when the connection process has ended, regardless of whether it was
56+
// successful or not.
5357
static void ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr);
58+
// Handles the Commissioner Declaration event and calls the ConnectionCallbacks onCommissionerDeclaration callback provided by
59+
// the Java client. This callback is called by the cpp layer when the Commissionee receives a CommissionerDeclaration message
60+
// from the CastingPlayer/Commissioner.
5461
static void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source,
5562
chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd);
5663
};

0 commit comments

Comments
 (0)