Skip to content

Commit

Permalink
Merge branch 'project-chip:master' into Set-3-20-24
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-marquez-csa authored Mar 22, 2024
2 parents b061215 + 0f9542b commit 2387724
Show file tree
Hide file tree
Showing 33 changed files with 846 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bloat_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
--github-limit-artifacts 500 \
--github-limit-comments 20 \
--github-repository project-chip/connectedhomeip \
--github-api-token "${{ secrets.BLOAT_REPORT }}"
--github-api-token "${{ secrets.GITHUB_TOKEN }}"
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ jobs:
--known-failure app/util/generic-callbacks.h \
--known-failure app/util/generic-callback-stubs.cpp \
--known-failure app/util/im-client-callbacks.h \
--known-failure app/util/MatterCallbacks.h \
--known-failure app/util/util.cpp \
--known-failure app/util/util.h \
--known-failure app/WriteHandler.h \
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/silabs/include/ShellCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

#if defined(ENABLE_CHIP_SHELL)

namespace LightSwtichCommands {
namespace LightSwitchCommands {

void RegisterSwitchCommands();

} // namespace LightSwtichCommands
} // namespace LightSwitchCommands

#endif // defined(ENABLE_CHIP_SHELL)
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/src/LightSwitchMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CHIP_ERROR LightSwitchMgr::Init(EndpointId lightSwitchEndpoint, chip::EndpointId
}

#if defined(ENABLE_CHIP_SHELL)
LightSwtichCommands::RegisterSwitchCommands();
LightSwitchCommands::RegisterSwitchCommands();
#endif // defined(ENABLE_CHIP_SHELL)

return error;
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/silabs/src/ShellCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace chip;
using namespace chip::app;

namespace LightSwtichCommands {
namespace LightSwitchCommands {

using Shell::Engine;
using Shell::shell_command_t;
Expand Down Expand Up @@ -286,6 +286,6 @@ void RegisterSwitchCommands()
Engine::Root().RegisterCommands(&sSwitchCommand, 1);
}

} // namespace LightSwtichCommands
} // namespace LightSwitchCommands

#endif // ENABLE_CHIP_SHELL
6 changes: 3 additions & 3 deletions integrations/cloudbuild/build-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:
- "--init"
- "--recursive"
id: Submodules
- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -21,7 +21,7 @@ steps:
path: /pwenv
timeout: 900s

- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand Down Expand Up @@ -85,7 +85,7 @@ steps:
--target k32w-shell
build
--create-archives /workspace/artifacts/
- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand Down
6 changes: 3 additions & 3 deletions integrations/cloudbuild/chef.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
steps:
- name: "ghcr.io/project-chip/chip-build-vscode:35"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -12,7 +12,7 @@ steps:
path: /pwenv
timeout: 2700s

- name: "ghcr.io/project-chip/chip-build-vscode:35"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -27,7 +27,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:35"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand Down
14 changes: 7 additions & 7 deletions integrations/cloudbuild/smoke-test.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
steps:
- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
entrypoint: "bash"
args:
- "-c"
- |
git config --global --add safe.directory "*"
git submodule update --init --recursive
id: Submodules
- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -22,7 +22,7 @@ steps:
path: /pwenv
timeout: 900s

- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
id: ESP32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -43,7 +43,7 @@ steps:
volumes:
- name: pwenv
path: /pwenv
- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
id: NRFConnect
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -64,7 +64,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
id: EFR32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -86,7 +86,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
id: Linux
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down Expand Up @@ -139,7 +139,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:36"
- name: "ghcr.io/project-chip/chip-build-vscode:41"
id: Android
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
41 : [nrfconnect] Update nRF Connect SDK version.
42 : [Ameba] Update Ameba System time
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL org.opencontainers.image.source https://github.com/project-chip/connectedh

# Setup Ameba
ARG AMEBA_DIR=/opt/ameba
ARG TAG_NAME=ameba_update_2023_12_15
ARG TAG_NAME=ameba_update_2024_03_22
RUN set -x \
&& apt-get update \
&& mkdir ${AMEBA_DIR} \
Expand Down
7 changes: 7 additions & 0 deletions scripts/setup/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,10 @@ setuptools==68.0.0
# via
# pip-tools
# west

# Manual edits:

# Higher versions depend on proto-plus, which break
# nanopb code generation (due to name conflict of the 'proto' module)
google-api-core==2.17.0

27 changes: 26 additions & 1 deletion scripts/tools/memory/memdf/util/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import itertools
import logging
import os
import subprocess
from typing import Iterable, Mapping, Optional

import dateutil # type: ignore
Expand Down Expand Up @@ -173,7 +174,31 @@ def download_artifact(self, artifact_id: int):
logging.debug('Downloading artifact %d', artifact_id)
try:
assert self.ghapi
return self.ghapi.actions.download_artifact(artifact_id, 'zip')

# It seems like github artifact download is at least partially broken
# (see https://github.com/project-chip/connectedhomeip/issues/32656)
#
# This makes `self.ghapi.actions.download_artifact` not work
#
# Oddly enough downloading via CURL seems ok
owner = self.config['github.owner']
repo = self.config['github.repo']
token = self.config['github.token']

download_url = f"https://api.github.com/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip"

# Follow https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact
return subprocess.check_output(
[
'curl',
'-L',
'-H', 'Accept: application/vnd.github+json',
'-H', f'Authorization: Bearer {token}',
'-H', 'X-GitHub-Api-Version: 2022-11-28',
'--output', '-',
download_url
]
)
except Exception as e:
logging.error('Failed to download artifact %d: %s', artifact_id, e)
return None
Expand Down
2 changes: 2 additions & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ static_library("interaction-model") {
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/app/icd/server:observer",
"${chip_root}/src/app/util:af-types",
"${chip_root}/src/app/util:callbacks",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:static-support",
Expand Down Expand Up @@ -318,6 +319,7 @@ static_library("app") {
":interaction-model",
"${chip_root}/src/app/data-model",
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/app/util:callbacks",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
Expand Down
17 changes: 4 additions & 13 deletions src/app/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ Status CommandHandler::ProcessCommandDataIB(CommandDataIB::Parser & aCommandElem
{
ChipLogDetail(DataManagement, "Received command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI,
concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId));
SuccessOrExit(err = MatterPreCommandReceivedCallback(concretePath, GetSubjectDescriptor()));
SuccessOrExit(err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor()));
mpCallback->DispatchCommand(*this, concretePath, commandDataReader);
MatterPostCommandReceivedCallback(concretePath, GetSubjectDescriptor());
DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor());
}

exit:
Expand Down Expand Up @@ -555,11 +555,11 @@ Status CommandHandler::ProcessGroupCommandDataIB(CommandDataIB::Parser & aComman
continue;
}
}
if ((err = MatterPreCommandReceivedCallback(concretePath, GetSubjectDescriptor())) == CHIP_NO_ERROR)
if ((err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())) == CHIP_NO_ERROR)
{
TLV::TLVReader dataReader(commandDataReader);
mpCallback->DispatchCommand(*this, concretePath, dataReader);
MatterPostCommandReceivedCallback(concretePath, GetSubjectDescriptor());
DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor());
}
else
{
Expand Down Expand Up @@ -1053,12 +1053,3 @@ void CommandHandler::TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::E

} // namespace app
} // namespace chip

CHIP_ERROR __attribute__((weak)) MatterPreCommandReceivedCallback(const chip::app::ConcreteCommandPath & commandPath,
const chip::Access::SubjectDescriptor & subjectDescriptor)
{
return CHIP_NO_ERROR;
}
void __attribute__((weak)) MatterPostCommandReceivedCallback(const chip::app::ConcreteCommandPath & commandPath,
const chip::Access::SubjectDescriptor & subjectDescriptor)
{}
12 changes: 9 additions & 3 deletions src/app/ConcreteAttributePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,15 @@ struct ConcreteDataAttributePath : public ConcreteAttributePath

bool MatchesConcreteAttributePath(const ConcreteAttributePath & aOther) { return ConcreteAttributePath::operator==(aOther); }

bool operator==(const ConcreteDataAttributePath & aOther) const = delete;
bool operator!=(const ConcreteDataAttributePath & aOther) const = delete;
bool operator<(const ConcreteDataAttributePath & aOther) const = delete;
bool operator==(const ConcreteDataAttributePath & aOther) const
{
return ConcreteAttributePath::operator==(aOther) && (mListIndex == aOther.mListIndex) && (mListOp == aOther.mListOp) &&
(mDataVersion == aOther.mDataVersion);
}

bool operator!=(const ConcreteDataAttributePath & aOther) const { return !(*this == aOther); }

bool operator<(const ConcreteDataAttributePath & aOther) const = delete;

//
// This index is only valid if `mListOp` is set to a list item operation, i.e
Expand Down
17 changes: 10 additions & 7 deletions src/app/WriteHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData
mProcessingAttributeIsList = dataAttributePath.IsListOperation();
mProcessingAttributePath.SetValue(dataAttributePath);

MatterPreAttributeWriteCallback(dataAttributePath);
DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Write,
DataModelCallbacks::OperationOrder::Pre, dataAttributePath);

TLV::TLVWriter backup;
DataVersion version = 0;
mWriteResponseBuilder.GetWriteResponses().Checkpoint(backup);
Expand All @@ -348,7 +350,9 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData
mWriteResponseBuilder.GetWriteResponses().Rollback(backup);
err = AddStatus(dataAttributePath, StatusIB(err));
}
MatterPostAttributeWriteCallback(dataAttributePath);

DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Write,
DataModelCallbacks::OperationOrder::Post, dataAttributePath);
SuccessOrExit(err);
}

Expand Down Expand Up @@ -482,7 +486,8 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut

chip::TLV::TLVReader tmpDataReader(dataReader);

MatterPreAttributeWriteCallback(dataAttributePath);
DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Write,
DataModelCallbacks::OperationOrder::Pre, dataAttributePath);
err = WriteSingleClusterData(subjectDescriptor, dataAttributePath, tmpDataReader, this);

if (err != CHIP_NO_ERROR)
Expand All @@ -493,7 +498,8 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut
mapping.endpoint_id, ChipLogValueMEI(dataAttributePath.mClusterId),
ChipLogValueMEI(dataAttributePath.mAttributeId), err.Format());
}
MatterPostAttributeWriteCallback(dataAttributePath);
DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Write,
DataModelCallbacks::OperationOrder::Post, dataAttributePath);
}

dataAttributePath.mEndpointId = kInvalidEndpointId;
Expand Down Expand Up @@ -677,6 +683,3 @@ void WriteHandler::MoveToState(const State aTargetState)

} // namespace app
} // namespace chip

void __attribute__((weak)) MatterPreAttributeWriteCallback(const chip::app::ConcreteAttributePath & attributePath) {}
void __attribute__((weak)) MatterPostAttributeWriteCallback(const chip::app::ConcreteAttributePath & attributePath) {}
13 changes: 8 additions & 5 deletions src/app/reporting/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,15 @@ Engine::RetrieveClusterData(const SubjectDescriptor & aSubjectDescriptor, bool a
{
ChipLogDetail(DataManagement, "<RE:Run> Cluster %" PRIx32 ", Attribute %" PRIx32 " is dirty", aPath.mClusterId,
aPath.mAttributeId);
MatterPreAttributeReadCallback(aPath);

DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read,
DataModelCallbacks::OperationOrder::Pre, aPath);

ReturnErrorOnFailure(ReadSingleClusterData(aSubjectDescriptor, aIsFabricFiltered, aPath, aAttributeReportIBs, aEncoderState));
MatterPostAttributeReadCallback(aPath);

DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read,
DataModelCallbacks::OperationOrder::Post, aPath);

return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -996,9 +1002,6 @@ void Engine::ScheduleUrgentEventDeliverySync(Optional<FabricIndex> fabricIndex)
} // namespace app
} // namespace chip

void __attribute__((weak)) MatterPreAttributeReadCallback(const chip::app::ConcreteAttributePath & attributePath) {}
void __attribute__((weak)) MatterPostAttributeReadCallback(const chip::app::ConcreteAttributePath & attributePath) {}

// TODO: MatterReportingAttributeChangeCallback should just live in libCHIP,
// instead of being in ember-compatibility-functions. It does not depend on any
// app-specific generated bits.
Expand Down
Loading

0 comments on commit 2387724

Please sign in to comment.