Skip to content

Commit

Permalink
Merge branch 'project-chip:master' into source_location
Browse files Browse the repository at this point in the history
  • Loading branch information
mwswartwout authored Apr 23, 2024
2 parents a6b54c1 + 5e925ca commit 65a8027
Show file tree
Hide file tree
Showing 474 changed files with 9,175 additions and 12,174 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ jobs:
build \
"
- name: Run all tests
# Disabled being tracked here: https://github.com/project-chip/connectedhomeip/issues/32587
if: false
run: |
src/test_driver/esp32/run_qemu_image.py \
--verbose \
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/third-party-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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.

name: Check for Unintentional Submodule Updates

on:
pull_request:
branches-ignore:
- 'dependabot/**'
paths:
- "third_party/**"
- ".gitmodules"

jobs:
check-submodule-update-label:
name: Check For Submodule Update Label
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'changing-submodules-on-purpose')"
steps:
- name: Error Message
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.
- name: Fail Job
run: exit 1
1 change: 1 addition & 0 deletions docs/guides/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ example on ESP32 series of SoCs
- [Matter OTA](ota.md)
- [Generating and Using ESP Secure Cert Partition](secure_cert_partition.md)
- [BLE Settings](ble_settings.md)
- [Providers](providers.md)
10 changes: 3 additions & 7 deletions docs/guides/esp32/factory_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ Following data can be added to the manufacturing partition using
- Serial Number
- Unique identifier

- Device information
- Fixed Labels
- Supported locales
- Supported calendar types
- Supported modes
- Note: As per spec at max size of label should be 64 and `\0` will be
added at the end.
- Supported modes
- Note: As per spec at max size of label should be 64 and `\0` will be
added at the end.

### Configuration Options

Expand Down
76 changes: 76 additions & 0 deletions docs/guides/esp32/providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## Providers Implemented for ESP32 Platform

The ESP32 platform has implemented several providers that can be used with data
stored in the factory or by setting fixed data.

Below are the providers that have been implemented:

- [Commissionable Data Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L47)
This provider reads the discriminator and setup pincode related parameters
from the factory partition.
- [Device Attestation Credentials Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L56)
This provider manages the attestation data.
- [Device Instance Info Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L86)
This provider reads basic device information from the factory partition.
- [Device Info Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32DeviceInfoProvider.h#L31)
This provider provides fixed labels, supported calendar types, and supported
locales from the factory partition.
- [Supported Modes](https://github.com/project-chip/connectedhomeip/blob/master/examples/platform/esp32/mode-support/static-supported-modes-manager.h#L28)
This provider offers the supported modes for the mode-select cluster.

More information can be found in the [factory data guide](factory_data.md).

### Device Info Provider

Currently, there are two implementations for this provider:

1. [Reads data stored in the factory partition](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32FactoryDataProvider.h#L56)
_(This will be deprecated in the future)_
2. [Provides APIs to set fixed data that gets read later](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/StaticESP32DeviceInfoProvider.h)

- New products should use the `StaticESP32DeviceInfoProvider`. Utilize the
`Set...()` APIs to set the fixed data.
- Existing products using the first implementation can continue to use it if
they do not wish to change the data.
- For products using the first implementation and wanting to change the fixed
data via OTA, they should switch to the second implementation in the OTA
image and use the `Set...()` APIs to set the fixed data.

#### Example:

```cpp
#include <platform/ESP32/StaticESP32FactoryDataProvider.h>

DeviceLayer::StaticESP32DeviceInfoProvider deviceInfoProvider;

// Define array for Supported Calendar Types
using namespace chip::app::Clusters::TimeFormatLocalization::CalendarTypeEnum;
CalendarTypeEnum supportedCalendarTypes[] = {
CalendarTypeEnum::kGregorian, CalendarTypeEnum::kCoptic,
CalendarTypeEnum::kEthiopian, CalendarTypeEnum::kChinese,
};

// Define array for Supported Locales
const char* supportedLocales[] = {
"en-US",
"en-EU",
};

// Define array for Fixed labels { EndpointId, Label, Value }
struct StaticESP32DeviceInfoProvider::FixedLabelEntry fixedLabels[] = {
{ 0, "Room", "Bedroom 2" },
{ 0, "Orientation", "North" },
{ 0, "Direction", "Up" },
};

Span<CalendarTypeEnum> sSupportedCalendarTypes(supportedCalendarTypes);
Span<const char*> sSupportedLocales(supportedLocales);
Span<StaticESP32DeviceInfoProvider::FixedLabelEntry> sFixedLabels(fixedLabels);

{
deviceInfoProvider.SetSupportedLocales(sSupportedLocales);
deviceInfoProvider.SetSupportedCalendarTypes(sSupportedCalendarTypes);
deviceInfoProvider.SetFixedLabels(sFixedLabels);
DeviceLayer::SetDeviceInfoProvider(&deviceInfoProvider);
}
```
1 change: 0 additions & 1 deletion docs/tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Source files for these tools are located at `scripts/tools`.
../scripts/tools/memory/README
../scripts/tools/spake2p/README
../src/tools/interop/idt/README
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch
}

if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 &&
(!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id))
binding.clusterId.value_or(Clusters::OnOff::Id) == Clusters::OnOff::Id)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/ameba/main/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
entry->fabricIndex = atoi(argv[0]);
entry->groupId = atoi(argv[1]);
entry->local = 1; // Hardcoded to endpoint 1 for now
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now

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

DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
return CHIP_NO_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/asr/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "AppEvent.h"
#include <ble/BLEEndPoint.h>
#include <ble/Ble.h>
#include <lega_rtos_api.h>
#include <platform/CHIPDeviceLayer.h>
#include <stdbool.h>
Expand Down
7 changes: 0 additions & 7 deletions examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
#define APP_TASK_STACK_SIZE (5000)
#define APP_TASK_PRIORITY 4
#define APP_EVENT_QUEUE_SIZE 10

#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
#define LED_ENABLE 0
#else
#define LED_ENABLE 1
#endif
#define BUTTON_ENABLE 1

using namespace ::chip;
Expand All @@ -68,7 +62,6 @@ using namespace ::chip::DeviceLayer;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/cc13x4_26x4/main/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@

#include "Globals.h"

#if (LED_ENABLE == 1)
LED_Handle sAppRedHandle;
LED_Handle sAppGreenHandle;
#endif
7 changes: 7 additions & 0 deletions examples/all-clusters-app/cc13x4_26x4/main/include/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ void cc13xx_26xxLog(const char * aFormat, ...);
#ifdef __cplusplus
}
#endif

#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
#define LED_ENABLE 0
#else
#define LED_ENABLE 1
#endif

extern LED_Handle sAppRedHandle;
extern LED_Handle sAppGreenHandle;
2 changes: 1 addition & 1 deletion examples/all-clusters-app/infineon/psoc6/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "AppEvent.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <ble/Ble.h>
#include <platform/CHIPDeviceLayer.h>

// Application-defined error codes in the CHIP_ERROR space.
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/nxp/mw320/binding-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch
}

if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 &&
(!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id))
binding.clusterId.value_or(Clusters::OnOff::Id) == Clusters::OnOff::Id)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/asr/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "AppEvent.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <ble/Ble.h>
#include <platform/CHIPDeviceLayer.h>

// Application-defined error codes in the CHIP_ERROR space.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "AppEvent.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <ble/Ble.h>
#include <platform/CHIPDeviceLayer.h>

// Application-defined error codes in the CHIP_ERROR space.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ class BluetoothManager : BleCallback {

private val coroutineContinuation = continuation

private val STATE_INIT = 1
private val STATE_DISCOVER_SERVICE = 2
private val STATE_REQUEST_MTU = 3

private var mState = STATE_INIT

override fun onConnectionStateChange(gatt: BluetoothGatt?, status: Int, newState: Int) {
super.onConnectionStateChange(gatt, status, newState)
Log.i(
Expand All @@ -148,21 +154,31 @@ class BluetoothManager : BleCallback {

if (newState == BluetoothProfile.STATE_CONNECTED && status == BluetoothGatt.GATT_SUCCESS) {
Log.i("$TAG|onConnectionStateChange", "Discovering Services...")
mState = STATE_DISCOVER_SERVICE
gatt?.discoverServices()
}
}

override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
Log.d(TAG, "${gatt?.device?.name}.onServicesDiscovered status = $status")
if (mState != STATE_DISCOVER_SERVICE) {
Log.d(TAG, "Invalid state : $mState")
return
}
wrappedCallback.onServicesDiscovered(gatt, status)

Log.i("$TAG|onServicesDiscovered", "Services Discovered")
mState = STATE_REQUEST_MTU
gatt?.requestMtu(247)
}

override fun onMtuChanged(gatt: BluetoothGatt?, mtu: Int, status: Int) {
Log.d(TAG, "${gatt?.device?.name}.onMtuChanged: connecting to CHIP device")
super.onMtuChanged(gatt, mtu, status)
if (mState != STATE_REQUEST_MTU) {
Log.d(TAG, "Invalid state : $mState")
return
}
wrappedCallback.onMtuChanged(gatt, mtu, status)
if (coroutineContinuation.isActive) {
coroutineContinuation.resume(gatt)
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include <ble/BLEEndPoint.h>
#include <ble/Ble.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/ameba/main/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
entry->fabricIndex = atoi(argv[0]);
entry->groupId = atoi(argv[1]);
entry->local = 1; // Hardcoded to endpoint 1 for now
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now

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

DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
return CHIP_NO_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/asr/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <ble/Ble.h>
#include <platform/CHIPDeviceLayer.h>

// Application-defined error codes in the CHIP_ERROR space.
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/asr/src/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ void BindingHandler::PrintBindingTable()
\t+ ClusterId %d \n \
\t+ RemoteEndpointId %d \n \
\t+ NodeId %d",
(int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote,
(int) entry.nodeId);
(int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.value_or(kInvalidClusterId),
(int) entry.remote, (int) entry.nodeId);
break;
case MATTER_MULTICAST_BINDING:
ASR_LOG("[%d] GROUP:", i++);
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/esp32/main/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
entry->fabricIndex = atoi(argv[0]);
entry->groupId = atoi(argv[1]);
entry->local = 1; // Hardcoded to endpoint 1 for now
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now

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

DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
return CHIP_NO_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/genio/src/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv)
entry->fabricIndex = atoi(argv[0]);
entry->groupId = atoi(argv[1]);
entry->local = 1; // Hardcoded to endpoint 1 for now
entry->clusterId.SetValue(6); // Hardcoded to OnOff cluster for now
entry->clusterId.emplace(6); // Hardcoded to OnOff cluster for now

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

DeviceLayer::PlatformMgr().ScheduleWork(BindingWorkerFunction, reinterpret_cast<intptr_t>(entry));
return CHIP_NO_ERROR;
Expand Down
Loading

0 comments on commit 65a8027

Please sign in to comment.