Skip to content

Commit

Permalink
Merge branch 'master' into MdnsDiscovery-PythonTests
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-marquez-csa authored Feb 1, 2024
2 parents 0588087 + b202e54 commit fca19cd
Show file tree
Hide file tree
Showing 118 changed files with 5,806 additions and 784 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ GPL
GPLv
Gradle
gradlew
graphviz
Groupcast
GroupId
GroupKeyManagement
Expand Down
17 changes: 14 additions & 3 deletions examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
#include <app-common/zap-generated/attributes/Accessors.h>
#include <rvc-modes.h>
#include <rvc-operational-state-delegate-impl.h>

using namespace chip::app::Clusters;
using namespace chip::app::Clusters::RvcRunMode;
Expand All @@ -40,14 +41,24 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
{
uint8_t currentMode = mInstance->GetCurrentMode();

// Our business logic states that we can only switch into the mapping state from the idle state.
if (NewMode == RvcRunMode::ModeMapping && currentMode != RvcRunMode::ModeIdle)
// 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 the mapping mode is only allowed from idle"));
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
return;
}

auto rvcOpStateInstance = RvcOperationalState::GetRvcOperationalStateInstance();
if (NewMode == RvcRunMode::ModeIdle)
{
rvcOpStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped));
}
else
{
rvcOpStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning));
}

response.status = to_underlying(ModeBase::StatusCode::kSuccess);
}

Expand Down
Loading

0 comments on commit fca19cd

Please sign in to comment.