Skip to content

Commit 65a8027

Browse files
authored
Merge branch 'project-chip:master' into source_location
2 parents a6b54c1 + 5e925ca commit 65a8027

File tree

474 files changed

+9175
-12174
lines changed

Some content is hidden

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

474 files changed

+9175
-12174
lines changed

.github/workflows/qemu.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ jobs:
6060
build \
6161
"
6262
- name: Run all tests
63-
# Disabled being tracked here: https://github.com/project-chip/connectedhomeip/issues/32587
64-
if: false
6563
run: |
6664
src/test_driver/esp32/run_qemu_image.py \
6765
--verbose \
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Check for Unintentional Submodule Updates
16+
17+
on:
18+
pull_request:
19+
branches-ignore:
20+
- 'dependabot/**'
21+
paths:
22+
- "third_party/**"
23+
- ".gitmodules"
24+
25+
jobs:
26+
check-submodule-update-label:
27+
name: Check For Submodule Update Label
28+
runs-on: ubuntu-latest
29+
if: "!contains(github.event.pull_request.labels.*.name, 'changing-submodules-on-purpose')"
30+
steps:
31+
- name: Error Message
32+
run: echo This pull request attempts to update submodules without the changing-submodules-on-purpose label. Please apply that label if the changes are intentional, or remove those changes.
33+
- name: Fail Job
34+
run: exit 1

docs/guides/esp32/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ example on ESP32 series of SoCs
1818
- [Matter OTA](ota.md)
1919
- [Generating and Using ESP Secure Cert Partition](secure_cert_partition.md)
2020
- [BLE Settings](ble_settings.md)
21+
- [Providers](providers.md)

docs/guides/esp32/factory_data.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ Following data can be added to the manufacturing partition using
4444
- Serial Number
4545
- Unique identifier
4646

47-
- Device information
48-
- Fixed Labels
49-
- Supported locales
50-
- Supported calendar types
51-
- Supported modes
52-
- Note: As per spec at max size of label should be 64 and `\0` will be
53-
added at the end.
47+
- Supported modes
48+
- Note: As per spec at max size of label should be 64 and `\0` will be
49+
added at the end.
5450

5551
### Configuration Options
5652

docs/guides/esp32/providers.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## Providers Implemented for ESP32 Platform
2+
3+
The ESP32 platform has implemented several providers that can be used with data
4+
stored in the factory or by setting fixed data.
5+
6+
Below are the providers that have been implemented:
7+
8+
- [Commissionable Data Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L47)
9+
This provider reads the discriminator and setup pincode related parameters
10+
from the factory partition.
11+
- [Device Attestation Credentials Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L56)
12+
This provider manages the attestation data.
13+
- [Device Instance Info Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L86)
14+
This provider reads basic device information from the factory partition.
15+
- [Device Info Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32DeviceInfoProvider.h#L31)
16+
This provider provides fixed labels, supported calendar types, and supported
17+
locales from the factory partition.
18+
- [Supported Modes](https://github.com/project-chip/connectedhomeip/blob/master/examples/platform/esp32/mode-support/static-supported-modes-manager.h#L28)
19+
This provider offers the supported modes for the mode-select cluster.
20+
21+
More information can be found in the [factory data guide](factory_data.md).
22+
23+
### Device Info Provider
24+
25+
Currently, there are two implementations for this provider:
26+
27+
1. [Reads data stored in the factory partition](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L56)
28+
_(This will be deprecated in the future)_
29+
2. [Provides APIs to set fixed data that gets read later](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/StaticESP32DeviceInfoProvider.h)
30+
31+
- New products should use the `StaticESP32DeviceInfoProvider`. Utilize the
32+
`Set...()` APIs to set the fixed data.
33+
- Existing products using the first implementation can continue to use it if
34+
they do not wish to change the data.
35+
- For products using the first implementation and wanting to change the fixed
36+
data via OTA, they should switch to the second implementation in the OTA
37+
image and use the `Set...()` APIs to set the fixed data.
38+
39+
#### Example:
40+
41+
```cpp
42+
#include <platform/ESP32/StaticESP32FactoryDataProvider.h>
43+
44+
DeviceLayer::StaticESP32DeviceInfoProvider deviceInfoProvider;
45+
46+
// Define array for Supported Calendar Types
47+
using namespace chip::app::Clusters::TimeFormatLocalization::CalendarTypeEnum;
48+
CalendarTypeEnum supportedCalendarTypes[] = {
49+
CalendarTypeEnum::kGregorian, CalendarTypeEnum::kCoptic,
50+
CalendarTypeEnum::kEthiopian, CalendarTypeEnum::kChinese,
51+
};
52+
53+
// Define array for Supported Locales
54+
const char* supportedLocales[] = {
55+
"en-US",
56+
"en-EU",
57+
};
58+
59+
// Define array for Fixed labels { EndpointId, Label, Value }
60+
struct StaticESP32DeviceInfoProvider::FixedLabelEntry fixedLabels[] = {
61+
{ 0, "Room", "Bedroom 2" },
62+
{ 0, "Orientation", "North" },
63+
{ 0, "Direction", "Up" },
64+
};
65+
66+
Span<CalendarTypeEnum> sSupportedCalendarTypes(supportedCalendarTypes);
67+
Span<const char*> sSupportedLocales(supportedLocales);
68+
Span<StaticESP32DeviceInfoProvider::FixedLabelEntry> sFixedLabels(fixedLabels);
69+
70+
{
71+
deviceInfoProvider.SetSupportedLocales(sSupportedLocales);
72+
deviceInfoProvider.SetSupportedCalendarTypes(sSupportedCalendarTypes);
73+
deviceInfoProvider.SetFixedLabels(sFixedLabels);
74+
DeviceLayer::SetDeviceInfoProvider(&deviceInfoProvider);
75+
}
76+
```

docs/tools/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Source files for these tools are located at `scripts/tools`.
2828
2929
../scripts/tools/memory/README
3030
../scripts/tools/spake2p/README
31-
../src/tools/interop/idt/README
3231
3332
```
3433

examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch
8080
}
8181

8282
if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 &&
83-
(!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id))
83+
binding.clusterId.value_or(Clusters::OnOff::Id) == Clusters::OnOff::Id)
8484
{
8585
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
8686
ChipLogProgress(NotSpecified, "OnOff command succeeds");

examples/all-clusters-app/ameba/main/BindingHandler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
194194
entry->fabricIndex = atoi(argv[0]);
195195
entry->groupId = atoi(argv[1]);
196196
entry->local = 1; // Hardcoded to endpoint 1 for now
197-
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
197+
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now
198198

199199
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
200200
return CHIP_NO_ERROR;
@@ -210,7 +210,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv)
210210
entry->nodeId = atoi(argv[1]);
211211
entry->local = 1; // Hardcoded to endpoint 1 for now
212212
entry->remote = atoi(argv[2]);
213-
entry->clusterId.SetValue(6); // Hardcode to OnOff cluster for now
213+
entry->clusterId.emplace(6); // Hardcode to OnOff cluster for now
214214

215215
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
216216
return CHIP_NO_ERROR;

examples/all-clusters-app/asr/include/AppTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#pragma once
2020

2121
#include "AppEvent.h"
22-
#include <ble/BLEEndPoint.h>
22+
#include <ble/Ble.h>
2323
#include <lega_rtos_api.h>
2424
#include <platform/CHIPDeviceLayer.h>
2525
#include <stdbool.h>

examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@
5454
#define APP_TASK_STACK_SIZE (5000)
5555
#define APP_TASK_PRIORITY 4
5656
#define APP_EVENT_QUEUE_SIZE 10
57-
58-
#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
59-
#define LED_ENABLE 0
60-
#else
61-
#define LED_ENABLE 1
62-
#endif
6357
#define BUTTON_ENABLE 1
6458

6559
using namespace ::chip;
@@ -68,7 +62,6 @@ using namespace ::chip::DeviceLayer;
6862

6963
static TaskHandle_t sAppTaskHandle;
7064
static QueueHandle_t sAppEventQueue;
71-
7265
static Button_Handle sAppLeftHandle;
7366
static Button_Handle sAppRightHandle;
7467
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;

examples/all-clusters-app/cc13x4_26x4/main/Globals.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818

1919
#include "Globals.h"
2020

21+
#if (LED_ENABLE == 1)
2122
LED_Handle sAppRedHandle;
2223
LED_Handle sAppGreenHandle;
24+
#endif

examples/all-clusters-app/cc13x4_26x4/main/include/Globals.h

+7
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,12 @@ void cc13xx_26xxLog(const char * aFormat, ...);
3131
#ifdef __cplusplus
3232
}
3333
#endif
34+
35+
#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
36+
#define LED_ENABLE 0
37+
#else
38+
#define LED_ENABLE 1
39+
#endif
40+
3441
extern LED_Handle sAppRedHandle;
3542
extern LED_Handle sAppGreenHandle;

examples/all-clusters-app/infineon/psoc6/include/AppTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "AppEvent.h"
2727
#include "FreeRTOS.h"
2828
#include "timers.h" // provides FreeRTOS timer support
29-
#include <ble/BLEEndPoint.h>
29+
#include <ble/Ble.h>
3030
#include <platform/CHIPDeviceLayer.h>
3131

3232
// Application-defined error codes in the CHIP_ERROR space.

examples/all-clusters-app/nxp/mw320/binding-handler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch
8181
}
8282

8383
if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 &&
84-
(!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id))
84+
binding.clusterId.value_or(Clusters::OnOff::Id) == Clusters::OnOff::Id)
8585
{
8686
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
8787
ChipLogProgress(NotSpecified, "OnOff command succeeds");

examples/all-clusters-minimal-app/asr/include/AppTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "AppEvent.h"
2525
#include "FreeRTOS.h"
2626
#include "timers.h" // provides FreeRTOS timer support
27-
#include <ble/BLEEndPoint.h>
27+
#include <ble/Ble.h>
2828
#include <platform/CHIPDeviceLayer.h>
2929

3030
// Application-defined error codes in the CHIP_ERROR space.

examples/all-clusters-minimal-app/infineon/psoc6/include/AppTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "AppEvent.h"
2727
#include "FreeRTOS.h"
2828
#include "timers.h" // provides FreeRTOS timer support
29-
#include <ble/BLEEndPoint.h>
29+
#include <ble/Ble.h>
3030
#include <platform/CHIPDeviceLayer.h>
3131

3232
// Application-defined error codes in the CHIP_ERROR space.

examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/bluetooth/BluetoothManager.kt

+16
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ class BluetoothManager : BleCallback {
138138

139139
private val coroutineContinuation = continuation
140140

141+
private val STATE_INIT = 1
142+
private val STATE_DISCOVER_SERVICE = 2
143+
private val STATE_REQUEST_MTU = 3
144+
145+
private var mState = STATE_INIT
146+
141147
override fun onConnectionStateChange(gatt: BluetoothGatt?, status: Int, newState: Int) {
142148
super.onConnectionStateChange(gatt, status, newState)
143149
Log.i(
@@ -148,21 +154,31 @@ class BluetoothManager : BleCallback {
148154

149155
if (newState == BluetoothProfile.STATE_CONNECTED && status == BluetoothGatt.GATT_SUCCESS) {
150156
Log.i("$TAG|onConnectionStateChange", "Discovering Services...")
157+
mState = STATE_DISCOVER_SERVICE
151158
gatt?.discoverServices()
152159
}
153160
}
154161

155162
override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
156163
Log.d(TAG, "${gatt?.device?.name}.onServicesDiscovered status = $status")
164+
if (mState != STATE_DISCOVER_SERVICE) {
165+
Log.d(TAG, "Invalid state : $mState")
166+
return
167+
}
157168
wrappedCallback.onServicesDiscovered(gatt, status)
158169

159170
Log.i("$TAG|onServicesDiscovered", "Services Discovered")
171+
mState = STATE_REQUEST_MTU
160172
gatt?.requestMtu(247)
161173
}
162174

163175
override fun onMtuChanged(gatt: BluetoothGatt?, mtu: Int, status: Int) {
164176
Log.d(TAG, "${gatt?.device?.name}.onMtuChanged: connecting to CHIP device")
165177
super.onMtuChanged(gatt, mtu, status)
178+
if (mState != STATE_REQUEST_MTU) {
179+
Log.d(TAG, "Invalid state : $mState")
180+
return
181+
}
166182
wrappedCallback.onMtuChanged(gatt, mtu, status)
167183
if (coroutineContinuation.isActive) {
168184
coroutineContinuation.resume(gatt)

examples/chef/silabs/include/AppTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "AppEvent.h"
3030
#include "BaseApplication.h"
31-
#include <ble/BLEEndPoint.h>
31+
#include <ble/Ble.h>
3232
#include <cmsis_os2.h>
3333
#include <lib/core/CHIPError.h>
3434
#include <platform/CHIPDeviceLayer.h>

examples/light-switch-app/ameba/main/BindingHandler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
250250
entry->fabricIndex = atoi(argv[0]);
251251
entry->groupId = atoi(argv[1]);
252252
entry->local = 1; // Hardcoded to endpoint 1 for now
253-
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
253+
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now
254254

255255
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
256256
return CHIP_NO_ERROR;
@@ -266,7 +266,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv)
266266
entry->nodeId = atoi(argv[1]);
267267
entry->local = 1; // Hardcoded to endpoint 1 for now
268268
entry->remote = atoi(argv[2]);
269-
entry->clusterId.SetValue(6); // Hardcode to OnOff cluster for now
269+
entry->clusterId.emplace(6); // Hardcode to OnOff cluster for now
270270

271271
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
272272
return CHIP_NO_ERROR;

examples/light-switch-app/asr/include/AppTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "FreeRTOS.h"
2727
#include "timers.h" // provides FreeRTOS timer support
28-
#include <ble/BLEEndPoint.h>
28+
#include <ble/Ble.h>
2929
#include <platform/CHIPDeviceLayer.h>
3030

3131
// Application-defined error codes in the CHIP_ERROR space.

examples/light-switch-app/asr/src/BindingHandler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ void BindingHandler::PrintBindingTable()
280280
\t+ ClusterId %d \n \
281281
\t+ RemoteEndpointId %d \n \
282282
\t+ NodeId %d",
283-
(int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote,
284-
(int) entry.nodeId);
283+
(int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.value_or(kInvalidClusterId),
284+
(int) entry.remote, (int) entry.nodeId);
285285
break;
286286
case MATTER_MULTICAST_BINDING:
287287
ASR_LOG("[%d] GROUP:", i++);

examples/light-switch-app/esp32/main/BindingHandler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
248248
entry->fabricIndex = atoi(argv[0]);
249249
entry->groupId = atoi(argv[1]);
250250
entry->local = 1; // Hardcoded to endpoint 1 for now
251-
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
251+
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now
252252

253253
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
254254
return CHIP_NO_ERROR;
@@ -264,7 +264,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv)
264264
entry->nodeId = atoi(argv[1]);
265265
entry->local = 1; // Hardcoded to endpoint 1 for now
266266
entry->remote = atoi(argv[2]);
267-
entry->clusterId.SetValue(6); // Hardcode to OnOff cluster for now
267+
entry->clusterId.emplace(6); // Hardcode to OnOff cluster for now
268268

269269
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
270270
return CHIP_NO_ERROR;

examples/light-switch-app/genio/src/BindingHandler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
247247
entry->fabricIndex = atoi(argv[0]);
248248
entry->groupId = atoi(argv[1]);
249249
entry->local = 1; // Hardcoded to endpoint 1 for now
250-
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
250+
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now
251251

252252
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
253253
return CHIP_NO_ERROR;
@@ -263,7 +263,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv)
263263
entry->nodeId = atoi(argv[1]);
264264
entry->local = 1; // Hardcoded to endpoint 1 for now
265265
entry->remote = atoi(argv[2]);
266-
entry->clusterId.SetValue(6); // Hardcode to OnOff cluster for now
266+
entry->clusterId.emplace(6); // Hardcode to OnOff cluster for now
267267

268268
DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
269269
return CHIP_NO_ERROR;

0 commit comments

Comments
 (0)