Skip to content

Commit 94d96e4

Browse files
authored
Merge branch 'master' into granbery/electrical_measurement
2 parents 5ac33e5 + cd3e498 commit 94d96e4

File tree

123 files changed

+3947
-440
lines changed

Some content is hidden

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

123 files changed

+3947
-440
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ GPL
634634
GPLv
635635
Gradle
636636
gradlew
637+
graphviz
637638
Groupcast
638639
GroupId
639640
GroupKeyManagement

examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
#include <app-common/zap-generated/attributes/Accessors.h>
1919
#include <rvc-modes.h>
20+
#include <rvc-operational-state-delegate-impl.h>
2021

2122
using namespace chip::app::Clusters;
2223
using namespace chip::app::Clusters::RvcRunMode;
@@ -40,14 +41,24 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
4041
{
4142
uint8_t currentMode = mInstance->GetCurrentMode();
4243

43-
// Our business logic states that we can only switch into the mapping state from the idle state.
44-
if (NewMode == RvcRunMode::ModeMapping && currentMode != RvcRunMode::ModeIdle)
44+
// Our business logic states that we can only switch into a running mode from the idle state.
45+
if (NewMode != RvcRunMode::ModeIdle && currentMode != RvcRunMode::ModeIdle)
4546
{
4647
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
47-
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to the mapping mode is only allowed from idle"));
48+
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
4849
return;
4950
}
5051

52+
auto rvcOpStateInstance = RvcOperationalState::GetRvcOperationalStateInstance();
53+
if (NewMode == RvcRunMode::ModeIdle)
54+
{
55+
rvcOpStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped));
56+
}
57+
else
58+
{
59+
rvcOpStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning));
60+
}
61+
5162
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
5263
}
5364

examples/all-clusters-app/esp32/main/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ set(SRC_DIRS_LIST
3636
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension"
3737
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/mode-support"
3838
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
39-
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd"
39+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server"
4040
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"
4141
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting"
4242
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server"

examples/chip-tool/commands/clusters/ModelCommand.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "ModelCommand.h"
2020

2121
#include <app/InteractionModelEngine.h>
22+
#include <app/icd/client/DefaultICDClientStorage.h>
2223
#include <inttypes.h>
2324

2425
using namespace ::chip;
@@ -35,6 +36,7 @@ CHIP_ERROR ModelCommand::RunCommand()
3536
}
3637

3738
ChipLogProgress(chipTool, "Sending command to node 0x%" PRIx64, mDestinationId);
39+
CheckPeerICDType();
3840

3941
CommissioneeDeviceProxy * commissioneeDeviceProxy = nullptr;
4042
if (CHIP_NO_ERROR == CurrentCommissioner().GetDeviceBeingCommissioned(mDestinationId, &commissioneeDeviceProxy))
@@ -73,3 +75,31 @@ void ModelCommand::Shutdown()
7375

7476
CHIPCommand::Shutdown();
7577
}
78+
79+
void ModelCommand::CheckPeerICDType()
80+
{
81+
if (mIsPeerLIT.HasValue())
82+
{
83+
ChipLogProgress(chipTool, "Peer ICD type is set to %s", mIsPeerLIT.Value() == 1 ? "LIT-ICD" : "non LIT-ICD");
84+
return;
85+
}
86+
87+
app::ICDClientInfo info;
88+
auto destinationPeerId = chip::ScopedNodeId(mDestinationId, CurrentCommissioner().GetFabricIndex());
89+
auto iter = CHIPCommand::sICDClientStorage.IterateICDClientInfo();
90+
if (iter == nullptr)
91+
{
92+
return;
93+
}
94+
app::DefaultICDClientStorage::ICDClientInfoIteratorWrapper clientInfoIteratorWrapper(iter);
95+
96+
while (iter->Next(info))
97+
{
98+
if (ScopedNodeId(info.peer_node.GetNodeId(), info.peer_node.GetFabricIndex()) == destinationPeerId)
99+
{
100+
ChipLogProgress(chipTool, "Peer is a registered LIT ICD.");
101+
mIsPeerLIT.SetValue(true);
102+
return;
103+
}
104+
}
105+
}

examples/chip-tool/commands/clusters/ModelCommand.h

+9
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ class ModelCommand : public CHIPCommand
5252
"Endpoint the command is targeted at.");
5353
}
5454
}
55+
AddArgument(
56+
"lit-icd-peer", 0, 1, &mIsPeerLIT,
57+
"Whether to treat the peer as a LIT ICD. false: Always no, true: Always yes, (not set): Yes if the peer is registered "
58+
"to this controller.");
5559
AddArgument("timeout", 0, UINT16_MAX, &mTimeout);
5660
}
5761

@@ -66,11 +70,16 @@ class ModelCommand : public CHIPCommand
6670
void Shutdown() override;
6771

6872
protected:
73+
bool IsPeerLIT() { return mIsPeerLIT.ValueOr(false); }
74+
6975
chip::Optional<uint16_t> mTimeout;
7076

7177
private:
7278
chip::NodeId mDestinationId;
7379
std::vector<chip::EndpointId> mEndPointId;
80+
chip::Optional<bool> mIsPeerLIT;
81+
82+
void CheckPeerICDType();
7483

7584
static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
7685
const chip::SessionHandle & sessionHandle);

examples/chip-tool/commands/clusters/ReportCommand.h

+3
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ class SubscribeAttribute : public SubscribeCommand
277277

278278
CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector<chip::EndpointId> endpointIds) override
279279
{
280+
SubscribeCommand::SetPeerLIT(IsPeerLIT());
280281
return SubscribeCommand::SubscribeAttribute(device, endpointIds, mClusterIds, mAttributeIds);
281282
}
282283

@@ -407,6 +408,7 @@ class SubscribeEvent : public SubscribeCommand
407408

408409
CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector<chip::EndpointId> endpointIds) override
409410
{
411+
SubscribeCommand::SetPeerLIT(IsPeerLIT());
410412
return SubscribeCommand::SubscribeEvent(device, endpointIds, mClusterIds, mEventIds);
411413
}
412414

@@ -538,6 +540,7 @@ class SubscribeAll : public SubscribeCommand
538540

539541
CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector<chip::EndpointId> endpointIds) override
540542
{
543+
SubscribeCommand::SetPeerLIT(IsPeerLIT());
541544
return SubscribeCommand::SubscribeAll(device, endpointIds, mClusterIds, mAttributeIds, mEventIds);
542545
}
543546

examples/chip-tool/commands/icd/ICDCommand.cpp

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

1919
#include "ICDCommand.h"
2020

21+
#include <app/icd/client/DefaultICDClientStorage.h>
2122
#include <crypto/DefaultSessionKeystore.h>
2223
#include <crypto/RawKeySessionKeystore.h>
2324

@@ -29,6 +30,11 @@ CHIP_ERROR ICDListCommand::RunCommand()
2930
auto iter = CHIPCommand::sICDClientStorage.IterateICDClientInfo();
3031
char icdAesKeyHex[Crypto::kAES_CCM128_Key_Length * 2 + 1];
3132
char icdHmacKeyHex[Crypto::kHMAC_CCM128_Key_Length * 2 + 1];
33+
if (iter == nullptr)
34+
{
35+
return CHIP_ERROR_NO_MEMORY;
36+
}
37+
app::DefaultICDClientStorage::ICDClientInfoIteratorWrapper clientInfoIteratorWrapper(iter);
3238
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
3339
fprintf(stderr, " | %-75s |\n", "Known ICDs:");
3440
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
@@ -54,8 +60,6 @@ CHIP_ERROR ICDListCommand::RunCommand()
5460
}
5561

5662
fprintf(stderr, " +-----------------------------------------------------------------------------+\n");
57-
58-
iter->Release();
5963
SetCommandExitStatus(CHIP_NO_ERROR);
6064
return CHIP_NO_ERROR;
6165
}

examples/darwin-framework-tool/BUILD.gn

+9
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ declare_args() {
4242
}
4343

4444
enable_provisional_features = config_enable_yaml_tests
45+
46+
# Disable generating compiler database by default
47+
generate_compilation_database = false
4548
}
4649

4750
sdk = "macosx"
@@ -107,6 +110,12 @@ action("build-darwin-framework") {
107110
args += [ "--no-clang" ]
108111
}
109112

113+
if (generate_compilation_database) {
114+
args += [ "--compdb" ]
115+
} else {
116+
args += [ "--no-compdb" ]
117+
}
118+
110119
if (config_enable_yaml_tests) {
111120
args += [ "--enable-encoding-sentinel-enum-values" ]
112121
} else {

examples/light-switch-app/esp32/main/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
3131
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
3232
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"
3333
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting"
34-
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd"
34+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server"
3535
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server"
3636
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server"
3737
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information"

examples/lit-icd-app/linux/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ executable("lit-icd-app") {
2121
deps = [
2222
"${chip_root}/examples/lit-icd-app/lit-icd-common",
2323
"${chip_root}/examples/platform/linux:app-main",
24-
"${chip_root}/src/app/icd:manager",
24+
"${chip_root}/src/app/icd/server:manager",
2525
"${chip_root}/src/lib",
2626
"${chip_root}/third_party/jsoncpp",
2727
]

examples/lock-app/esp32/main/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ idf_component_register(INCLUDE_DIRS
5050
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
5151
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"
5252
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting"
53-
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd"
53+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server"
5454
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server"
5555
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server"
5656
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information"
@@ -163,7 +163,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
163163
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
164164
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"
165165
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting"
166-
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd"
166+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server"
167167
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server"
168168
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server"
169169
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information"

examples/platform/silabs/BaseApplication.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#include "SilabsDeviceDataProvider.h"
3838
#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1
39-
#include <app/icd/ICDNotifier.h> // nogncheck
39+
#include <app/icd/server/ICDNotifier.h> // nogncheck
4040
#endif
4141
#include <app/server/OnboardingCodesUtil.h>
4242
#include <app/util/attribute-storage.h>

examples/shell/shell_common/cmd_otcli.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static char sTxBuffer[SHELL_OTCLI_TX_BUFFER_SIZE];
4848
static constexpr uint16_t sTxLength = SHELL_OTCLI_TX_BUFFER_SIZE;
4949
#endif // !CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI)
5050
#endif
51+
static constexpr uint16_t kMaxLineLength = 384;
5152
#else
5253
#include <sys/types.h>
5354
#include <sys/wait.h>
@@ -81,8 +82,6 @@ CHIP_ERROR cmd_otcli_dispatch(int argc, char ** argv)
8182
{
8283
CHIP_ERROR error = CHIP_NO_ERROR;
8384

84-
// From OT CLI internal lib, kMaxLineLength = 128
85-
#define kMaxLineLength 128
8685
char buff[kMaxLineLength] = { 0 };
8786
char * buff_ptr = buff;
8887
int i = 0;

examples/tv-casting-app/APIs.md

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Next, you're ready to:
6767
1. [Read](#read-operations) endpoint attributes like playback state.
6868
1. [Subscribe](#subscriptions) to playback events.
6969

70+
In order to illustrate these steps, refer to the figure below
71+
![workflow of casting video player](./diagram/workflow_of_casting_video_player.png)
72+
7073
## Build and Setup
7174

7275
The Casting Client is expected to consume the Matter TV Casting library built
Loading

scripts/build/build_darwin_framework.py

+4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def build_darwin_framework(args):
129129
if args.enable_encoding_sentinel_enum_values:
130130
cflags += ["-DCHIP_CONFIG_IM_ENABLE_ENCODING_SENTINEL_ENUM_VALUES=1"]
131131

132+
if args.compdb:
133+
cflags += ["-gen-cdb-fragment-path ", abs_path + '/compdb']
134+
132135
command += ["OTHER_CFLAGS=" + ' '.join(cflags), "OTHER_LDFLAGS=" + ' '.join(ldflags)]
133136
command_result = run_command(command)
134137
print("Build Framework Result: {}".format(command_result))
@@ -172,6 +175,7 @@ def build_darwin_framework(args):
172175
parser.add_argument('--ble', action=argparse.BooleanOptionalAction)
173176
parser.add_argument('--clang', action=argparse.BooleanOptionalAction)
174177
parser.add_argument('--enable-encoding-sentinel-enum-values', action=argparse.BooleanOptionalAction)
178+
parser.add_argument('--compdb', action=argparse.BooleanOptionalAction)
175179

176180
args = parser.parse_args()
177181
build_darwin_framework(args)
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2020-2023 Project CHIP Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
JQ=$(which jq)
19+
if [ $? -ne 0 ]; then
20+
echo "'jq' not detected in PATH. Install using: brew install jq"
21+
exit 1
22+
fi
23+
24+
set -e
25+
set -x
26+
27+
source "$(dirname "$0")/../../scripts/activate.sh"
28+
CHIP_ROOT="$(dirname "$0")/../.."
29+
OUTPUT_DIR=$2
30+
31+
# Build the framework
32+
scripts/examples/gn_build_example.sh "$@" generate_compilation_database=true
33+
34+
# Clean up any stale DB files
35+
find "$OUTPUT_DIR" -iname compile_commands\*.json | xargs rm
36+
37+
# Construct json from fragments generated by xcodebuild
38+
COMPDB_FRAGMENTS_DIR=$(find "$OUTPUT_DIR" -type d -name compdb)
39+
sed -e '1s/^/[\'$'\n''/' -e '$s/,$/\'$'\n'']/' "$COMPDB_FRAGMENTS_DIR"/*.json >"$OUTPUT_DIR"/compile_commands_darwin_framework.json
40+
41+
# Get ninja to build comdb for the rest
42+
ninja -C "$OUTPUT_DIR" -t compdb >"$OUTPUT_DIR"/compile_commands_rest.json
43+
44+
# Combine the generated compdb into one
45+
find "$OUTPUT_DIR" -iname compile_commands\*.json | xargs jq -s 'map(.[])' >"$OUTPUT_DIR"/compile_commands.json

src/app/BUILD.gn

+12-5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ source_set("pre-encoded-value") {
114114
]
115115
}
116116

117+
source_set("subscription-manager") {
118+
sources = [ "SubscriptionManager.h" ]
119+
120+
public_deps = [ "${chip_root}/src/lib/core" ]
121+
}
122+
117123
source_set("message-def") {
118124
sources = [
119125
"MessageDef/ArrayBuilder.cpp",
@@ -247,8 +253,9 @@ static_library("interaction-model") {
247253
":app_config",
248254
":message-def",
249255
":paths",
250-
"${chip_root}/src/app/icd:icd_config",
251-
"${chip_root}/src/app/icd:observer",
256+
":subscription-manager",
257+
"${chip_root}/src/app/icd/server:icd-server-config",
258+
"${chip_root}/src/app/icd/server:observer",
252259
"${chip_root}/src/lib/address_resolve",
253260
"${chip_root}/src/lib/support",
254261
"${chip_root}/src/protocols/interaction_model",
@@ -326,7 +333,7 @@ static_library("app") {
326333
":interaction-model",
327334
":pre-encoded-value",
328335
":revision_info",
329-
"${chip_root}/src/app/icd:icd_config",
336+
"${chip_root}/src/app/icd/server:icd-server-config",
330337
"${chip_root}/src/lib/address_resolve",
331338
"${chip_root}/src/lib/support",
332339
"${chip_root}/src/messaging",
@@ -346,8 +353,8 @@ static_library("app") {
346353

347354
if (chip_enable_icd_server) {
348355
public_deps += [
349-
"${chip_root}/src/app/icd:manager",
350-
"${chip_root}/src/app/icd:notifier",
356+
"${chip_root}/src/app/icd/server:manager",
357+
"${chip_root}/src/app/icd/server:notifier",
351358
]
352359
}
353360

src/app/FailSafeContext.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
* Provides the implementation of the FailSafeContext object.
2121
*/
2222
#include "FailSafeContext.h"
23-
#include <app/icd/ICDConfig.h>
23+
#include <app/icd/server/ICDServerConfig.h>
2424
#if CHIP_CONFIG_ENABLE_ICD_SERVER
25-
#include <app/icd/ICDNotifier.h> // nogncheck
25+
#include <app/icd/server/ICDNotifier.h> // nogncheck
2626
#endif
2727
#include <lib/support/SafeInt.h>
2828
#include <platform/CHIPDeviceConfig.h>

0 commit comments

Comments
 (0)