Skip to content

Commit 369a115

Browse files
authored
Merge branch 'master' into camera-zone
2 parents 64b73b6 + 2651245 commit 369a115

File tree

60 files changed

+20811
-433
lines changed

Some content is hidden

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

60 files changed

+20811
-433
lines changed

docs/testing/python.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ Python tests located in src/python_testing
5050
# for details about the block below.
5151
#
5252
# === BEGIN CI TEST ARGUMENTS ===
53-
# test-runner-runs: run1
54-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
55-
# test-runner-run/run1/factoryreset: True
56-
# test-runner-run/run1/quiet: True
57-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
58-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
53+
# test-runner-runs:
54+
# run1:
55+
# app: ${ALL_CLUSTERS_APP}
56+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
57+
# script-args: >
58+
# --storage-path admin_storage.json
59+
# --commissioning-method on-network
60+
# --discriminator 1234
61+
# --passcode 20202021
62+
# --trace-to json:${TRACE_TEST_JSON}.json
63+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
64+
# factoryreset: true
65+
# quiet: true
5966
# === END CI TEST ARGUMENTS ===
6067
6168
class TC_MYTEST_1_1(MatterBaseTest):
@@ -669,10 +676,10 @@ for that run, e.g.:
669676
# test-runner-runs:
670677
# run1:
671678
# app: ${TYPE_OF_APP}
672-
# factoryreset: <true|false>
673-
# quiet: <true|false>
674679
# app-args: <app_arguments>
675680
# script-args: <script_arguments>
681+
# factoryreset: <true|false>
682+
# quiet: <true|false>
676683
# === END CI TEST ARGUMENTS ===
677684
```
678685

@@ -701,19 +708,18 @@ for that run, e.g.:
701708
- Example:
702709
`--discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json`
703710

711+
- `app-ready-pattern`: Regular expression pattern to match against the output
712+
of the application to determine when the application is ready. If this
713+
parameter is specified, the test runner will not run the test script until
714+
the pattern is found.
715+
716+
- Example: `"Manual pairing code: \\[\\d+\\]"`
717+
704718
- `script-args`: Specifies the arguments to be passed to the test script.
705719

706720
- Example:
707721
`--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto`
708722

709-
- `script-start-delay`: Specifies the number of seconds to wait before
710-
starting the test script. This parameter can be used to allow the
711-
application to initialize itself properly before the test script will try to
712-
commission it (e.g. in case if the application needs to be commissioned to
713-
some other controller first). By default, the delay is 0 seconds.
714-
715-
- Example: `10`
716-
717723
This structured format ensures that all necessary configurations are clearly
718724
defined and easily understood, allowing for consistent and reliable test
719725
execution.

examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter

+3-3
Original file line numberDiff line numberDiff line change
@@ -5452,9 +5452,9 @@ cluster ContentLauncher = 1290 {
54525452
bitmap Feature : bitmap32 {
54535453
kContentSearch = 0x1;
54545454
kURLPlayback = 0x2;
5455-
kAdvancedSeek = 0x3;
5456-
kTextTracks = 0x4;
5457-
kAudioTracks = 0x5;
5455+
kAdvancedSeek = 0x4;
5456+
kTextTracks = 0x8;
5457+
kAudioTracks = 0x10;
54585458
}
54595459

54605460
bitmap SupportedProtocolsBitmap : bitmap32 {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
#include <app-common/zap-generated/attributes/Accessors.h>
19+
#include <refrigerator-and-temperature-controlled-cabinet-mode/tcc-mode.h>
20+
21+
#ifdef MATTER_DM_PLUGIN_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_SERVER
22+
23+
using namespace chip::app::Clusters;
24+
using namespace chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode;
25+
using chip::Protocols::InteractionModel::Status;
26+
template <typename T>
27+
using List = chip::app::DataModel::List<T>;
28+
using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
29+
30+
static std::unique_ptr<TccModeDelegate> gTccModeDelegate;
31+
static std::unique_ptr<ModeBase::Instance> gTccModeInstance;
32+
33+
CHIP_ERROR TccModeDelegate::Init()
34+
{
35+
return CHIP_NO_ERROR;
36+
}
37+
38+
void TccModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
39+
{
40+
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
41+
}
42+
43+
CHIP_ERROR TccModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
44+
{
45+
if (modeIndex >= ArraySize(kModeOptions))
46+
{
47+
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
48+
}
49+
return chip::CopyCharSpanToMutableCharSpan(kModeOptions[modeIndex].label, label);
50+
}
51+
52+
CHIP_ERROR TccModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
53+
{
54+
if (modeIndex >= ArraySize(kModeOptions))
55+
{
56+
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
57+
}
58+
value = kModeOptions[modeIndex].mode;
59+
return CHIP_NO_ERROR;
60+
}
61+
62+
CHIP_ERROR TccModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
63+
{
64+
if (modeIndex >= ArraySize(kModeOptions))
65+
{
66+
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
67+
}
68+
69+
if (tags.size() < kModeOptions[modeIndex].modeTags.size())
70+
{
71+
return CHIP_ERROR_INVALID_ARGUMENT;
72+
}
73+
74+
std::copy(kModeOptions[modeIndex].modeTags.begin(), kModeOptions[modeIndex].modeTags.end(), tags.begin());
75+
tags.reduce_size(kModeOptions[modeIndex].modeTags.size());
76+
77+
return CHIP_NO_ERROR;
78+
}
79+
80+
void RefrigeratorAndTemperatureControlledCabinetMode::Shutdown()
81+
{
82+
gTccModeInstance.reset();
83+
gTccModeDelegate.reset();
84+
}
85+
86+
chip::Protocols::InteractionModel::Status
87+
chefRefrigeratorAndTemperatureControlledCabinetModeExternalReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
88+
const EmberAfAttributeMetadata * attributeMetadata,
89+
uint8_t * buffer, uint16_t maxReadLength)
90+
{
91+
chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success;
92+
chip::AttributeId attributeId = attributeMetadata->attributeId;
93+
94+
switch (attributeId)
95+
{
96+
case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::CurrentMode::Id: {
97+
*buffer = gTccModeInstance->GetCurrentMode();
98+
ChipLogDetail(DeviceLayer, "Reading RunMode CurrentMode : %d", static_cast<int>(attributeId));
99+
}
100+
break;
101+
default:
102+
ret = chip::Protocols::InteractionModel::Status::UnsupportedRead;
103+
ChipLogDetail(DeviceLayer, "Unsupported attributeId %d from reading RefrigeratorAndTemperatureControlledCabinetMode",
104+
static_cast<int>(attributeId));
105+
break;
106+
}
107+
108+
return ret;
109+
}
110+
111+
chip::Protocols::InteractionModel::Status chefRefrigeratorAndTemperatureControlledCabinetModeExternalWriteCallback(
112+
chip::EndpointId endpointId, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
113+
{
114+
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1
115+
VerifyOrDie(gTccModeInstance != nullptr);
116+
chip::Protocols::InteractionModel::Status ret;
117+
chip::AttributeId attributeId = attributeMetadata->attributeId;
118+
119+
switch (attributeId)
120+
{
121+
case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::CurrentMode::Id: {
122+
uint8_t m = static_cast<uint8_t>(buffer[0]);
123+
ret = gTccModeInstance->UpdateCurrentMode(m);
124+
if (chip::Protocols::InteractionModel::Status::Success != ret)
125+
{
126+
ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast<int>(ret));
127+
}
128+
}
129+
break;
130+
default:
131+
ret = chip::Protocols::InteractionModel::Status::UnsupportedWrite;
132+
ChipLogError(DeviceLayer, "Unsupported Writng Attribute ID: %d", static_cast<int>(attributeId));
133+
break;
134+
}
135+
136+
return ret;
137+
}
138+
139+
void emberAfRefrigeratorAndTemperatureControlledCabinetModeClusterInitCallback(chip::EndpointId endpointId)
140+
{
141+
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
142+
VerifyOrDie(gTccModeDelegate == nullptr && gTccModeInstance == nullptr);
143+
gTccModeDelegate = std::make_unique<RefrigeratorAndTemperatureControlledCabinetMode::TccModeDelegate>();
144+
gTccModeInstance =
145+
std::make_unique<ModeBase::Instance>(gTccModeDelegate.get(), 0x1, RefrigeratorAndTemperatureControlledCabinetMode::Id, 0);
146+
gTccModeInstance->Init();
147+
}
148+
149+
#endif // MATTER_DM_PLUGIN_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_SERVER
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#pragma once
20+
21+
#include <app/clusters/mode-base-server/mode-base-server.h>
22+
#include <app/util/config.h>
23+
#include <cstring>
24+
#include <utility>
25+
26+
namespace chip {
27+
namespace app {
28+
namespace Clusters {
29+
30+
namespace RefrigeratorAndTemperatureControlledCabinetMode {
31+
32+
const uint8_t ModeNormal = 0;
33+
const uint8_t ModeRapidCool = 1;
34+
const uint8_t ModeRapidFreeze = 2;
35+
36+
/// This is an application level delegate to handle RefrigeratorAndTemperatureControlledCabinet commands according to the specific
37+
/// business logic.
38+
class TccModeDelegate : public ModeBase::Delegate
39+
{
40+
private:
41+
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
42+
ModeTagStructType modeTagsTccNormal[1] = { { .value = to_underlying(ModeBase::ModeTag::kAuto) } };
43+
ModeTagStructType modeTagsTccRapidCool[1] = { { .value = to_underlying(ModeTag::kRapidCool) } };
44+
ModeTagStructType modeTagsTccRapidFreeze[1] = { { .value = to_underlying(ModeTag::kRapidFreeze) } };
45+
46+
const detail::Structs::ModeOptionStruct::Type kModeOptions[3] = {
47+
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Normal"),
48+
.mode = ModeNormal,
49+
.modeTags = DataModel::List<const ModeTagStructType>(modeTagsTccNormal) },
50+
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Rapid Cool"),
51+
.mode = ModeRapidCool,
52+
.modeTags = DataModel::List<const ModeTagStructType>(modeTagsTccRapidCool) },
53+
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Rapid Freeze"),
54+
.mode = ModeRapidFreeze,
55+
.modeTags = DataModel::List<const ModeTagStructType>(modeTagsTccRapidFreeze) },
56+
};
57+
58+
CHIP_ERROR Init() override;
59+
void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override;
60+
61+
CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override;
62+
CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override;
63+
CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List<ModeTagStructType> & tags) override;
64+
65+
public:
66+
~TccModeDelegate() override = default;
67+
};
68+
69+
void Shutdown();
70+
71+
} // namespace RefrigeratorAndTemperatureControlledCabinetMode
72+
73+
} // namespace Clusters
74+
} // namespace app
75+
} // namespace chip
76+
77+
chip::Protocols::InteractionModel::Status
78+
chefRefrigeratorAndTemperatureControlledCabinetModeExternalReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
79+
const EmberAfAttributeMetadata * attributeMetadata,
80+
uint8_t * buffer, uint16_t maxReadLength);
81+
82+
chip::Protocols::InteractionModel::Status chefRefrigeratorAndTemperatureControlledCabinetModeExternalWriteCallback(
83+
chip::EndpointId endpointId, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer);

0 commit comments

Comments
 (0)