Skip to content

Commit

Permalink
Merge branch 'project-chip:master' into tc_occ_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehs6sam authored Aug 29, 2024
2 parents 1f6af45 + 6c6b11f commit a6028ec
Show file tree
Hide file tree
Showing 68 changed files with 957 additions and 487 deletions.
10 changes: 10 additions & 0 deletions docs/testing/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,19 @@ markers must be present.

- `test-runner-run/<run_identifier>/script-args`: Specifies the arguments to
be passed to the test script.

- Example:
`--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`

- `test-runner-run/<run_identifier>/script-start-delay`: Specifies the number
of seconds to wait before starting the test script. This parameter can be
used to allow the application to initialize itself properly before the test
script will try to commission it (e.g. in case if the application needs to
be commissioned to some other controller first). By default, the delay is 0
seconds.

- Example: `10`

This structured format ensures that all necessary configurations are clearly
defined and easily understood, allowing for consistent and reliable test
execution.
Original file line number Diff line number Diff line change
Expand Up @@ -3235,7 +3235,7 @@ cluster LaundryWasherControls = 83 {

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

enum ModeTag : enum16 {
kIdle = 16384;
Expand All @@ -3255,7 +3255,7 @@ cluster RvcRunMode = 84 {
}

bitmap Feature : bitmap32 {
kNoFeatures = 0x0;
kDirectModeChange = 0x10000;
}

struct ModeTagStruct {
Expand Down Expand Up @@ -3294,7 +3294,7 @@ cluster RvcRunMode = 84 {

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

enum ModeTag : enum16 {
kDeepClean = 16384;
Expand All @@ -3307,7 +3307,7 @@ cluster RvcCleanMode = 85 {
}

bitmap Feature : bitmap32 {
kNoFeatures = 0x0;
kDirectModeChange = 0x10000;
}

struct ModeTagStruct {
Expand Down Expand Up @@ -8489,7 +8489,7 @@ endpoint 1 {
callback attribute eventList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 2;
ram attribute clusterRevision default = 3;

handle command ChangeToMode;
handle command ChangeToModeResponse;
Expand All @@ -8503,7 +8503,7 @@ endpoint 1 {
callback attribute eventList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 2;
ram attribute clusterRevision default = 3;

handle command ChangeToMode;
handle command ChangeToModeResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9648,7 +9648,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"defaultValue": "3",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -9804,7 +9804,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"defaultValue": "3",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
39 changes: 23 additions & 16 deletions examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* limitations under the License.
*/
#include <app-common/zap-generated/attributes/Accessors.h>
#include <lib/support/TypeTraits.h>
#include <rvc-modes.h>
#include <rvc-operational-state-delegate-impl.h>

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

// Our business logic states that we can only switch into a running mode from the idle state.
if (NewMode != RvcRunMode::ModeIdle && currentMode != RvcRunMode::ModeIdle)
if (!gRvcRunModeInstance->HasFeature(static_cast<ModeBase::Feature>(RvcRunMode::Feature::kDirectModeChange)))
{
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
return;
// Our business logic states that we can only switch into a running mode from the idle state.
if (NewMode != RvcRunMode::ModeIdle && currentMode != RvcRunMode::ModeIdle)
{
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
return;
}
}

auto rvcOpStateInstance = RvcOperationalState::GetRvcOperationalStateInstance();
Expand Down Expand Up @@ -123,8 +127,8 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr);
gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate;
gRvcRunModeInstance =
new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
gRvcRunModeInstance = new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id,
chip::to_underlying(RvcRunMode::Feature::kDirectModeChange));
gRvcRunModeInstance->Init();
}

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

void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
{
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();

if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
if (!gRvcCleanModeInstance->HasFeature(static_cast<ModeBase::Feature>(RvcCleanMode::Feature::kDirectModeChange)))
{
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
return;
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();

if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
{
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
return;
}
}

response.status = to_underlying(ModeBase::StatusCode::kSuccess);
Expand Down Expand Up @@ -213,7 +220,7 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId)
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr);
gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate;
gRvcCleanModeInstance =
new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
gRvcCleanModeInstance = new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id,
chip::to_underlying(RvcCleanMode::Feature::kDirectModeChange));
gRvcCleanModeInstance->Init();
}
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/ButtonEventsSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ void ButtonEventsSimulator::Next()
break;
}
case ButtonEventsSimulator::State::kEmitStartOfMultiPress: {
SetButtonPosition(mEndpointId, mPressedButtonId);
EmitInitialPress(mEndpointId, mPressedButtonId);
if (mFeatureMap & static_cast<uint32_t>(Clusters::Switch::Feature::kActionSwitch))
{
Expand Down Expand Up @@ -268,6 +269,7 @@ void ButtonEventsSimulator::Next()
{
EmitShortRelease(mEndpointId, mPressedButtonId);
}
SetButtonPosition(mEndpointId, mIdleButtonId);
StartTimer(mMultiPressReleasedTimeMillis);
break;
}
Expand Down
8 changes: 4 additions & 4 deletions examples/chef/common/chef-rvc-mode-delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
VerifyOrDie(!gRvcRunModeDelegate && !gRvcRunModeInstance);

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

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

gRvcCleanModeDelegate = std::make_unique<RvcCleanModeDelegate>();
gRvcCleanModeInstance = std::make_unique<ModeBase::Instance>(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id,
chip::to_underlying(RvcCleanMode::Feature::kNoFeatures));
gRvcCleanModeInstance =
std::make_unique<ModeBase::Instance>(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id, 0 /* No feature bits */);
gRvcCleanModeInstance->Init();
}
#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
}
],
"package": [
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/app-templates.json",
"type": "gen-templates-json",
"category": "matter",
"version": "chip-v1"
},
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/zcl/zcl.json",
"type": "zcl-properties",
"category": "matter",
"version": 1,
"description": "Matter SDK ZCL data"
},
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/app-templates.json",
"type": "gen-templates-json",
"category": "matter",
"version": "chip-v1"
}
],
"endpointTypes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ cluster GroupKeyManagement = 63 {

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

enum ModeTag : enum16 {
kIdle = 16384;
Expand All @@ -1604,7 +1604,7 @@ cluster RvcRunMode = 84 {
}

bitmap Feature : bitmap32 {
kNoFeatures = 0x0;
kDirectModeChange = 0x10000;
}

struct ModeTagStruct {
Expand Down Expand Up @@ -1643,7 +1643,7 @@ cluster RvcRunMode = 84 {

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

enum ModeTag : enum16 {
kDeepClean = 16384;
Expand All @@ -1656,7 +1656,7 @@ cluster RvcCleanMode = 85 {
}

bitmap Feature : bitmap32 {
kNoFeatures = 0x0;
kDirectModeChange = 0x10000;
}

struct ModeTagStruct {
Expand Down Expand Up @@ -2010,7 +2010,7 @@ endpoint 1 {
callback attribute eventList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 2;
ram attribute clusterRevision default = 3;

handle command ChangeToMode;
handle command ChangeToModeResponse;
Expand All @@ -2024,7 +2024,7 @@ endpoint 1 {
callback attribute eventList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 2;
ram attribute clusterRevision default = 3;

handle command ChangeToMode;
handle command ChangeToModeResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"defaultValue": "3",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -3008,7 +3008,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"defaultValue": "3",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#if defined(PW_RPC_ENABLED)
#include <rpc/RpcClient.h>
#include <rpc/RpcServer.h>
#endif

using namespace chip;
Expand Down Expand Up @@ -116,7 +117,7 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category,
#if defined(PW_RPC_ENABLED)
void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState)
{
if (InitRpcClient(kFabricBridgeServerPort) == CHIP_NO_ERROR)
if (StartRpcClient() == CHIP_NO_ERROR)
{
ChipLogProgress(NotSpecified, "Connected to Fabric-Bridge");
}
Expand Down Expand Up @@ -196,6 +197,9 @@ CHIP_ERROR InteractiveStartCommand::RunCommand()
}

#if defined(PW_RPC_ENABLED)
SetRpcRemoteServerPort(mFabricBridgeServerPort.Value());
InitRpcServer(mLocalServerPort.Value());
ChipLogProgress(NotSpecified, "PW_RPC initialized.");
DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0);
#endif

Expand Down
16 changes: 15 additions & 1 deletion examples/fabric-admin/commands/interactive/InteractiveCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

#include <string>

constexpr uint16_t kFabricBridgeServerPort = 33002;
constexpr uint16_t kFabricLocalServerPort = 33001;

class Commands;

class InteractiveCommand : public CHIPCommand
Expand Down Expand Up @@ -55,14 +58,25 @@ class InteractiveStartCommand : public InteractiveCommand
InteractiveStartCommand(Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) :
InteractiveCommand("start", commandsHandler, "Start an interactive shell that can then run other commands.",
credsIssuerConfig)
{}
{
#if defined(PW_RPC_ENABLED)
AddArgument("fabric-bridge-server-port", 0, UINT16_MAX, &mFabricBridgeServerPort,
"The fabric-bridge RPC port number to connect to.");
AddArgument("local-server-port", 0, UINT16_MAX, &mLocalServerPort, "The port number for local RPC server.");
#endif
}

/////////// CHIPCommand Interface /////////
CHIP_ERROR RunCommand() override;

private:
char * GetCommand(char * command);
std::string GetHistoryFilePath() const;

#if defined(PW_RPC_ENABLED)
chip::Optional<uint16_t> mFabricBridgeServerPort{ kFabricBridgeServerPort };
chip::Optional<uint16_t> mLocalServerPort{ kFabricLocalServerPort };
#endif
};

void PushCommand(const std::string & command);
9 changes: 0 additions & 9 deletions examples/fabric-admin/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,10 @@
#include <string>
#include <vector>

#if defined(PW_RPC_ENABLED)
#include <rpc/RpcServer.h>
#endif

using namespace chip;

void ApplicationInit()
{
#if defined(PW_RPC_ENABLED)
InitRpcServer(kFabricAdminServerPort);
ChipLogProgress(NotSpecified, "PW_RPC initialized.");
#endif

DeviceMgr().Init();
}

Expand Down
Loading

0 comments on commit a6028ec

Please sign in to comment.