Skip to content

Commit

Permalink
Used a more correct error code in the RVC example app (project-chip#2…
Browse files Browse the repository at this point in the history
…9864)

* Replaced the use of kGenericFaliure with the more correct kInvalidInMode status code in the RVC example app.

* Added missing periods to strings
  • Loading branch information
hicklin authored and shripad621git committed Oct 31, 2023
1 parent 646b5b2 commit cc1390b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/rvc-app/rvc-common/src/rvc-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ void RvcDevice::HandleRvcRunChangeToMode(uint8_t newMode, ModeBase::Commands::Ch
// We could be in the charging state with an RvcRun mode != idle.
if (currentMode != RvcRunMode::ModeIdle && newMode != RvcRunMode::ModeIdle)
{
response.status = to_underlying(ModeBase::StatusCode::kGenericFailure);
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(
chip::CharSpan::fromCharString("Change to the mapping or cleaning mode is only allowed from idle"));
chip::CharSpan::fromCharString("Change to the mapping or cleaning mode is only allowed from idle."));
return;
}

Expand All @@ -56,9 +56,9 @@ void RvcDevice::HandleRvcRunChangeToMode(uint8_t newMode, ModeBase::Commands::Ch
case to_underlying(OperationalState::OperationalStateEnum::kRunning): {
if (newMode != RvcRunMode::ModeIdle)
{
response.status = to_underlying(ModeBase::StatusCode::kGenericFailure);
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(
chip::CharSpan::fromCharString("Change to the mapping or cleaning mode is only allowed from idle"));
chip::CharSpan::fromCharString("Change to the mapping or cleaning mode is only allowed from idle."));
return;
}

Expand All @@ -71,8 +71,8 @@ void RvcDevice::HandleRvcRunChangeToMode(uint8_t newMode, ModeBase::Commands::Ch
}

// If we fall through at any point, it's because the change is not supported in the current state.
response.status = to_underlying(ModeBase::StatusCode::kGenericFailure);
response.statusText.SetValue(chip::CharSpan::fromCharString("This change is not allowed at this time. "));
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(chip::CharSpan::fromCharString("This change is not allowed at this time."));
}

void RvcDevice::HandleRvcCleanChangeToMode(uint8_t newMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
Expand Down

0 comments on commit cc1390b

Please sign in to comment.