merge wrt-plugins-tizen_0.2.0-3
[platform/framework/web/wrt-plugins-tizen.git] / src / platform / Tizen / Call / CallManager.cpp
index 0d5f77a..6666187 100755 (executable)
@@ -19,6 +19,7 @@
 #include <call.h>
 #include <dpl/log/log.h>
 #include <API/Account/AccountServices.h>
+#include <API/Call/CallDefine.h>
 #include "CallManager.h"
 
 using namespace WrtDeviceApis::Commons;
@@ -86,41 +87,50 @@ void CallManager::OnRequestReceived(const EventGetCallServicePtr& event)
                        ThrowMsg(UnsupportedException, "Not supported filter : providerId");
                }
 
-               std::string typeId(filter->getServiceTypeId());
+               std::string typeId(filter->getCallType());
                StringArrayPtr tags(filter->getTags());
 
-               if (typeId.compare("tizen.tel") != 0) {
-                       ThrowMsg(UnsupportedException, "Not supported value : serviceTypeId");
+               if (typeId.compare(STR_TIZEN_TEL) != 0
+                       && typeId.compare(STR_TIZEN_XMPP) != 0
+                       && typeId.compare(STR_TIZEN_SIP) != 0
+                       && typeId.compare("") != 0) {
+                       ThrowMsg(InvalidArgumentException, "Invalid value : ServiceTypeId");
                }
 
-               for (size_t cnt = 0; cnt < tags->size(); cnt++) {
-                       if (((*tags)[cnt]).compare("call") == 0
-                               ||((*tags)[cnt]).compare("call.voice") == 0
-                               || ((*tags)[cnt]).compare("call.video") == 0
-                               || ((*tags)[cnt]).compare("call.emergency") == 0)  {
-                               continue;
-                       } else {
-                               ThrowMsg(UnsupportedException, "Not supported value : tags");
+               size_t cnt = 0;
+               for (; cnt < tags->size(); cnt++) {
+                       if (((*tags)[cnt]).compare(STR_CALL) != 0
+                               &&((*tags)[cnt]).compare(STR_CALL_VOICE) != 0
+                               && ((*tags)[cnt]).compare(STR_CALL_VIDEO) != 0
+                               && ((*tags)[cnt]).compare(STR_CALL_EMERGENCY) != 0)  {
+                               ThrowMsg(InvalidArgumentException, "Invalid value : tags");
                        }
                }
 
                AccountServicesArrayPtr accountServicesList(new AccountServicesArray());
                AccountServicesPtr callServices(new AccountServices());
 
-               callServices->setServiceTypeId("tizen.tel");
+               if (typeId.compare(STR_TIZEN_XMPP) == 0
+                       || typeId.compare(STR_TIZEN_SIP) == 0) {
+                       event->setResult(accountServicesList);
+                       EventRequestReceiver<EventGetCallService>::ManualAnswer(event);
+               }
+
+               callServices->setServiceTypeId(STR_TIZEN_TEL);
                StringArrayPtr supportTags(new StringArray());
-               supportTags->push_back("call.voice");
-               supportTags->push_back("call.video");
-               supportTags->push_back("call.emergency");
+               supportTags->push_back(STR_CALL_VOICE);
+               supportTags->push_back(STR_CALL_VIDEO);
+               supportTags->push_back(STR_CALL_EMERGENCY);
                callServices->setTags(*supportTags);
+               callServices->setApplicationId(STR_TIZEN_DIALER);
 
                accountServicesList->push_back(callServices);
                event->setResult(accountServicesList);
 
                EventRequestReceiver<EventGetCallService>::ManualAnswer(event);
-       } catch (const UnsupportedException& ex) {
+       } catch (const InvalidArgumentException& ex) {
                LogError("Exception: " << ex.GetMessage());
-               event->setExceptionCode(ExceptionCodes::UnsupportedException);
+               event->setExceptionCode(ExceptionCodes::InvalidArgumentException);
                EventRequestReceiver<EventGetCallService>::ManualAnswer(event);
        } catch (const PlatformException& ex) {
                LogError("Exception: " << ex.GetMessage());