Skip to content

Commit

Permalink
Merge branch 'master' into chef-robotic-vacuum-cleaner-326681447
Browse files Browse the repository at this point in the history
  • Loading branch information
stingchang authored Jun 5, 2024
2 parents 87539ff + 92a322d commit 056dcaf
Show file tree
Hide file tree
Showing 100 changed files with 2,298 additions and 547 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/examples-tizen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ jobs:
with:
platform: tizen

- name: Set up environment for size reports
uses: ./.github/actions/setup-size-reports
if: ${{ !env.ACT }}
with:
gh-context: ${{ toJson(github) }}

- name: Build Tizen examples
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -61,3 +67,20 @@ jobs:
build \
--copy-artifacts-to out/artifacts \
"
- name: Bloat report - chip-tool
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
tizen arm chip-tool-ubsan out/tizen-arm-chip-tool-ubsan/chip-tool \
/tmp/bloat_reports/
- name: Bloat report - all-clusters-app
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
tizen arm all-clusters-app out/tizen-arm-all-clusters/chip-all-clusters-app \
/tmp/bloat_reports/
- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
if: ${{ !env.ACT }}
with:
platform-name: Tizen
88 changes: 88 additions & 0 deletions build/chip/python_wheel.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 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.

import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")

import("$dir_pw_build/python.gni")
import("${chip_root}/src/system/system.gni")

declare_args() {
chip_python_version = "0.0"
chip_python_package_prefix = "chip"
chip_python_supports_stack_locking = chip_system_config_locking != "none"
}

template("chip_python_wheel_action") {
_dist_dir = "${root_out_dir}/controller/python"

_py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json"

pw_python_action(target_name) {
script = "build-chip-wheel.py"
forward_variables_from(invoker, "*")

_py_manifest_files_rebased = []
foreach(_manifest_entry, py_manifest_files) {
inputs += _manifest_entry.sources
_py_manifest_files_rebased += [
{
src_dir = rebase_path(_manifest_entry.src_dir,
get_path_info(_py_manifest_file, "dir"))
sources =
rebase_path(_manifest_entry.sources, _manifest_entry.src_dir)
},
]
}

if (defined(invoker.py_scripts)) {
_py_scripts = invoker.py_scripts
} else {
_py_scripts = []
}

_py_manifest = {
files = _py_manifest_files_rebased
packages = py_packages
scripts = _py_scripts
package_reqs = py_package_reqs
}

write_file(_py_manifest_file, _py_manifest, "json")

args = [
"--package_name",
py_package_name,
"--build_number",
chip_python_version,
"--build_dir",
rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir),
"--dist_dir",
rebase_path(_dist_dir, root_build_dir),
"--manifest",
rebase_path(_py_manifest_file, root_build_dir),
"--plat-name",
py_platform_tag,
]

if (defined(invoker.lib_name)) {
args += [
"--lib-name",
lib_name,
]
}

outputs = [ "${_dist_dir}/$output_name" ]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9211,7 +9211,7 @@ endpoint 2 {
}
}
endpoint 65534 {
device type ma_secondary_network_commissioning = 4293984258, version 1;
device type ma_secondary_network_interface = 25, version 1;


server cluster Descriptor {
Expand Down
20 changes: 10 additions & 10 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"fileFormat": 2,
"featureLevel": 100,
"featureLevel": 102,
"creator": "zap",
"keyValuePairs": [
{
Expand Down Expand Up @@ -24779,27 +24779,27 @@
"id": 4,
"name": "Anonymous Endpoint Type",
"deviceTypeRef": {
"code": 4293984258,
"code": 25,
"profileId": 259,
"label": "MA-secondary-network-commissioning",
"name": "MA-secondary-network-commissioning"
"label": "MA-secondary-network-interface",
"name": "MA-secondary-network-interface"
},
"deviceTypes": [
{
"code": 4293984258,
"code": 25,
"profileId": 259,
"label": "MA-secondary-network-commissioning",
"name": "MA-secondary-network-commissioning"
"label": "MA-secondary-network-interface",
"name": "MA-secondary-network-interface"
}
],
"deviceVersions": [
1
],
"deviceIdentifiers": [
4293984258
25
],
"deviceTypeName": "MA-secondary-network-commissioning",
"deviceTypeCode": 4293984258,
"deviceTypeName": "MA-secondary-network-interface",
"deviceTypeCode": 25,
"deviceTypeProfileId": 259,
"clusters": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@
#define CHIP_CONFIG_MAX_PATHS_PER_INVOKE 5

#define CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER 1

// Claim a device type while advertising that matches the device type on our
// endpoint 1. 0x0101 is the "Dimmable Light" device type.
#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0101
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
// All clusters app has 3 group endpoints. This needs to defined here so that
// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured.
#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3

// Claim a device type while advertising that matches the device type on our
// endpoint 1. 0x0101 is the "Dimmable Light" device type.
#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0101
Original file line number Diff line number Diff line change
Expand Up @@ -6920,7 +6920,7 @@ endpoint 2 {
}
}
endpoint 65534 {
device type ma_secondary_network_commissioning = 4293984258, version 1;
device type ma_secondary_network_interface = 25, version 1;


server cluster Descriptor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"fileFormat": 2,
"featureLevel": 100,
"featureLevel": 102,
"creator": "zap",
"keyValuePairs": [
{
Expand Down Expand Up @@ -11837,27 +11837,27 @@
"id": 4,
"name": "Anonymous Endpoint Type",
"deviceTypeRef": {
"code": 4293984258,
"code": 25,
"profileId": 259,
"label": "MA-secondary-network-commissioning",
"name": "MA-secondary-network-commissioning"
"label": "MA-secondary-network-interface",
"name": "MA-secondary-network-interface"
},
"deviceTypes": [
{
"code": 4293984258,
"code": 25,
"profileId": 259,
"label": "MA-secondary-network-commissioning",
"name": "MA-secondary-network-commissioning"
"label": "MA-secondary-network-interface",
"name": "MA-secondary-network-interface"
}
],
"deviceVersions": [
1
],
"deviceIdentifiers": [
4293984258
25
],
"deviceTypeName": "MA-secondary-network-commissioning",
"deviceTypeCode": 4293984258,
"deviceTypeName": "MA-secondary-network-interface",
"deviceTypeCode": 25,
"deviceTypeProfileId": 259,
"clusters": [
{
Expand Down
39 changes: 36 additions & 3 deletions examples/chip-tool/commands/clusters/ClusterCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#pragma once

#include <app/tests/suites/commands/interaction_model/InteractionModel.h>

#include "DataModelLogger.h"
#include "ModelCommand.h"
#include <app/tests/suites/commands/interaction_model/InteractionModel.h>

class ClusterCommand : public InteractionModelCommands, public ModelCommand, public chip::app::CommandSender::Callback
{
Expand Down Expand Up @@ -64,6 +63,17 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
return CHIP_NO_ERROR;
}

CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
chip::CommandId commandId,
const chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type & value)
{
ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value));
mScopedNodeId = chip::ScopedNodeId(value.checkInNodeID, device->GetSecureSession().Value()->GetFabricIndex());
mMonitoredSubject = value.monitoredSubject;
memcpy(mICDSymmetricKey, value.key.data(), value.key.size());
return CHIP_NO_ERROR;
}

CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
chip::CommandId commandId,
const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value)
Expand Down Expand Up @@ -117,11 +127,32 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
mError = error;
return;
}
if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) &&
(path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id))
{
chip::TLV::TLVReader counterTlvReader;
counterTlvReader.Init(*data);
chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value;
CHIP_ERROR err = chip::app::DataModel::Decode(counterTlvReader, value);
if (CHIP_NO_ERROR != err)
{
ChipLogError(chipTool, "Failed to decode ICD counter: %" CHIP_ERROR_FORMAT, err.Format());
return;
}

chip::app::ICDClientInfo clientInfo;
clientInfo.peer_node = mScopedNodeId;
clientInfo.monitored_subject = mMonitoredSubject;
clientInfo.start_icd_counter = value.ICDCounter;

StoreICDEntryWithKey(clientInfo, chip::ByteSpan(mICDSymmetricKey));
}
}

if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) &&
(path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id))
{
ModelCommand::ClearICDEntry(mScopedNodeId);
ClearICDEntry(mScopedNodeId);
}
}

Expand Down Expand Up @@ -223,6 +254,8 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
chip::ClusterId mClusterId;
chip::CommandId mCommandId;
chip::ScopedNodeId mScopedNodeId;
uint64_t mMonitoredSubject = static_cast<uint64_t>(0);
uint8_t mICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length];
CHIP_ERROR mError = CHIP_NO_ERROR;
CustomArgument mPayload;
};
18 changes: 17 additions & 1 deletion examples/chip-tool/commands/clusters/ModelCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void ModelCommand::Shutdown()
CHIPCommand::Shutdown();
}

void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId)
void ModelCommand::ClearICDEntry(const ScopedNodeId & nodeId)
{
CHIP_ERROR deleteEntryError = CHIPCommand::sICDClientStorage.DeleteEntry(nodeId);
if (deleteEntryError != CHIP_NO_ERROR)
Expand All @@ -85,6 +85,22 @@ void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId)
}
}

void ModelCommand::StoreICDEntryWithKey(app::ICDClientInfo & clientInfo, ByteSpan key)
{
CHIP_ERROR err = CHIPCommand::sICDClientStorage.SetKey(clientInfo, key);
if (err == CHIP_NO_ERROR)
{
err = CHIPCommand::sICDClientStorage.StoreEntry(clientInfo);
}

if (err != CHIP_NO_ERROR)
{
CHIPCommand::sICDClientStorage.RemoveKey(clientInfo);
ChipLogError(chipTool, "Failed to persist symmetric key with error: %" CHIP_ERROR_FORMAT, err.Format());
return;
}
}

void ModelCommand::CheckPeerICDType()
{
if (mIsPeerLIT.HasValue())
Expand Down
4 changes: 2 additions & 2 deletions examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class ModelCommand : public CHIPCommand

virtual CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) { return CHIP_ERROR_BAD_REQUEST; };

virtual void ClearICDEntry(const chip::ScopedNodeId & nodeId);

void ClearICDEntry(const chip::ScopedNodeId & nodeId);
void StoreICDEntryWithKey(chip::app::ICDClientInfo & clientinfo, chip::ByteSpan key);
void Shutdown() override;

protected:
Expand Down
Loading

0 comments on commit 056dcaf

Please sign in to comment.