Skip to content

Commit

Permalink
Rvc op state delegate dummy start stop handlers (#31764)
Browse files Browse the repository at this point in the history
* Added dummy implementations of the start and stop handler methods to the RvcOperationalState::Delegate class.

* Removed the start and stop handler methods defined in the all-clusters-app RvcOperationalStateDelegate.

* Removed the start and stop handler methods defined in the rvc-app RvcOperationalStateDelegate.

* Restyled by clang-format

* Apply typo fixes from code review

Co-authored-by: Petru Lauric <[email protected]>

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Petru Lauric <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2024
1 parent 0f96b3a commit d7a7928
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ class RvcOperationalStateDelegate : public Delegate
*/
void HandleResumeStateCallback(OperationalState::GenericOperationalError & err) override;

/**
* Handle Command Callback in application: Start
* @param[out] get operational error after callback.
*/
void HandleStartStateCallback(OperationalState::GenericOperationalError & err) override;

/**
* Handle Command Callback in application: Stop
* @param[out] get operational error after callback.
*/
void HandleStopStateCallback(OperationalState::GenericOperationalError & err) override;

/**
* Handle the GoHome command.
* @param err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,6 @@ void RvcOperationalStateDelegate::HandleResumeStateCallback(OperationalState::Ge
}
}

void RvcOperationalStateDelegate::HandleStartStateCallback(OperationalState::GenericOperationalError & err)
{
// placeholder implementation
auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning));
if (error == CHIP_NO_ERROR)
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError));
}
else
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation));
}
}

void RvcOperationalStateDelegate::HandleStopStateCallback(OperationalState::GenericOperationalError & err)
{
// placeholder implementation
auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped));
if (error == CHIP_NO_ERROR)
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError));
}
else
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation));
}
}

void RvcOperationalStateDelegate::HandleGoHomeCommandCallback(OperationalState::GenericOperationalError & err)
{
// placeholder implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,6 @@ class RvcOperationalStateDelegate : public RvcOperationalState::Delegate
*/
void HandleResumeStateCallback(Clusters::OperationalState::GenericOperationalError & err) override;

/**
* Handle Command Callback in application: Start
* @param[out] get operational error after callback.
*/
void HandleStartStateCallback(Clusters::OperationalState::GenericOperationalError & err) override{
// This command in not supported.
};

/**
* Handle Command Callback in application: Stop
* @param[out] get operational error after callback.
*/
void HandleStopStateCallback(Clusters::OperationalState::GenericOperationalError & err) override{
// This command in not supported.
};

void SetPauseCallback(HandleOpStateCommand aCallback, RvcDevice * aInstance)
{
mPauseCallback = aCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,32 @@ namespace RvcOperationalState {
class Delegate : public OperationalState::Delegate
{
public:
/**
* Handle Command Callback in application: GoHome
* @param[out] err operational error after callback.
*/
virtual void HandleGoHomeCommandCallback(OperationalState::GenericOperationalError & err)
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnknownEnumValue));
};

/**
* The start command is not supported by the RvcOperationalState cluster hence this method should never be called.
* This is a dummy implementation of the handler method so the consumer of this class does not need to define it.
*/
void HandleStartStateCallback(OperationalState::GenericOperationalError & err) override
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnknownEnumValue));
};

/**
* The stop command is not supported by the RvcOperationalState cluster hence this method should never be called.
* This is a dummy implementation of the handler method so the consumer of this class does not need to define it.
*/
void HandleStopStateCallback(OperationalState::GenericOperationalError & err) override
{
err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnknownEnumValue));
};
};

class Instance : public OperationalState::Instance
Expand Down

0 comments on commit d7a7928

Please sign in to comment.