Skip to content

Commit 13bfff9

Browse files
authored
Merge branch 'master' into add-water-heater-management-to-all-clusters-app
2 parents 1976356 + 1b1340f commit 13bfff9

File tree

14 files changed

+379
-16
lines changed

14 files changed

+379
-16
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/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/clusters/on-off-server/on-off-server.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ void UpdateModeBaseCurrentModeToOnMode(EndpointId endpoint)
8989

9090
#endif // MATTER_DM_PLUGIN_MODE_BASE
9191

92+
template <typename EnumType>
93+
bool IsKnownEnumValue(EnumType value)
94+
{
95+
return (EnsureKnownEnumValue(value) != EnumType::kUnknownEnumValue);
96+
}
97+
9298
} // namespace
9399

94100
#ifdef MATTER_DM_PLUGIN_LEVEL_CONTROL
@@ -609,6 +615,35 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a
609615
chip::EndpointId endpoint = commandPath.mEndpointId;
610616
Status status = Status::Success;
611617

618+
if (effectId != EffectIdentifierEnum::kUnknownEnumValue)
619+
{
620+
// Depending on effectId value, effectVariant enum type varies.
621+
// The following check validates that effectVariant value is valid in relation to the applicable enum type.
622+
// DelayedAllOffEffectVariantEnum or DyingLightEffectVariantEnum
623+
if (effectId == EffectIdentifierEnum::kDelayedAllOff &&
624+
!IsKnownEnumValue(static_cast<DelayedAllOffEffectVariantEnum>(effectVariant)))
625+
{
626+
// The server does not support the given variant, it SHALL use the default variant.
627+
effectVariant = to_underlying(DelayedAllOffEffectVariantEnum::kDelayedOffFastFade);
628+
}
629+
else if (effectId == EffectIdentifierEnum::kDyingLight &&
630+
!IsKnownEnumValue(static_cast<DyingLightEffectVariantEnum>(effectVariant)))
631+
{
632+
// The server does not support the given variant, it SHALL use the default variant.
633+
effectVariant = to_underlying(DyingLightEffectVariantEnum::kDyingLightFadeOff);
634+
}
635+
}
636+
else
637+
{
638+
status = Status::ConstraintError;
639+
}
640+
641+
if (status != Status::Success)
642+
{
643+
commandObj->AddStatus(commandPath, status);
644+
return true;
645+
}
646+
612647
if (SupportsLightingApplications(endpoint))
613648
{
614649
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT

src/app/clusters/thermostat-server/thermostat-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr
409409
requested = *value;
410410
if (!AutoSupported)
411411
return imcode::UnsupportedAttribute;
412-
if (requested < 0 || requested > 25)
412+
if (requested < 0 || requested > 127)
413413
return imcode::InvalidValue;
414414
return imcode::Success;
415415
}

src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ tests:
243243
response:
244244
constraints:
245245
type: int8s
246-
minValue: -25
247-
maxValue: 25
246+
minValue: -127
247+
maxValue: 127
248248

249249
- label: "Step 13a: TH reads attribute OccupiedCoolingSetpoint from the DUT"
250250
PICS: TSTAT.S.F01 && TSTAT.S.A0017 && TSTAT.S.A0018
@@ -426,7 +426,7 @@ tests:
426426
constraints:
427427
type: int8s
428428
minValue: 0
429-
maxValue: 25
429+
maxValue: 127
430430

431431
- label: "Step 22: TH reads the RemoteSensing attribute from the DUT"
432432
PICS: TSTAT.S.A001a

src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ limitations under the License.
337337
<access op="read" privilege="view"/>
338338
<access op="write" privilege="manage"/>
339339
</attribute>
340-
<attribute side="server" code="0x0010" define="LOCAL_TEMPERATURE_CALIBRATION" type="int8s" min="0xE7" max="0x19" writable="true" default="0x00" optional="true">
340+
<attribute side="server" code="0x0010" define="LOCAL_TEMPERATURE_CALIBRATION" type="int8s" min="-127" max="127" writable="true" default="0x00" optional="true">
341341
<description>LocalTemperatureCalibration</description>
342342
<access op="write" privilege="manage"/>
343343
</attribute>
@@ -361,7 +361,7 @@ limitations under the License.
361361
<description>MaxCoolSetpointLimit</description>
362362
<access op="write" privilege="manage"/>
363363
</attribute>
364-
<attribute side="server" code="0x0019" define="MIN_SETPOINT_DEAD_BAND" type="int8s" min="0" max="25" writable="true" default="25" optional="true">
364+
<attribute side="server" code="0x0019" define="MIN_SETPOINT_DEAD_BAND" type="int8s" min="0" max="127" writable="true" default="25" optional="true">
365365
<description>MinSetpointDeadBand</description>
366366
<access op="write" privilege="manage"/>
367367
</attribute>

src/controller/CommissioningWindowOpener.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(const Commissionin
126126
mCommissioningWindowVerifierCallback = nullptr;
127127
mNodeId = params.GetNodeId();
128128
mCommissioningWindowTimeout = params.GetTimeout();
129+
mTargetEndpointId = params.GetEndpointId();
129130

130131
if (params.GetReadVIDPIDAttributes())
131132
{
@@ -162,6 +163,7 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(const Commissionin
162163
mPBKDFIterations = params.GetIteration();
163164
mCommissioningWindowOption = CommissioningWindowOption::kTokenWithProvidedPIN;
164165
mDiscriminator.SetLongValue(params.GetDiscriminator());
166+
mTargetEndpointId = params.GetEndpointId();
165167

166168
mNextStep = Step::kOpenCommissioningWindow;
167169

@@ -173,9 +175,7 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindowInternal(Messaging:
173175
{
174176
ChipLogProgress(Controller, "OpenCommissioningWindow for device ID 0x" ChipLogFormatX64, ChipLogValueX64(mNodeId));
175177

176-
constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0;
177-
178-
ClusterBase cluster(exchangeMgr, sessionHandle, kAdministratorCommissioningClusterEndpoint);
178+
ClusterBase cluster(exchangeMgr, sessionHandle, mTargetEndpointId);
179179

180180
if (mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode)
181181
{

src/controller/CommissioningWindowOpener.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ class CommissioningWindowOpener
165165
Callback::Callback<OnOpenBasicCommissioningWindow> * mBasicCommissioningWindowCallback = nullptr;
166166
SetupPayload mSetupPayload;
167167
SetupDiscriminator mDiscriminator{};
168-
NodeId mNodeId = kUndefinedNodeId;
168+
NodeId mNodeId = kUndefinedNodeId;
169+
EndpointId mTargetEndpointId = kRootEndpointId; // Default endpoint for Administrator Commissioning Cluster
169170
System::Clock::Seconds16 mCommissioningWindowTimeout = System::Clock::kZero;
170171
CommissioningWindowOption mCommissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode;
171172
Crypto::Spake2pVerifier mVerifier; // Used for non-basic commissioning.

src/controller/CommissioningWindowParams.h

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <lib/core/CHIPCallback.h>
2121
#include <lib/core/CHIPError.h>
22+
#include <lib/core/DataModelTypes.h>
2223
#include <lib/core/NodeId.h>
2324
#include <lib/core/Optional.h>
2425
#include <lib/support/Span.h>
@@ -53,6 +54,13 @@ class CommissioningWindowCommonParams
5354
return static_cast<Derived &>(*this);
5455
}
5556

57+
EndpointId GetEndpointId() const { return mEndpointId; }
58+
Derived & SetEndpointId(EndpointId endpointId)
59+
{
60+
mEndpointId = endpointId;
61+
return static_cast<Derived &>(*this);
62+
}
63+
5664
System::Clock::Seconds16 GetTimeout() const { return mTimeout; }
5765
// The duration for which the commissioning window should remain open.
5866
Derived & SetTimeout(System::Clock::Seconds16 timeout)
@@ -82,6 +90,7 @@ class CommissioningWindowCommonParams
8290

8391
private:
8492
NodeId mNodeId = kUndefinedNodeId;
93+
EndpointId mEndpointId = kRootEndpointId; // Default endpoint for Administrator Commissioning Cluster
8594
System::Clock::Seconds16 mTimeout = System::Clock::Seconds16(300); // Defaulting
8695
uint32_t mIteration = 1000; // Defaulting
8796
Optional<uint16_t> mDiscriminator = NullOptional; // Using optional type to avoid picking a sentinnel in valid range

src/python_testing/TC_DeviceConformance.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import chip.clusters as Clusters
3333
from basic_composition_support import BasicCompositionTests
3434
from chip.tlv import uint
35+
from choice_conformance_support import (evaluate_attribute_choice_conformance, evaluate_command_choice_conformance,
36+
evaluate_feature_choice_conformance)
3537
from conformance_support import ConformanceDecision, conformance_allowed
3638
from global_attribute_ids import GlobalAttributeIds
3739
from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, MatterBaseTest, ProblemNotice,
@@ -188,7 +190,17 @@ def check_spec_conformance_for_commands(command_type: CommandType):
188190
check_spec_conformance_for_commands(CommandType.ACCEPTED)
189191
check_spec_conformance_for_commands(CommandType.GENERATED)
190192

191-
# TODO: Add choice checkers
193+
feature_choice_problems = evaluate_feature_choice_conformance(
194+
endpoint_id, cluster_id, self.xml_clusters, feature_map, attribute_list, all_command_list)
195+
attribute_choice_problems = evaluate_attribute_choice_conformance(
196+
endpoint_id, cluster_id, self.xml_clusters, feature_map, attribute_list, all_command_list)
197+
command_choice_problem = evaluate_command_choice_conformance(
198+
endpoint_id, cluster_id, self.xml_clusters, feature_map, attribute_list, all_command_list)
199+
200+
if feature_choice_problems or attribute_choice_problems or command_choice_problem:
201+
success = False
202+
problems.extend(feature_choice_problems + attribute_choice_problems + command_choice_problem)
203+
192204
print(f'success = {success}')
193205
return success, problems
194206

0 commit comments

Comments
 (0)