Skip to content

Commit 11b36f2

Browse files
committed
Merge branch 'lit_icd_support_for_cc13x4_26x4' of github.com:abiradarti/connectedhomeip into lit_icd_support_for_cc13x4_26x4
2 parents ecb05ad + 8d33c1a commit 11b36f2

File tree

100 files changed

+1971
-1417
lines changed

Some content is hidden

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

100 files changed

+1971
-1417
lines changed

.github/workflows/tests.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ jobs:
485485
--target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \
486486
--target linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test \
487487
--target linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test \
488+
--target linux-x64-network-manager-ipv6only-no-ble-no-wifi-tsan-clang-test \
488489
--target linux-x64-python-bindings \
489490
build \
490491
--copy-artifacts-to objdir-clone \
@@ -498,6 +499,7 @@ jobs:
498499
echo "LIT_ICD_APP: out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml
499500
echo "CHIP_MICROWAVE_OVEN_APP: out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app" >> /tmp/test_env.yaml
500501
echo "CHIP_RVC_APP: out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app" >> /tmp/test_env.yaml
502+
echo "NETWORK_MANAGEMENT_APP: out/linux-x64-network-manager-ipv6only-no-ble-no-wifi-tsan-clang-test/matter-network-manager-app" >> /tmp/test_env.yaml
501503
echo "TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
502504
echo "TRACE_TEST_JSON: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
503505
echo "TRACE_TEST_PERFETTO: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml

docs/guides/fabric_synchronization_guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fabricsync add-local-bridge 1
107107
Pair the Ecosystem 2 bridge to Ecosystem 1 with node ID 2:
108108

109109
```
110-
fabricsync add-bridge 2 <e2-fabric-bridge-ip>
110+
fabricsync add-bridge 2 <setup-pin-code> <e2-fabric-bridge-ip> <e2-fabric-bridge-port>
111111
```
112112

113113
This command will initiate the reverse commissioning process. After a few

docs/testing/python.md

+10
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,19 @@ markers must be present.
635635

636636
- `test-runner-run/<run_identifier>/script-args`: Specifies the arguments to
637637
be passed to the test script.
638+
638639
- Example:
639640
`--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`
640641

642+
- `test-runner-run/<run_identifier>/script-start-delay`: Specifies the number
643+
of seconds to wait before starting the test script. This parameter can be
644+
used to allow the application to initialize itself properly before the test
645+
script will try to commission it (e.g. in case if the application needs to
646+
be commissioned to some other controller first). By default, the delay is 0
647+
seconds.
648+
649+
- Example: `10`
650+
641651
This structured format ensures that all necessary configurations are clearly
642652
defined and easily understood, allowing for consistent and reliable test
643653
execution.

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,7 @@ cluster LaundryWasherControls = 83 {
32353235

32363236
/** Attributes and commands for selecting a mode from a list of supported options. */
32373237
cluster RvcRunMode = 84 {
3238-
revision 2;
3238+
revision 3;
32393239

32403240
enum ModeTag : enum16 {
32413241
kIdle = 16384;
@@ -3255,7 +3255,7 @@ cluster RvcRunMode = 84 {
32553255
}
32563256

32573257
bitmap Feature : bitmap32 {
3258-
kNoFeatures = 0x0;
3258+
kDirectModeChange = 0x10000;
32593259
}
32603260

32613261
struct ModeTagStruct {
@@ -3294,7 +3294,7 @@ cluster RvcRunMode = 84 {
32943294

32953295
/** Attributes and commands for selecting a mode from a list of supported options. */
32963296
cluster RvcCleanMode = 85 {
3297-
revision 2;
3297+
revision 3;
32983298

32993299
enum ModeTag : enum16 {
33003300
kDeepClean = 16384;
@@ -3307,7 +3307,7 @@ cluster RvcCleanMode = 85 {
33073307
}
33083308

33093309
bitmap Feature : bitmap32 {
3310-
kNoFeatures = 0x0;
3310+
kDirectModeChange = 0x10000;
33113311
}
33123312

33133313
struct ModeTagStruct {
@@ -8489,7 +8489,7 @@ endpoint 1 {
84898489
callback attribute eventList;
84908490
callback attribute attributeList;
84918491
callback attribute featureMap;
8492-
ram attribute clusterRevision default = 2;
8492+
ram attribute clusterRevision default = 3;
84938493

84948494
handle command ChangeToMode;
84958495
handle command ChangeToModeResponse;
@@ -8503,7 +8503,7 @@ endpoint 1 {
85038503
callback attribute eventList;
85048504
callback attribute attributeList;
85058505
callback attribute featureMap;
8506-
ram attribute clusterRevision default = 2;
8506+
ram attribute clusterRevision default = 3;
85078507

85088508
handle command ChangeToMode;
85098509
handle command ChangeToModeResponse;

examples/all-clusters-app/all-clusters-common/all-clusters-app.zap

+2-2
Original file line numberDiff line numberDiff line change
@@ -9648,7 +9648,7 @@
96489648
"storageOption": "RAM",
96499649
"singleton": 0,
96509650
"bounded": 0,
9651-
"defaultValue": "2",
9651+
"defaultValue": "3",
96529652
"reportable": 1,
96539653
"minInterval": 1,
96549654
"maxInterval": 65534,
@@ -9804,7 +9804,7 @@
98049804
"storageOption": "RAM",
98059805
"singleton": 0,
98069806
"bounded": 0,
9807-
"defaultValue": "2",
9807+
"defaultValue": "3",
98089808
"reportable": 1,
98099809
"minInterval": 1,
98109810
"maxInterval": 65534,

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

+23-16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818
#include <app-common/zap-generated/attributes/Accessors.h>
19+
#include <lib/support/TypeTraits.h>
1920
#include <rvc-modes.h>
2021
#include <rvc-operational-state-delegate-impl.h>
2122

@@ -41,12 +42,15 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
4142
{
4243
uint8_t currentMode = mInstance->GetCurrentMode();
4344

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)
45+
if (!gRvcRunModeInstance->HasFeature(static_cast<ModeBase::Feature>(RvcRunMode::Feature::kDirectModeChange)))
4646
{
47-
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
48-
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
49-
return;
47+
// Our business logic states that we can only switch into a running mode from the idle state.
48+
if (NewMode != RvcRunMode::ModeIdle && currentMode != RvcRunMode::ModeIdle)
49+
{
50+
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
51+
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
52+
return;
53+
}
5054
}
5155

5256
auto rvcOpStateInstance = RvcOperationalState::GetRvcOperationalStateInstance();
@@ -123,8 +127,8 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
123127
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
124128
VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr);
125129
gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate;
126-
gRvcRunModeInstance =
127-
new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
130+
gRvcRunModeInstance = new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id,
131+
chip::to_underlying(RvcRunMode::Feature::kDirectModeChange));
128132
gRvcRunModeInstance->Init();
129133
}
130134

@@ -139,14 +143,17 @@ CHIP_ERROR RvcCleanModeDelegate::Init()
139143

140144
void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
141145
{
142-
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();
143-
144-
if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
146+
if (!gRvcCleanModeInstance->HasFeature(static_cast<ModeBase::Feature>(RvcCleanMode::Feature::kDirectModeChange)))
145147
{
146-
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
147-
response.statusText.SetValue(
148-
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
149-
return;
148+
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();
149+
150+
if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
151+
{
152+
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
153+
response.statusText.SetValue(
154+
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
155+
return;
156+
}
150157
}
151158

152159
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
@@ -213,7 +220,7 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId)
213220
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
214221
VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr);
215222
gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate;
216-
gRvcCleanModeInstance =
217-
new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
223+
gRvcCleanModeInstance = new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id,
224+
chip::to_underlying(RvcCleanMode::Feature::kDirectModeChange));
218225
gRvcCleanModeInstance->Init();
219226
}

examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp

+99
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include "AllClustersCommandDelegate.h"
2020

2121
#include <app-common/zap-generated/attributes/Accessors.h>
22+
#include <app/EventLogging.h>
2223
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
24+
#include <app/clusters/occupancy-sensor-server/occupancy-sensor-server.h>
2325
#include <app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h>
2426
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
2527
#include <app/clusters/switch-server/switch-server.h>
@@ -246,6 +248,24 @@ void HandleSimulateLatchPosition(Json::Value & jsonValue)
246248
}
247249
}
248250

251+
void EmitOccupancyChangedEvent(EndpointId endpointId, uint8_t occupancyValue)
252+
{
253+
Clusters::OccupancySensing::Events::OccupancyChanged::Type event{};
254+
event.occupancy = static_cast<BitMask<Clusters::OccupancySensing::OccupancyBitmap>>(occupancyValue);
255+
EventNumber eventNumber = 0;
256+
257+
CHIP_ERROR err = LogEvent(event, endpointId, eventNumber);
258+
if (err != CHIP_NO_ERROR)
259+
{
260+
ChipLogError(NotSpecified, "Failed to log OccupancyChanged event: %" CHIP_ERROR_FORMAT, err.Format());
261+
}
262+
else
263+
{
264+
ChipLogProgress(NotSpecified, "Logged OccupancyChanged(occupancy=%u) on Endpoint %u", static_cast<unsigned>(occupancyValue),
265+
static_cast<unsigned>(endpointId));
266+
}
267+
}
268+
249269
} // namespace
250270

251271
AllClustersAppCommandHandler * AllClustersAppCommandHandler::FromJSON(const char * json)
@@ -407,6 +427,20 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context)
407427
{
408428
HandleSimulateLatchPosition(self->mJsonValue);
409429
}
430+
else if (name == "SetOccupancy")
431+
{
432+
uint8_t occupancy = static_cast<uint8_t>(self->mJsonValue["Occupancy"].asUInt());
433+
EndpointId endpointId = static_cast<EndpointId>(self->mJsonValue["EndpointId"].asUInt());
434+
435+
if (1 == occupancy || 0 == occupancy)
436+
{
437+
self->HandleSetOccupancyChange(endpointId, occupancy);
438+
}
439+
else
440+
{
441+
ChipLogError(NotSpecified, "Invalid Occupancy state to set.");
442+
}
443+
}
410444
else
411445
{
412446
ChipLogError(NotSpecified, "Unhandled command '%s': this hould never happen", name.c_str());
@@ -769,6 +803,71 @@ void AllClustersAppCommandHandler::OnAirQualityChange(uint32_t aNewValue)
769803
}
770804
}
771805

806+
void AllClustersAppCommandHandler::HandleSetOccupancyChange(EndpointId endpointId, uint8_t newOccupancyValue)
807+
{
808+
BitMask<chip::app::Clusters::OccupancySensing::OccupancyBitmap> currentOccupancy;
809+
Protocols::InteractionModel::Status status = OccupancySensing::Attributes::Occupancy::Get(endpointId, &currentOccupancy);
810+
811+
if (static_cast<BitMask<chip::app::Clusters::OccupancySensing::OccupancyBitmap>>(newOccupancyValue) == currentOccupancy)
812+
{
813+
ChipLogDetail(NotSpecified, "Skipping setting occupancy changed due to same value.");
814+
return;
815+
}
816+
817+
status = OccupancySensing::Attributes::Occupancy::Set(endpointId, newOccupancyValue);
818+
ChipLogDetail(NotSpecified, "Set Occupancy attribute to %u", newOccupancyValue);
819+
820+
if (status != Protocols::InteractionModel::Status::Success)
821+
{
822+
ChipLogDetail(NotSpecified, "Invalid value/endpoint to set.");
823+
return;
824+
}
825+
826+
EmitOccupancyChangedEvent(endpointId, newOccupancyValue);
827+
828+
if (1 == newOccupancyValue)
829+
{
830+
uint16_t * holdTime = chip::app::Clusters::OccupancySensing::GetHoldTimeForEndpoint(endpointId);
831+
if (holdTime != nullptr)
832+
{
833+
CHIP_ERROR err = chip::DeviceLayer::SystemLayer().StartTimer(
834+
chip::System::Clock::Seconds16(*holdTime), AllClustersAppCommandHandler::OccupancyPresentTimerHandler,
835+
reinterpret_cast<void *>(static_cast<uintptr_t>(endpointId)));
836+
ChipLogDetail(NotSpecified, "Start HoldTime timer");
837+
if (CHIP_NO_ERROR != err)
838+
{
839+
ChipLogError(NotSpecified, "Failed to start HoldTime timer.");
840+
}
841+
}
842+
}
843+
}
844+
845+
void AllClustersAppCommandHandler::OccupancyPresentTimerHandler(System::Layer * systemLayer, void * appState)
846+
{
847+
EndpointId endpointId = static_cast<EndpointId>(reinterpret_cast<uintptr_t>(appState));
848+
chip::BitMask<Clusters::OccupancySensing::OccupancyBitmap> currentOccupancy;
849+
850+
Protocols::InteractionModel::Status status = OccupancySensing::Attributes::Occupancy::Get(endpointId, &currentOccupancy);
851+
VerifyOrDie(status == Protocols::InteractionModel::Status::Success);
852+
853+
uint8_t clearValue = 0;
854+
if (!currentOccupancy.Has(Clusters::OccupancySensing::OccupancyBitmap::kOccupied))
855+
{
856+
return;
857+
}
858+
859+
status = OccupancySensing::Attributes::Occupancy::Set(endpointId, clearValue);
860+
if (status != Protocols::InteractionModel::Status::Success)
861+
{
862+
ChipLogDetail(NotSpecified, "Failed to set occupancy state.");
863+
}
864+
else
865+
{
866+
ChipLogDetail(NotSpecified, "Set Occupancy attribute to clear");
867+
EmitOccupancyChangedEvent(endpointId, clearValue);
868+
}
869+
}
870+
772871
void AllClustersCommandDelegate::OnEventCommandReceived(const char * json)
773872
{
774873
auto handler = AllClustersAppCommandHandler::FromJSON(json);

examples/all-clusters-app/linux/AllClustersCommandDelegate.h

+6
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ class AllClustersAppCommandHandler
115115
* Should be called when it is necessary to change the operational state as a manual operation.
116116
*/
117117
void OnOvenOperationalStateChange(std::string device, std::string operation, Json::Value param);
118+
119+
/**
120+
* Should be called when it is necessary to change the Occupancy attribute.
121+
*/
122+
void HandleSetOccupancyChange(chip::EndpointId endpointId, uint8_t occupancyValue);
123+
static void OccupancyPresentTimerHandler(chip::System::Layer * systemLayer, void * appState);
118124
};
119125

120126
class AllClustersCommandDelegate : public NamedPipeCommandDelegate

examples/all-clusters-app/linux/ButtonEventsSimulator.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ void ButtonEventsSimulator::Next()
235235
break;
236236
}
237237
case ButtonEventsSimulator::State::kEmitStartOfMultiPress: {
238+
SetButtonPosition(mEndpointId, mPressedButtonId);
238239
EmitInitialPress(mEndpointId, mPressedButtonId);
239240
if (mFeatureMap & static_cast<uint32_t>(Clusters::Switch::Feature::kActionSwitch))
240241
{
@@ -268,6 +269,7 @@ void ButtonEventsSimulator::Next()
268269
{
269270
EmitShortRelease(mEndpointId, mPressedButtonId);
270271
}
272+
SetButtonPosition(mEndpointId, mIdleButtonId);
271273
StartTimer(mMultiPressReleasedTimeMillis);
272274
break;
273275
}

examples/chef/common/chef-rvc-mode-delegate.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
154154
VerifyOrDie(!gRvcRunModeDelegate && !gRvcRunModeInstance);
155155

156156
gRvcRunModeDelegate = std::make_unique<RvcRunModeDelegate>();
157-
gRvcRunModeInstance = std::make_unique<ModeBase::Instance>(gRvcRunModeDelegate.get(), endpointId, RvcRunMode::Id,
158-
chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
157+
gRvcRunModeInstance =
158+
std::make_unique<ModeBase::Instance>(gRvcRunModeDelegate.get(), endpointId, RvcRunMode::Id, 0 /* No feature bits */);
159159
gRvcRunModeInstance->Init();
160160
}
161161

@@ -290,8 +290,8 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId)
290290
VerifyOrDie(!gRvcCleanModeDelegate && !gRvcCleanModeInstance);
291291

292292
gRvcCleanModeDelegate = std::make_unique<RvcCleanModeDelegate>();
293-
gRvcCleanModeInstance = std::make_unique<ModeBase::Instance>(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id,
294-
chip::to_underlying(RvcCleanMode::Feature::kNoFeatures));
293+
gRvcCleanModeInstance =
294+
std::make_unique<ModeBase::Instance>(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id, 0 /* No feature bits */);
295295
gRvcCleanModeInstance->Init();
296296
}
297297
#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER

examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
}
1818
],
1919
"package": [
20-
{
21-
"pathRelativity": "relativeToZap",
22-
"path": "../../../src/app/zap-templates/app-templates.json",
23-
"type": "gen-templates-json",
24-
"category": "matter",
25-
"version": "chip-v1"
26-
},
2720
{
2821
"pathRelativity": "relativeToZap",
2922
"path": "../../../src/app/zap-templates/zcl/zcl.json",
3023
"type": "zcl-properties",
3124
"category": "matter",
3225
"version": 1,
3326
"description": "Matter SDK ZCL data"
27+
},
28+
{
29+
"pathRelativity": "relativeToZap",
30+
"path": "../../../src/app/zap-templates/app-templates.json",
31+
"type": "gen-templates-json",
32+
"category": "matter",
33+
"version": "chip-v1"
3434
}
3535
],
3636
"endpointTypes": [

0 commit comments

Comments
 (0)