Added routing in incoming call.

This commit is contained in:
Robert Borzecki
2019-08-07 07:16:31 +02:00
parent 841bf4407a
commit fd3c4b8b15
3 changed files with 21 additions and 7 deletions

View File

@@ -75,7 +75,11 @@ sys::Message_t ApplicationCall::DataReceivedHandler(sys::DataMessage* msgl) {
}
else if( msg->type == CellularNotificationMessage::Type::IncomingCall ) {
LOG_INFO("---------------------------------IncomingCall");
if( callWindow->getState() == gui::CallWindow::State::INCOMING_CALL ) {
LOG_INFO("ignoring call incoming");
}
AudioServiceAPI::RoutingStart(this);
AudioServiceAPI::RoutingSpeakerPhone(this,true);
runCallTimer();
std::unique_ptr<gui::SwitchData> data = std::make_unique<app::IncommingCallData>(msg->data);
//send to itself message to switch (run) call application
@@ -83,7 +87,7 @@ sys::Message_t ApplicationCall::DataReceivedHandler(sys::DataMessage* msgl) {
switchWindow( "CallWindow",0, std::move(data) );
}
else {
callWindow->setState( gui::CallWindow::State::INCOMMING_CALL );
callWindow->setState( gui::CallWindow::State::INCOMING_CALL );
sapm::ApplicationManager::messageSwitchApplication( this, "ApplicationCall", "CallWindow", std::move(data) );
}
}

View File

@@ -162,6 +162,10 @@ void CallWindow::setState( State state ) {
setVisibleState();
}
const CallWindow::State& CallWindow::getState() {
return state;
}
void CallWindow::setVisibleState() {
rects[static_cast<uint32_t>(FocusRects::Speaker)]->setVisible(false);
@@ -171,7 +175,7 @@ void CallWindow::setVisibleState() {
//show state of the window
switch( state ) {
case State::INCOMMING_CALL: {
case State::INCOMING_CALL: {
titleLabel->setText("INCOMMING_CALL");
bottomBar->setActive(gui::BottomBar::Side::LEFT, true );
bottomBar->setActive(gui::BottomBar::Side::CENTER, true );
@@ -221,6 +225,10 @@ void CallWindow::setVisibleState() {
};
}
void CallWindow::setCallNumber( std::string ) {
}
void CallWindow::updateDuration( uint32_t duration ) {
uint32_t seconds = 0;
uint32_t minutes = 0;
@@ -252,7 +260,7 @@ bool CallWindow::handleSwitchData( SwitchData* data ) {
app::CallSwitchData* callData = reinterpret_cast<app::CallSwitchData*>(data);
if( callData->getType() == app::CallSwitchData::Type::INCOMMING_CALL ) {
app::IncommingCallData* incData = reinterpret_cast<app::IncommingCallData*>( data );
state = State::INCOMMING_CALL;
state = State::INCOMING_CALL;
numberLabel->setText( incData->getPhoneNumber());
}
setVisibleState();
@@ -268,7 +276,7 @@ void CallWindow::onBeforeShow( ShowMode mode, uint32_t command, SwitchData* data
}
bool CallWindow::handleLeftButton() {
if( state == State::INCOMMING_CALL ) {
if( state == State::INCOMING_CALL ) {
auto ret = CellularServiceAPI::AnswerIncomingCall(application);
LOG_INFO("AnswerIncomingCall: %s",(ret?"OK":"FAIL"));
@@ -286,7 +294,7 @@ bool CallWindow::handleLeftButton() {
return false;
}
bool CallWindow::handleCenterButton() {
if( state == State::INCOMMING_CALL ) {
if( state == State::INCOMING_CALL ) {
auto ret = CellularServiceAPI::HangupCall(application);
LOG_INFO("HangupCall: %s",(ret?"OK":"FAIL"));
//TODO switch to message templates window
@@ -304,7 +312,7 @@ bool CallWindow::handleCenterButton() {
return false;
}
bool CallWindow::handleRightButton() {
if( state == State::INCOMMING_CALL ) {
if( state == State::INCOMING_CALL ) {
auto ret = CellularServiceAPI::HangupCall(application);
LOG_INFO("HangupCall: %s",(ret?"OK":"FAIL"));

View File

@@ -22,7 +22,7 @@ class CallWindow: public AppWindow {
public:
enum class State {
IDLE,
INCOMMING_CALL,
INCOMING_CALL,
OUTGOING_CALL,
CALL_IN_PROGRESS,
CALL_ENDED
@@ -67,7 +67,9 @@ public:
* Used by application to update window's state
*/
void setState( State state );
const State& getState();
void updateDuration( uint32_t duration );
void setCallNumber( std::string );
//virtual methods
bool onInput( const InputEvent& inputEvent ) override;