smartpanel : refactoring

Change-Id: Iea01dd8242270e1c080cd95030da4d211638d993
Tuleap: #1202
diff --git a/RingD.cpp b/RingD.cpp
index 3187639..2508fb8 100644
--- a/RingD.cpp
+++ b/RingD.cpp
@@ -67,7 +67,8 @@
     std::string accountId3(accountId2.begin(), accountId2.end());

 

     /* recipient */

-    auto contact = ContactsViewModel::instance->selectedContact;

+    auto item = SmartPanelItemsViewModel::instance->_selectedItem;

+    auto contact = item->_contact;

     auto toRingId = contact->ringID_;

     std::wstring toRingId2(toRingId->Begin());

     std::string toRingId3(toRingId2.begin(), toRingId2.end());

@@ -197,7 +198,7 @@
                     CoreDispatcherPriority::Normal, ref new DispatchedHandler([=]()

                 {

                     incomingCall(accountId2, callId2, from2);

-                    stateChange(callId2, "incoming call", 0);

+                    stateChange(callId2, CallStatus::INCOMING_RINGING, 0);

                 }));

             }),

             DRing::exportable_callback<DRing::CallSignal::StateChange>([this](

@@ -213,11 +214,13 @@
                 auto callId2 = toPlatformString(callId);

                 auto state2 = toPlatformString(state);

 

+                auto state3 = getCallStatus(state2);

+

 

                 CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(

                     CoreDispatcherPriority::Low, ref new DispatchedHandler([=]()

                 {

-                    stateChange(callId2, state2, code);

+                    stateChange(callId2, state3, code);

                 }));

             }),

             DRing::exportable_callback<DRing::ConfigurationSignal::IncomingAccountMessage>([&](

@@ -414,3 +417,23 @@
         tasksList_.pop();

     }

 }

+

+CallStatus RingClientUWP::RingD::getCallStatus(String^ state)

+{

+    if (state == "INCOMING")

+        return CallStatus::INCOMING_RINGING;

+

+    if (state == "CURRENT")

+        return CallStatus::IN_PROGRESS;

+

+    if (state == "OVER")

+        return CallStatus::ENDED;

+

+    if (state == "RINGING")

+        return CallStatus::OUTGOING_RINGING;

+

+    if (state == "CONNECTING")

+        return CallStatus::SEARCHING;

+

+    return CallStatus::NONE;

+}