Skip to content

Commit 6219b51

Browse files
Sync csa branch with main (#373)
2 parents dbf991c + 61c12ba commit 6219b51

File tree

361 files changed

+5193
-3985
lines changed

Some content is hidden

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

361 files changed

+5193
-3985
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,7 @@ PyFunction
11711171
pylint
11721172
PyObject
11731173
pypi
1174+
pyproject
11741175
PyRun
11751176
pytest
11761177
PYTHONPATH

.github/workflows/examples-nxp.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
if: github.actor != 'restyled-io[bot]'
4141

4242
container:
43-
image: ghcr.io/project-chip/chip-build-nxp:120
43+
image: ghcr.io/project-chip/chip-build-nxp:124
4444
volumes:
4545
- "/tmp/bloat_reports:/tmp/bloat_reports"
4646
steps:
@@ -149,7 +149,7 @@ jobs:
149149
run: |
150150
scripts/run_in_build_env.sh "\
151151
./scripts/build/build_examples.py \
152-
--target nxp-rt1060-freertos-thermostat-thread-wifi-evkc-iwx12 \
152+
--target nxp-rt1060-freertos-thermostat-thread-wifi-matter-shell-evkc-iwx12 \
153153
build \
154154
--copy-artifacts-to out/artifacts \
155155
"
@@ -181,7 +181,7 @@ jobs:
181181
run: |
182182
scripts/run_in_build_env.sh "\
183183
./scripts/build/build_examples.py \
184-
--target nxp-rt1170-freertos-thermostat-thread-wifi-iwx12 \
184+
--target nxp-rt1170-freertos-thermostat-thread-wifi-matter-shell-iwx12 \
185185
build \
186186
--copy-artifacts-to out/artifacts \
187187
"
@@ -210,7 +210,7 @@ jobs:
210210
run: |
211211
scripts/run_in_build_env.sh "\
212212
./scripts/build/build_examples.py \
213-
--target nxp-rw61x-freertos-thermostat-thread-wifi \
213+
--target nxp-rw61x-freertos-thermostat-thread-wifi-matter-shell \
214214
build \
215215
--copy-artifacts-to out/artifacts \
216216
"

.github/workflows/lint.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ jobs:
151151
if [ "$idl_file" = './examples/lighting-app-data-mode-no-unique-id/lighting-common/lighting-app.matter' ]; then continue; fi
152152
153153
# Test files are intentionally small and not spec-compilant, just parse-compliant
154-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/cluster_struct_attribute.matter" ]; then continue; fi
155-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/global_struct_attribute.matter" ]; then continue; fi
156-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/optional_argument.matter" ]; then continue; fi
157-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/several_clusters.matter" ]; then continue; fi
158-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/simple_attribute.matter" ]; then continue; fi
159-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/large_lighting_app.matter" ]; then continue; fi
160-
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/large_all_clusters_app.matter" ]; then continue; fi
154+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/cluster_struct_attribute.matter" ]; then continue; fi
155+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/global_struct_attribute.matter" ]; then continue; fi
156+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/optional_argument.matter" ]; then continue; fi
157+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/several_clusters.matter" ]; then continue; fi
158+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/simple_attribute.matter" ]; then continue; fi
159+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/large_lighting_app.matter" ]; then continue; fi
160+
if [ "$idl_file" = "./scripts/py_matter_idl/matter/idl/tests/inputs/large_all_clusters_app.matter" ]; then continue; fi
161161
162162
./scripts/run_in_build_env.sh "./scripts/idl_lint.py --log-level warn $idl_file" >/dev/null || exit 1
163163
done

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
#
8989
run: |
9090
./scripts/run_in_build_env.sh \
91-
"./scripts/py_matter_idl/matter_idl/zapxml_parser.py \
91+
"./scripts/py_matter_idl/matter/idl/zapxml_parser.py \
9292
--no-print \
9393
--log-level info \
9494
src/app/zap-templates/zcl/data-model/chip/global-attributes.xml \

.isort.cfg

-2
This file was deleted.

.restyled.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ exclude:
6868
- "third_party/android_deps/gradlew" # gradle wrapper generated file
6969
- "src/controller/python/chip/clusters/Objects.py" # generated file, no point to restyle
7070
- "src/controller/python/chip/clusters/CHIPClusters.py" # generated file, no point to restyle
71-
- "scripts/py_matter_idl/matter_idl/tests/outputs/**/*" # Matches generated output 1:1
71+
- "scripts/py_matter_idl/matter/idl/tests/outputs/**/*" # Matches generated output 1:1
7272
- "scripts/tools/zap/tests/outputs/**/*" # Matches generated output 1:1
7373
- "examples/chef/sample_app_util/test_files/*.yaml"
7474
- "examples/chef/zzz_generated/**/*"
@@ -228,8 +228,6 @@ restylers:
228228
command:
229229
- autopep8
230230
- "--in-place"
231-
- "--max-line-length"
232-
- "132"
233231
arguments: []
234232
include:
235233
- "**/*.py"

config/esp32/components/chip/CMakeLists.txt

+17-8
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ endif()
345345

346346
set(args_gn "${CMAKE_CURRENT_BINARY_DIR}/args.gn")
347347
add_custom_command(OUTPUT "${args_gn}"
348-
COMMAND ${python}
349-
${CMAKE_CURRENT_LIST_DIR}/create_args_gn.py
348+
COMMAND ${python}
349+
${CMAKE_CURRENT_LIST_DIR}/create_args_gn.py
350350
"${CMAKE_BINARY_DIR}"
351351
"${idf_path}"
352352
"${CMAKE_CURRENT_LIST_DIR}/chip.c"
@@ -468,10 +468,19 @@ endif()
468468

469469
# Build Matter OTA image
470470
if (CONFIG_CHIP_OTA_IMAGE_BUILD)
471-
chip_ota_image(chip-ota-image
472-
INPUT_FILES ${BUILD_DIR}/${CMAKE_PROJECT_NAME}.bin
473-
OUTPUT_FILE ${BUILD_DIR}/${CMAKE_PROJECT_NAME}-ota.bin
474-
)
475-
# Adding dependecy as app target so that this runs after images are ready
476-
add_dependencies(chip-ota-image app)
471+
if (CONFIG_OPENTHREAD_BORDER_ROUTER AND CONFIG_AUTO_UPDATE_RCP)
472+
chip_ota_image(chip-ota-image
473+
INPUT_FILES ${BUILD_DIR}/ota_with_rcp_image
474+
OUTPUT_FILE ${BUILD_DIR}/ota_with_rcp_image-ota.bin
475+
)
476+
# Adding dependecy as app target so that this runs after images are ready
477+
add_dependencies(chip-ota-image gen_ota_image)
478+
else()
479+
chip_ota_image(chip-ota-image
480+
INPUT_FILES ${BUILD_DIR}/${CMAKE_PROJECT_NAME}.bin
481+
OUTPUT_FILE ${BUILD_DIR}/${CMAKE_PROJECT_NAME}-ota.bin
482+
)
483+
# Adding dependecy as app target so that this runs after images are ready
484+
add_dependencies(chip-ota-image app)
485+
endif()
477486
endif()

config/esp32/components/chip/idf_component.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
- if: "idf_version >=4.4"
1818

1919
espressif/esp_insights:
20-
version: "1.2.2"
20+
version: "^1.2.4"
2121
require: public
2222
# There is an issue with IDF-Component-Manager when ESP Insights is included.
2323
# Issue: https://github.com/project-chip/connectedhomeip/issues/29125
@@ -26,7 +26,7 @@ dependencies:
2626
- if: "target != esp32h2"
2727

2828
espressif/esp_rcp_update:
29-
version: "1.2.0"
29+
version: "~1.3.0"
3030
rules:
3131
- if: "idf_version >=5.0"
3232

docs/guides/matter_idl_tooling.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Since it is designed to be easy for both machine and humans to read, it is the
77
basis of some tools to make validating zap-based cluster definitions easier.
88

99
More details on the format in
10-
[matter_idl/README.md](../../scripts/py_matter_idl/matter_idl/README.md).
10+
[matter/idl/README.md](../../scripts/py_matter_idl/matter/idl/README.md).
1111

1212
## Parsing CSA XML Data definitions
1313

@@ -20,12 +20,12 @@ information available in [data_model/README.md](../../data_model/README.md).
2020
NOTE: scraper is a work in progress, XML data may be incomplete or have errors
2121
still.
2222

23-
The script `./scripts/py_matter_idl/matter_idl/data_model_xml_parser.py` has the
23+
The script `./scripts/py_matter_idl/matter/idl/data_model_xml_parser.py` has the
2424
ability to parse one or more CSA data model XML files and output their content
2525
in `.matter` format. For example:
2626

2727
```sh
28-
./scripts/py_matter_idl/matter_idl/data_model_xml_parser.py data_model/clusters/BooleanState.xml
28+
./scripts/py_matter_idl/matter/idl/data_model_xml_parser.py data_model/clusters/BooleanState.xml
2929
```
3030

3131
The tool supports several options that are useful for development:
@@ -54,7 +54,7 @@ specification:
5454
As such one can run compares such as:
5555

5656
```sh
57-
./scripts/py_matter_idl/matter_idl/data_model_xml_parser.py \
57+
./scripts/py_matter_idl/matter/idl/data_model_xml_parser.py \
5858
-o out/spec.matter \
5959
--compare-output out/sdk.matter \
6060
--compare src/controller/data_model/controller-clusters.matter \

docs/platforms/esp32/ble_settings.md

+134
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,137 @@ advertising packets.
3333
```
3434

3535
Note: Scan response should be configure before `InitServer`.
36+
37+
## Nimble: additional custom GATT services
38+
39+
The `ConfigureExtraServices` API is used to configure additional services
40+
alongside the Matter services. This API allows users to add their own custom
41+
services for provisioning or other purposes.
42+
43+
### Usage
44+
45+
```
46+
/* Service access callback */
47+
static int gatt_svc_access(uint16_t conn_handle, uint16_t attr_handle,
48+
struct ble_gatt_access_ctxt *ctxt, void *arg);
49+
50+
/* Service UUID */
51+
static const ble_uuid128_t gatt_svr_svc_uuid =
52+
BLE_UUID128_INIT(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
53+
0x99, 0x99, 0x43, 0x95, 0x12, 0x2f, 0x46, 0x59);
54+
55+
/* A characteristic that can be subscribed to */
56+
static uint16_t gatt_svr_chr_val_handle;
57+
static const ble_uuid128_t gatt_svr_chr_uuid =
58+
BLE_UUID128_INIT(0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,
59+
0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x33);
60+
61+
/* A custom descriptor */
62+
static const ble_uuid128_t gatt_svr_dsc_uuid =
63+
BLE_UUID128_INIT(0x01, 0x01, 0x01, 0x01, 0x12, 0x12, 0x12, 0x12,
64+
0x23, 0x23, 0x23, 0x23, 0x34, 0x34, 0x34, 0x34);
65+
66+
{
67+
std::vector<struct ble_gatt_svc_def> gatt_svr_svcs = {
68+
{
69+
/*** Service ***/
70+
.type = BLE_GATT_SVC_TYPE_PRIMARY,
71+
.uuid = &gatt_svr_svc_uuid.u,
72+
.characteristics = (struct ble_gatt_chr_def[])
73+
{ {
74+
/*** This characteristic can be subscribed to by writing 0x00 and 0x01 to the CCCD ***/
75+
.uuid = &gatt_svr_chr_uuid.u,
76+
.access_cb = gatt_svc_access,
77+
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_NOTIFY | BLE_GATT_CHR_F_INDICATE,
78+
.val_handle = &gatt_svr_chr_val_handle,
79+
.descriptors = (struct ble_gatt_dsc_def[]) {
80+
{
81+
.uuid = &gatt_svr_dsc_uuid.u,
82+
.att_flags = BLE_ATT_F_READ,
83+
.access_cb = gatt_svc_access,
84+
}, {
85+
0, /* No more descriptors in this characteristic */
86+
}
87+
},
88+
}, {
89+
0, /* No more characteristics in this service. */
90+
}
91+
},
92+
},
93+
};
94+
95+
/* Add Extra service after Matter service */
96+
CHIP_ERROR err = chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureExtraServices(gatt_svr_svcs, ture);
97+
}
98+
```
99+
100+
Note: Extra service should be configure before `InitServer`.
101+
102+
## Nimble: multiple BLE advertisement
103+
104+
The chips that support BLE 5.0 features can advertise their custom BLE GAP
105+
advertisement alongside Matter's BLE advertisement if `CONFIG_BT_NIMBLE_EXT_ADV`
106+
is enabled and `CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES` is a value greater
107+
than 1.
108+
109+
### Usage
110+
111+
```
112+
static uint8_t connectable_adv_pattern[] = {
113+
0x02, 0x01, 0x06,
114+
0x03, 0x03, 0xab, 0xcd,
115+
0x03, 0x03, 0x18, 0x11,
116+
0x12, 0X09, 'n', 'i', 'm', 'b', 'l', 'e', '-', 'c', 'o', 'n', 'n', 'e', 't', 'a', 'b', 'l', 'e'
117+
};
118+
119+
/* GAP event handler */
120+
static int ble_multi_adv_gap_event(struct ble_gap_event *event, void *arg);
121+
122+
{
123+
/* Use instance except 0 as Matter advertisement uses instance 0 */
124+
uint8_t instance = 1;
125+
struct ble_gap_ext_adv_params params;
126+
int size_pattern = sizeof(connectable_adv_pattern) / sizeof(connectable_adv_pattern[0]);
127+
128+
memset (&params, 0, sizeof(params));
129+
130+
params.connectable = 1;
131+
params.scannable = 1;
132+
params.own_addr_type = BLE_OWN_ADDR_RANDOM;
133+
params.sid = 1;
134+
params.primary_phy = BLE_HCI_LE_PHY_1M;
135+
params.secondary_phy = BLE_HCI_LE_PHY_1M;
136+
params.tx_power = 127;
137+
138+
int rc;
139+
struct os_mbuf *data;
140+
int size_pattern = sizeof(legacy_dur_adv_pattern) / sizeof(legacy_dur_adv_pattern[0]);
141+
142+
if (ble_gap_ext_adv_active(instance)) {
143+
ESP_LOGI(tag, "Instance already advertising");
144+
return;
145+
}
146+
147+
rc = ble_gap_ext_adv_configure(instance, params, NULL,
148+
ble_multi_adv_gap_event, NULL);
149+
assert (rc == 0);
150+
151+
/* get mbuf for adv data */
152+
data = os_msys_get_pkthdr(size_pattern, 0);
153+
assert(data);
154+
155+
/* fill mbuf with adv data */
156+
rc = os_mbuf_append(data, legacy_dur_adv_pattern, size_pattern);
157+
assert(rc == 0);
158+
159+
rc = ble_gap_ext_adv_set_data(instance, data);
160+
assert (rc == 0);
161+
162+
/* start advertising */
163+
rc = ble_gap_ext_adv_start(instance, 500, 0);
164+
assert (rc == 0);
165+
}
166+
```
167+
168+
Note: The custom additional advertisement should be configured after BLE stack
169+
is started.

docs/style/CODING_STYLE_GUIDE.md

+14-16
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,20 @@ be removed.
6060

6161
We use the following auto-formatters on code:
6262

63-
| Language | Formatter | Style File |
64-
| ----------- | ------------------ | ------------------------------------------------------------------------------------------ |
65-
| C++ | clang-format | [.clang-format](https://github.com/project-chip/connectedhomeip/blob/master/.clang-format) |
66-
| Objective-C | clang-format | [.clang-format](https://github.com/project-chip/connectedhomeip/blob/master/.clang-format) |
67-
| java | google-java-format | N/A |
68-
| Python | pep8, isort, ruff | [.restyled.yaml][restyle_link] (command line), [isort][isort_link], [ruff][ruff_link] |
69-
| YAML | prettier | None |
70-
| JSON | prettier | None |
71-
| markdown | prettier | None |
72-
73-
[restyle_link]:
74-
https://github.com/project-chip/connectedhomeip/blob/master/.restyled.yaml
75-
[isort_link]:
76-
https://github.com/project-chip/connectedhomeip/blob/master/.isort.cfg
77-
[ruff_link]:
78-
https://github.com/project-chip/connectedhomeip/blob/master/ruff.toml
63+
| Language | Formatter | Style File |
64+
| ----------- | ------------------ | ---------------------------------- |
65+
| C++ | clang-format | [.clang-format][clang_format_link] |
66+
| Objective-C | clang-format | [.clang-format][clang_format_link] |
67+
| java | google-java-format | N/A |
68+
| Python | pep8, isort, ruff | [pyproject.toml][pyproject_link] |
69+
| YAML | prettier | None |
70+
| JSON | prettier | None |
71+
| markdown | prettier | None |
72+
73+
[clang_format_link]:
74+
https://github.com/project-chip/connectedhomeip/blob/master/.clang-format
75+
[pyproject_link]:
76+
https://github.com/project-chip/connectedhomeip/blob/master/pyproject.toml
7977

8078
All pull requests run formatting checks using these tools before merge is
8179
allowed. Generated code is not run through restyle.

docs/zap_and_codegen/code_generation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ specific codegen.
9191
`*.matter` files are both human and machine readable. Code that can process
9292
these files is available at `scripts/py_matter_idl` and `scripts/codegen.py`.
9393
You can read the
94-
[scripts/py_matter_idl/matter_idl/README.md](../scripts/py_matter_idl/matter_idl/README.md)
94+
[scripts/py_matter_idl/matter/idl/README.md](../scripts/py_matter_idl/matter/idl/README.md)
9595
for details of how things work.
9696

9797
`scripts/codegen.py` can generate various outputs based on an input `*.matter`
@@ -222,7 +222,7 @@ Code pre-generation can be used:
222222
generation at build time or to save the code generation time at the expense
223223
of running code generation for every possible zap/generation type
224224
- To check changes in generated code across versions, beyond the comparisons
225-
of golden image tests in `scripts/py_matter_idl/matter_idl/tests`
225+
of golden image tests in `scripts/py_matter_idl/matter/idl/tests`
226226

227227
The script to trigger code pre-generation is `scripts/codepregen.py` and
228228
requires the pre-generation output directory as an argument

0 commit comments

Comments
 (0)