Skip to content

Commit

Permalink
Merge branch 'master' into get-commissioner-node-id-02-01
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Feb 2, 2023
2 parents db30ae7 + 94c7f68 commit 1477c44
Show file tree
Hide file tree
Showing 145 changed files with 864 additions and 1,894 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,3 @@ jobs:
if: always()
run: |
git grep -n '0x%[0-9-]*" *PRI[^xX]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0
# git grep exits with 0 if it finds a match, but we want
# to fail (exit nonzero) on match. And we want to exclude this file,
# to avoid our grep regexp matching itself.
- name: Check for use of legacy non-namespaced attribute ids.
if: always()
run: |
git grep -n '_ATTRIBUTE_ID' -- src ':(exclude)src/app/zap-templates/templates/app/attribute-id.zapt' && exit 1 || exit 0
1 change: 1 addition & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ chip_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT)
chip_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_NET_IPV4)
chip_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NFC_COMMISSIONING)
chip_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR)
chip_gn_arg_bool ("chip_persist_subscriptions" CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS)
chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS)
Expand Down
10 changes: 10 additions & 0 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ config CHIP_CRYPTO_PSA
based on the PSA crypto API (instead of the default implementation, which
is based on the legacy mbedTLS APIs).

config CHIP_PERSISTENT_SUBSCRIPTIONS
bool "Persistent subscriptions"
help
Persists Matter subscriptions on the publisher node. This feature allows
a Matter node to faster get back to the previous operation after it went
offline, for example, due to a power outage. That is, the node can use the
persisted subscription information to quickly re-establish the previous
subscriptions instead of waiting for the subscriber node to realize that
the publisher is alive again.

config CHIP_LIB_SHELL
bool "Matter shell commands"
default n
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/darwin.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Listed are the Current SHAs:
- iOS/iPadOS/tvOS 16.1:
[`33f6a910cd9a8a0cfdd7088e2f43efd2f7f566a7`](https://github.com/project-chip/connectedhomeip/commits/33f6a910cd9a8a0cfdd7088e2f43efd2f7f566a7)

- iOS/iPadOS/tvOS 16.2 Developer Preview:
- iOS/iPadOS/tvOS 16.2 and 16.3:
[`c279578c5bc37f117335aa96cec6c5552f070cc0`](https://github.com/project-chip/connectedhomeip/commits/c279578c5bc37f117335aa96cec6c5552f070cc0)

## Supported Platforms for Matter Device Testing
Expand Down
29 changes: 29 additions & 0 deletions docs/guides/matter-repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,35 @@ Please follow the instructions
[here](./python_chip_controller_building.md#building-and-installing) to build
the Python virtual environment.

### Building for `arm64` e.g. for Raspberry Pi

Matter code relies on code generation for cluster-specific data types and
callbacks. A subset of code generation is done at compile time by `zap-cli`. ZAP
is generally installed as a third-party tool via CIPD during the build
environment bootstrap. However, zap packages are currently NOT available for
`arm64` (like when compiling on Raspberry PI.). In this case, you have 2
choices.

1. You could check out zap from source as described in
[Code Generation - Installing zap and environment variables](https://github.com/project-chip/connectedhomeip/blob/master/docs/code_generation.md#Installing-zap-and-environment-variables)
and proceed with the
[instructions](./python_chip_controller_building.md#building-and-installing)
to build the Python virtual environment.

2. When compile-time code generation is not desirable, then pre-generated output
code can be used. To understand about code generation and pre-generating
matter code see.
[Code generation - Pre-generation](https://github.com/project-chip/connectedhomeip/blob/master/docs/code_generation.md#Pre-generation).
To build and install the Python CHIP controller with pre-generated files use
the -z argument that points to the directory of pre-generated code:

```
scripts/build_python.sh -m platform -i separate -z "/some/pregen/dir"
```

> Note: To get more details about available build configurations, run the
> following command: `scripts/build_python.sh --help`
## Launching the REPL

1. Activate the Python virtual environment:
Expand Down
6 changes: 3 additions & 3 deletions examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "DeviceCallbacks.h"
#include "CHIPDeviceManager.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/server/Dnssd.h>
Expand Down Expand Up @@ -143,7 +143,7 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event

void DeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID,
VerifyOrExit(attributeId == app::Clusters::OnOff::Attributes::OnOff::Id,
ChipLogError(DeviceLayer, TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2,
ChipLogError(DeviceLayer, TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
Expand All @@ -165,7 +165,7 @@ void IdentifyTimerHandler(Layer * systemLayer, void * appState, CHIP_ERROR error

void DeviceCallbacks::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_IDENTIFY_TIME_ATTRIBUTE_ID,
VerifyOrExit(attributeId == app::Clusters::Identify::Attributes::IdentifyTime::Id,
ChipLogError(DeviceLayer, "[%s] Unhandled Attribute ID: '0x%04x", TAG, attributeId));
VerifyOrExit(endpointId == 1, ChipLogError(DeviceLayer, "[%s] Unexpected EndPoint ID: `0x%02x'", TAG, endpointId));

Expand Down
22 changes: 13 additions & 9 deletions examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
*/
#include "ClusterManager.h"
#include "Globals.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app/CommandHandler.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/util/basic-types.h>
Expand Down Expand Up @@ -83,7 +82,9 @@ Identify gIdentify1 = {

void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId));
using namespace app::Clusters::OnOff::Attributes;

VerifyOrExit(attributeId == OnOff::Id, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2,
PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId));

Expand All @@ -97,11 +98,13 @@ void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, A

void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
using namespace app::Clusters::LevelControl::Attributes;

bool onOffState = mEndpointOnOffState[endpointId - 1];
uint8_t brightness = onOffState ? *value : 0;

VerifyOrExit(brightness > 0, PLAT_LOG("Brightness set to 0, ignoring"));
VerifyOrExit(attributeId == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(attributeId == CurrentLevel::Id, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2,
PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId));

Expand All @@ -118,26 +121,27 @@ void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId

void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID ||
attributeId == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID,
using namespace app::Clusters::ColorControl::Attributes;

VerifyOrExit(attributeId == CurrentHue::Id || attributeId == CurrentSaturation::Id,
PLAT_LOG("Unhandled AttributeId ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2,
PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId));

if (endpointId == ENDPOINT_ID_1)
{
uint8_t hue, saturation;
if (attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID)
if (attributeId == CurrentHue::Id)
{
hue = *value;
/* Read Current Saturation value when Attribute change callback for HUE Attribute */
app::Clusters::ColorControl::Attributes::CurrentSaturation::Get(endpointId, &saturation);
CurrentSaturation::Get(endpointId, &saturation);
}
else
{
saturation = *value;
/* Read Current Hue value when Attribute change callback for SATURATION Attribute */
app::Clusters::ColorControl::Attributes::CurrentHue::Get(endpointId, &hue);
CurrentHue::Get(endpointId, &hue);
}
PLAT_LOG("Color Control triggered: Hue: %d Saturation: %d", hue, saturation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "ClusterManager.h"

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
Expand Down
25 changes: 14 additions & 11 deletions examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "Globals.h"
#include "LEDWidget.h"
#include "WiFiWidget.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app/CommandHandler.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/util/basic-types.h>
Expand Down Expand Up @@ -124,7 +124,9 @@ void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Clus

void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
using namespace app::Clusters::OnOff::Attributes;

VerifyOrExit(attributeId == OnOff::Id, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

// At this point we can assume that value points to a bool value.
Expand All @@ -137,10 +139,12 @@ void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointI

void AppDeviceCallbacks::OnLevelControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
using namespace app::Clusters::LevelControl::Attributes;

bool onOffState = mEndpointOnOffState[endpointId - 1];
uint8_t brightness = onOffState ? *value : 0;

VerifyOrExit(attributeId == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(attributeId == CurrentLevel::Id, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

// At this point we can assume that value points to a bool value.
Expand All @@ -155,24 +159,23 @@ void AppDeviceCallbacks::OnLevelControlAttributeChangeCallback(EndpointId endpoi
#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM
void AppDeviceCallbacks::OnColorControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID ||
attributeId == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID,
using namespace app::Clusters::ColorControl::Attributes;

VerifyOrExit(attributeId == CurrentHue::Id || attributeId == CurrentSaturation::Id,
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%04x", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
if (endpointId == 1)
{
uint8_t hue, saturation;
if (attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID)
if (attributeId == CurrentHue::Id)
{
hue = *value;
emberAfReadServerAttribute(endpointId, Clusters::ColorControl::Id, ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID,
&saturation, sizeof(uint8_t));
CurrentSaturation::Get(endpointId, &saturation);
}
else
{
saturation = *value;
emberAfReadServerAttribute(endpointId, Clusters::ColorControl::Id, ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID, &hue,
sizeof(uint8_t));
CurrentHue::Get(endpointId, &hue);
}
statusLED1.SetColor(hue, saturation);
}
Expand Down
12 changes: 6 additions & 6 deletions examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "DeviceWithDisplay.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-enums.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
Expand Down Expand Up @@ -321,16 +322,15 @@ class EditAttributeListModel : public TouchesMatterStackModel

if (name == "OnOff" && cluster == "OnOff")
{
value = (value == "On") ? "Off" : "On";
uint8_t attributeValue = (value == "On") ? 1 : 0;
emberAfWriteServerAttribute(endpointIndex + 1, app::Clusters::OnOff::Id, ZCL_ON_OFF_ATTRIBUTE_ID,
(uint8_t *) &attributeValue, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
value = (value == "On") ? "Off" : "On";
bool attributeValue = (value == "On");
app::Clusters::OnOff::Attributes::OnOff::Set(endpointIndex + 1, attributeValue);
}

if (name == "Occupancy" && cluster == "Occupancy Sensor")
{
value = (value == "Yes") ? "No" : "Yes";
uint8_t attributeValue = (value == "Yes") ? 1 : 0;
value = (value == "Yes") ? "No" : "Yes";
bool attributeValue = (value == "Yes");
ESP_LOGI(TAG, "Occupancy changed to : %s", value.c_str());
// update the current occupancy here for hardcoded endpoint 1
app::Clusters::OccupancySensing::Attributes::Occupancy::Set(1, attributeValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include <string>
#include <vector>

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/clusters/door-lock-server/door-lock-server.h>
#include <app/server/Dnssd.h>
Expand Down
5 changes: 1 addition & 4 deletions examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "AppEvent.h"
#include "ButtonHandler.h"
#include "LEDWidget.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/server/Dnssd.h>
Expand Down Expand Up @@ -408,8 +406,7 @@ void AppTask::OnOffUpdateClusterState(intptr_t context)
uint8_t onoff = sLightLED.Get();

// write the new on/off value
EmberAfStatus status =
emberAfWriteServerAttribute(2, app::Clusters::OnOff::Id, ZCL_ON_OFF_ATTRIBUTE_ID, &onoff, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff);

if (status != EMBER_ZCL_STATUS_SUCCESS)
{
Expand Down
10 changes: 5 additions & 5 deletions examples/all-clusters-app/infineon/psoc6/src/ClusterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "ClusterManager.h"
#include "AppConfig.h"
#include "LEDWidget.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app/CommandHandler.h>
#include <app/server/Dnssd.h>
#include <app/util/basic-types.h>
Expand All @@ -49,7 +49,7 @@ ClusterManager ClusterManager::sCluster;

void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID,
VerifyOrExit(attributeId == OnOff::Attributes::OnOff::Id,
P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId)));
VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX,
P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId));
Expand All @@ -69,7 +69,7 @@ void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId
bool onOffState = mEndpointOnOffState[endpointId - 1];
uint8_t brightness = onOffState ? *value : 0;

VerifyOrExit(attributeId == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID,
VerifyOrExit(attributeId == LevelControl::Attributes::CurrentLevel::Id,
P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId)));
VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX,
P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId));
Expand All @@ -90,7 +90,7 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId
if (endpointId == 1)
{
uint8_t hue, saturation;
/* If the Current Attribute is ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID, read the saturation value and
/* If the Current Attribute is CurrentHue, read the saturation value and
* set the color on Cluster LED using both Saturation and Hue.
*/
if (attributeId == ColorControl::Attributes::CurrentHue::Id)
Expand All @@ -101,7 +101,7 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId
}
else
{
/* If the Current Attribute is ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID, read the Hue value and
/* If the Current Attribute is CurrentSaturation, read the Hue value and
* set the color on Cluster LED using both Saturation and Hue.
*/
saturation = *value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include "ClusterManager.h"

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/util/af-types.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "AllClustersCommandDelegate.h"

#include <app-common/zap-generated/att-storage.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
Expand Down
Loading

0 comments on commit 1477c44

Please sign in to comment.