Skip to content

Commit dad8f08

Browse files
authored
Merge branch 'master' into feature/app-install-flow-public
2 parents 5ca333a + 1b1340f commit dad8f08

Some content is hidden

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

48 files changed

+1457
-83
lines changed

examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ CHIP_ERROR OpenCommissioningWindowCommand::RunCommand()
3838
VerifyOrReturnError(mSalt.HasValue(), CHIP_ERROR_INVALID_ARGUMENT);
3939
return mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams()
4040
.SetNodeId(mNodeId)
41+
.SetEndpointId(mEndpointId)
4142
.SetTimeout(mCommissioningWindowTimeout)
4243
.SetIteration(mIteration)
4344
.SetDiscriminator(mDiscriminator)
@@ -50,6 +51,7 @@ CHIP_ERROR OpenCommissioningWindowCommand::RunCommand()
5051
SetupPayload ignored;
5152
return mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams()
5253
.SetNodeId(mNodeId)
54+
.SetEndpointId(mEndpointId)
5355
.SetTimeout(mCommissioningWindowTimeout)
5456
.SetIteration(mIteration)
5557
.SetDiscriminator(mDiscriminator)
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
SB_CONFIG_MATTER=y
18+
SB_CONFIG_MATTER_OTA=n

examples/tv-casting-app/linux/simple-app-helper.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ bool gCommissionerGeneratedPasscodeFlowRunning = false;
4141

4242
DiscoveryDelegateImpl * DiscoveryDelegateImpl::_discoveryDelegateImpl = nullptr;
4343
bool gAwaitingCommissionerPasscodeInput = false;
44+
LinuxCommissionableDataProvider gSimpleAppCommissionableDataProvider;
4445
std::shared_ptr<matter::casting::core::CastingPlayer> targetCastingPlayer;
4546

4647
DiscoveryDelegateImpl * DiscoveryDelegateImpl::GetInstance()
@@ -470,9 +471,8 @@ CHIP_ERROR CommandHandler(int argc, char ** argv)
470471
// Commissioner-generated passcode, and then update the CastigApp's AppParameters to update the commissioning session's
471472
// passcode.
472473
LinuxDeviceOptions::GetInstance().payload.setUpPINCode = userEnteredPasscode;
473-
LinuxCommissionableDataProvider gCommissionableDataProvider;
474-
CHIP_ERROR err = CHIP_NO_ERROR;
475-
err = InitCommissionableDataProvider(gCommissionableDataProvider, LinuxDeviceOptions::GetInstance());
474+
CHIP_ERROR err = CHIP_NO_ERROR;
475+
err = InitCommissionableDataProvider(gSimpleAppCommissionableDataProvider, LinuxDeviceOptions::GetInstance());
476476
if (err != CHIP_NO_ERROR)
477477
{
478478
ChipLogError(AppServer,
@@ -482,7 +482,8 @@ CHIP_ERROR CommandHandler(int argc, char ** argv)
482482
}
483483
// Update the CommissionableDataProvider stored in this CastingApp's AppParameters and the CommissionableDataProvider to
484484
// be used for the commissioning session.
485-
err = matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(&gCommissionableDataProvider);
485+
err = matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(
486+
&gSimpleAppCommissionableDataProvider);
486487
if (err != CHIP_NO_ERROR)
487488
{
488489
ChipLogError(AppServer,

scripts/tests/linux/log_line_processing.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import select
1818
import subprocess
1919
import threading
20+
import time
2021
from typing import List
2122

2223

@@ -57,23 +58,31 @@ def _io_thread(self):
5758
reading
5859
"""
5960
out_wait = select.poll()
60-
out_wait.register(self.process.stdout, select.POLLIN)
61+
out_wait.register(self.process.stdout, select.POLLIN | select.POLLHUP)
6162

6263
err_wait = select.poll()
63-
err_wait.register(self.process.stderr, select.POLLIN)
64+
err_wait.register(self.process.stderr, select.POLLIN | select.POLLHUP)
6465

6566
with open(self.output_path, "wt") as f:
67+
f.write("PROCESS START: %s\n" % time.ctime())
6668
while not self.done:
6769
changes = out_wait.poll(0.1)
6870
if changes:
6971
out_line = self.process.stdout.readline()
72+
if not out_line:
73+
# stdout closed (otherwise readline should have at least \n)
74+
continue
7075
f.write(out_line)
7176
self.output_lines.put(out_line)
7277

7378
changes = err_wait.poll(0)
7479
if changes:
7580
err_line = self.process.stderr.readline()
81+
if not err_line:
82+
# stderr closed (otherwise readline should have at least \n)
83+
continue
7684
f.write(f"!!STDERR!! : {err_line}")
85+
f.write("PROCESS END: %s\n" % time.ctime())
7786

7887
def __enter__(self):
7988
self.done = False

scripts/tests/run_tv_casting_test.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,14 @@ def cmd_execute_list(app_path):
295295
default=False,
296296
help="Enable the commissioner generated passcode test flow.",
297297
)
298+
@click.option(
299+
"--log-directory",
300+
type=str,
301+
default=None,
302+
help="Where to place output logs",
303+
)
298304
def test_casting_fn(
299-
tv_app_rel_path, tv_casting_app_rel_path, commissioner_generated_passcode
305+
tv_app_rel_path, tv_casting_app_rel_path, commissioner_generated_passcode, log_directory
300306
):
301307
"""Test if the casting experience between the Linux tv-casting-app and the Linux tv-app continues to work.
302308
@@ -320,10 +326,16 @@ def test_casting_fn(
320326

321327
# Store the log files to a temporary directory.
322328
with tempfile.TemporaryDirectory() as temp_dir:
323-
linux_tv_app_log_path = os.path.join(temp_dir, LINUX_TV_APP_LOGS)
324-
linux_tv_casting_app_log_path = os.path.join(
325-
temp_dir, LINUX_TV_CASTING_APP_LOGS
326-
)
329+
if log_directory:
330+
linux_tv_app_log_path = os.path.join(log_directory, LINUX_TV_APP_LOGS)
331+
linux_tv_casting_app_log_path = os.path.join(
332+
log_directory, LINUX_TV_CASTING_APP_LOGS
333+
)
334+
else:
335+
linux_tv_app_log_path = os.path.join(temp_dir, LINUX_TV_APP_LOGS)
336+
linux_tv_casting_app_log_path = os.path.join(
337+
temp_dir, LINUX_TV_CASTING_APP_LOGS
338+
)
327339

328340
# Get all the test sequences.
329341
test_sequences = Sequence.get_test_sequences()

scripts/tools/generate_esp32_chip_factory_bin.py

+84-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import logging
2222
import os
2323
import sys
24+
from enum import Enum
2425
from types import SimpleNamespace
2526

2627
import cryptography.x509
@@ -45,6 +46,40 @@
4546
INVALID_PASSCODES = [00000000, 11111111, 22222222, 33333333, 44444444, 55555555,
4647
66666666, 77777777, 88888888, 99999999, 12345678, 87654321]
4748

49+
50+
class Product_Finish_Enum(Enum):
51+
other = 0
52+
matte = 1
53+
satin = 2
54+
polished = 3
55+
rugged = 4
56+
fabric = 5
57+
58+
59+
class Product_Color_Enum(Enum):
60+
black = 0
61+
navy = 1
62+
green = 2
63+
teal = 3
64+
maroon = 4
65+
purple = 5
66+
olive = 6
67+
gray = 7
68+
blue = 8
69+
lime = 9
70+
aqua = 10
71+
red = 11
72+
fuchsia = 12
73+
yellow = 13
74+
white = 14
75+
nickel = 15
76+
chrome = 16
77+
brass = 17
78+
copper = 18
79+
silver = 19
80+
gold = 20
81+
82+
4883
TOOLS = {}
4984

5085
FACTORY_PARTITION_CSV = 'nvs_partition.csv'
@@ -149,6 +184,31 @@
149184
'encoding': 'hex2bin',
150185
'value': None,
151186
},
187+
'product-finish': {
188+
'type': 'data',
189+
'encoding': 'u32',
190+
'value': None,
191+
},
192+
'product-color': {
193+
'type': 'data',
194+
'encoding': 'u32',
195+
'value': None,
196+
},
197+
'part-number': {
198+
'type': 'data',
199+
'encoding': 'string',
200+
'value': None,
201+
},
202+
'product-label': {
203+
'type': 'data',
204+
'encoding': 'string',
205+
'value': None,
206+
},
207+
'product-url': {
208+
'type': 'data',
209+
'encoding': 'string',
210+
'value': None,
211+
},
152212
}
153213

154214

@@ -301,6 +361,16 @@ def populate_factory_data(args, spake2p_params):
301361
FACTORY_DATA['hardware-ver']['value'] = args.hw_ver
302362
if args.hw_ver_str:
303363
FACTORY_DATA['hw-ver-str']['value'] = args.hw_ver_str
364+
if args.product_finish:
365+
FACTORY_DATA['product-finish']['value'] = Product_Finish_Enum[args.product_finish].value
366+
if args.product_color:
367+
FACTORY_DATA['product-color']['value'] = Product_Color_Enum[args.product_color].value
368+
if args.part_number:
369+
FACTORY_DATA['part-number']['value'] = args.part_number
370+
if args.product_url:
371+
FACTORY_DATA['product-url']['value'] = args.product_url
372+
if args.product_label:
373+
FACTORY_DATA['product-label']['value'] = args.product_label
304374

305375
# SupportedModes are stored as multiple entries
306376
# - sm-sz/<ep> : number of supported modes for the endpoint
@@ -471,6 +541,18 @@ def any_base_int(s): return int(s, 0)
471541
parser.add_argument('--supported-modes', type=str, nargs='+', required=False,
472542
help='List of supported modes, eg: mode1/label1/ep/"tagValue1\\mfgCode, tagValue2\\mfgCode" mode2/label2/ep/"tagValue1\\mfgCode, tagValue2\\mfgCode" mode3/label3/ep/"tagValue1\\mfgCode, tagValue2\\mfgCode"')
473543

544+
product_finish_choices = [finish.name for finish in Product_Finish_Enum]
545+
parser.add_argument("--product-finish", type=str, choices=product_finish_choices,
546+
help='Product finishes choices for product appearance')
547+
548+
product_color_choices = [color.name for color in Product_Color_Enum]
549+
parser.add_argument("--product-color", type=str, choices=product_color_choices,
550+
help='Product colors choices for product appearance')
551+
552+
parser.add_argument("--part-number", type=str, help='human readable product number')
553+
parser.add_argument("--product-label", type=str, help='human readable product label')
554+
parser.add_argument("--product-url", type=str, help='link to product specific web page')
555+
474556
parser.add_argument('-s', '--size', type=any_base_int, default=0x6000,
475557
help='The size of the partition.bin, default: 0x6000')
476558
parser.add_argument('--target', default='esp32',
@@ -509,7 +591,8 @@ def set_up_factory_data(args):
509591
def generate_factory_partiton_binary(args):
510592
generate_nvs_csv(args.output_dir, FACTORY_PARTITION_CSV)
511593
if args.generate_bin:
512-
generate_nvs_bin(args.encrypt, args.size, FACTORY_PARTITION_CSV, FACTORY_PARTITION_BIN, args.output_dir)
594+
csv_file = os.path.join(args.output_dir, FACTORY_PARTITION_CSV)
595+
generate_nvs_bin(args.encrypt, args.size, csv_file, FACTORY_PARTITION_BIN, args.output_dir)
513596
print_flashing_help(args.encrypt, args.output_dir, FACTORY_PARTITION_BIN)
514597
clean_up()
515598

scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307
{ (uint16_t) 0xBB8, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxHeatSetpointLimit */ \
308308
{ (uint16_t) 0x640, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MinCoolSetpointLimit */ \
309309
{ (uint16_t) 0xC80, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxCoolSetpointLimit */ \
310-
{ (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x19 }, /* MinSetpointDeadBand */ \
310+
{ (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x7F }, /* MinSetpointDeadBand */ \
311311
{ (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* ControlSequenceOfOperation */ \
312312
{ (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x9 }, /* SystemMode */ \
313313
\

src/app/AttributeValueEncoder.h

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class AttributeValueEncoder
162162
private:
163163
// We made EncodeListItem() private, and ListEncoderHelper will expose it by Encode()
164164
friend class ListEncodeHelper;
165+
friend class TestOnlyAttributeValueEncoderAccessor;
165166

166167
template <typename... Ts>
167168
CHIP_ERROR EncodeListItem(Ts &&... aArgs)

src/app/BUILD.gn

+24-10
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ declare_args() {
5858
chip_im_static_global_interaction_model_engine =
5959
current_os != "linux" && current_os != "mac" && current_os != "ios" &&
6060
current_os != "android"
61-
62-
# Data model interface usage:
63-
# - disabled: does not use data model interface at all
64-
# - check: runs BOTH datamodel and non-data-model (if possible) functionality and compares results
65-
# - enabled: runs only the data model interface (does not use the legacy code)
66-
if (current_os == "linux") {
67-
chip_use_data_model_interface = "check"
68-
} else {
69-
chip_use_data_model_interface = "disabled"
70-
}
7161
}
7262

7363
buildconfig_header("app_buildconfig") {
@@ -219,6 +209,7 @@ static_library("interaction-model") {
219209
"WriteClient.h",
220210
"reporting/Engine.cpp",
221211
"reporting/Engine.h",
212+
"reporting/Read.h",
222213
"reporting/ReportScheduler.h",
223214
"reporting/ReportSchedulerImpl.cpp",
224215
"reporting/ReportSchedulerImpl.h",
@@ -260,6 +251,29 @@ static_library("interaction-model") {
260251

261252
public_configs = [ "${chip_root}/src:includes" ]
262253

254+
if (chip_use_data_model_interface == "disabled") {
255+
sources += [
256+
"reporting/Read-Ember.cpp",
257+
"reporting/Read-Ember.h",
258+
]
259+
} else if (chip_use_data_model_interface == "check") {
260+
sources += [
261+
"reporting/Read-Checked.cpp",
262+
"reporting/Read-Checked.h",
263+
"reporting/Read-DataModel.cpp",
264+
"reporting/Read-DataModel.h",
265+
"reporting/Read-Ember.cpp",
266+
"reporting/Read-Ember.h",
267+
]
268+
public_deps += [ "${chip_root}/src/app/data-model-interface" ]
269+
} else { # enabled
270+
sources += [
271+
"reporting/Read-DataModel.cpp",
272+
"reporting/Read-DataModel.h",
273+
]
274+
public_deps += [ "${chip_root}/src/app/data-model-interface" ]
275+
}
276+
263277
if (chip_enable_read_client) {
264278
sources += [ "ReadClient.cpp" ]
265279
}

src/app/InteractionModelEngine.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeM
9393

9494
StatusIB::RegisterErrorFormatter();
9595

96+
#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE
97+
ChipLogError(InteractionModel, "WARNING ┌────────────────────────────────────────────────────");
98+
ChipLogError(InteractionModel, "WARNING │ Interaction Model Engine running in 'Checked' mode.");
99+
ChipLogError(InteractionModel, "WARNING │ This executes BOTH ember and data-model code paths.");
100+
ChipLogError(InteractionModel, "WARNING │ which is inefficient and consumes more flash space.");
101+
ChipLogError(InteractionModel, "WARNING │ This should be done for testing only.");
102+
ChipLogError(InteractionModel, "WARNING └────────────────────────────────────────────────────");
103+
#endif
104+
96105
return CHIP_NO_ERROR;
97106
}
98107

@@ -1697,6 +1706,16 @@ Protocols::InteractionModel::Status InteractionModelEngine::CommandExists(const
16971706
return ServerClusterCommandExists(aCommandPath);
16981707
}
16991708

1709+
InteractionModel::DataModel * InteractionModelEngine::SetDataModel(InteractionModel::DataModel * model)
1710+
{
1711+
// Alternting data model should not be done while IM is actively handling requests.
1712+
VerifyOrDie(mReadHandlers.begin() == mReadHandlers.end());
1713+
1714+
InteractionModel::DataModel * oldModel = GetDataModel();
1715+
mDataModel = model;
1716+
return oldModel;
1717+
}
1718+
17001719
InteractionModel::DataModel * InteractionModelEngine::GetDataModel() const
17011720
{
17021721
#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE

0 commit comments

Comments
 (0)