Commit 2d0ce574 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Stepan Salenikovich

call: add missing cases to Call::validStateTransition

MERROR was not permitted but it should always be the case.

Issue: #78119
Change-Id: I6591a0bda43ed81887cdfb6e546fa8108a01f725
parent 34789352
......@@ -93,33 +93,47 @@ Call::getState() const
bool
Call::validStateTransition(CallState newState)
{
// Notice to developper:
// - list only permitted transition (return true)
// - let non permitted ones as default case (return false)
switch (callState_) {
case CallState::INACTIVE:
switch (newState) {
case CallState::INACTIVE:
case CallState::HOLD:
return false;
default:
case CallState::ACTIVE:
case CallState::BUSY:
case CallState::MERROR:
return true;
default: // INACTIVE, HOLD
return false;
}
case CallState::ACTIVE:
switch (newState) {
case CallState::HOLD:
case CallState::MERROR:
return true;
default:
default: // INACTIVE, ACTIVE, BUSY
return false;
}
case CallState::HOLD:
switch (newState) {
case CallState::ACTIVE:
case CallState::MERROR:
return true;
default:
default: // INACTIVE, HOLD, BUSY, MERROR
return false;
}
default:
case CallState::BUSY:
switch (newState) {
case CallState::MERROR:
return true;
default: // INACTIVE, ACTIVE, HOLD, BUSY
return false;
}
default: // MERROR
return false;
}
}
......
......@@ -77,6 +77,8 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
*
* Audio should be transmitted when ConnectionState = Connected AND
* CallState = Active.
*
* \note modify validStateTransition/getStateStr if this enum changes
*/
enum class ConnectionState : unsigned {
DISCONNECTED, TRYING, PROGRESSING, RINGING, CONNECTED, COUNT__
......@@ -84,6 +86,8 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
/**
* The Call State.
*
* \note modify validStateTransition/getStateStr if this enum changes
*/
enum class CallState : unsigned {
INACTIVE, ACTIVE, HOLD, BUSY, MERROR, COUNT__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment