TizenRefApp-8350 [Call UI] Implement Call initialization logic 26/123926/4
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 7 Apr 2017 07:00:32 +0000 (10:00 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Tue, 11 Apr 2017 11:03:02 +0000 (14:03 +0300)
Change-Id: I97b7846718862e10b3e1a6b0f151a60ef547dc75

26 files changed:
inc/main/Instance.h
inc/model/Call.h
inc/model/ICallDialer.h [deleted file]
inc/model/ICallManager.h
inc/model/ICallManagerListener.h [new file with mode: 0644]
inc/model/types.h
src/main/Instance.cpp
src/model/ActiveCall.cpp
src/model/ActiveCall.h
src/model/BaseCall.cpp [deleted file]
src/model/BaseCall.h [deleted file]
src/model/Call.cpp
src/model/CallDialer.cpp [deleted file]
src/model/CallDialer.h [deleted file]
src/model/CallManager.cpp
src/model/CallManager.h
src/model/EndCall.cpp
src/model/EndCall.h
src/model/HeldCall.cpp
src/model/HeldCall.h
src/model/IncomingCall.cpp
src/model/IncomingCall.h
src/model/helpers.h
src/model/helpers.hpp
src/model/implTypes.h
tizen-manifest.xml

index 6bfbfc362e8d1b17c984d5a6103f93467f5c970a..5302e33f51cb9585b42a4dac12efba13631f1395 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "ucl/appfw/SysEventProvider.h"
 
-
 #include "model/Call.h"
 
 namespace callui {
@@ -35,6 +34,11 @@ namespace callui {
        public:
                Instance(ucl::SysEventProvider &sysEventProvider);
 
+               // For testing
+               ucl::WindowWRef getWindow();
+               ucl::IInstanceContext *getContext();
+               CallWRef getCall();
+
                // IInstance //
 
                virtual ucl::Result onCreate(
@@ -54,7 +58,6 @@ namespace callui {
                ucl::SysEventProvider &m_sysEventProvider;
                ucl::IInstanceContext *m_context;
                ucl::WindowSRef m_win;
-
                CallSRef m_call;
        };
 }
index 15183cf38cac6d16444a6692439c5b50c2d9f592..5acb364056c7c1ce88e1cb582139ee734adf2b77 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef __CALLUI_MODEL_CALL_H__
 #define __CALLUI_MODEL_CALL_H__
 
+#include <app_control.h>
+
 #include "types.h"
 
 namespace callui {
@@ -26,9 +28,19 @@ namespace callui {
 
        class Call final : public ucl::NonCopyable {
        public:
-               static CallSRef newInstance();
+               class Builder {
+               public:
+                       Builder();
+                       Builder &setListener(ICallManagerListenerWRef value);
+                       CallSRef build() const;
+               private:
+                       ICallManagerListenerWRef m_listener;
+               };
+
+       public:
                virtual ~Call();
 
+               ucl::Result processAppControl(app_control_h appControl);
                ISoundManagerSRef getSoundManager();
                ICallManagerSRef getCallManager();
 
@@ -36,7 +48,7 @@ namespace callui {
                friend class ucl::RefCountObj<Call>;
                Call();
 
-               ucl::Result prepare();
+               ucl::Result prepare(ICallManagerListenerWRef listener);
 
        private:
                CallManagerSRef m_callManager;
diff --git a/inc/model/ICallDialer.h b/inc/model/ICallDialer.h
deleted file mode 100644 (file)
index c9193d0..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CALLUI_MODEL_I_CALL_DIALER_H__
-#define __CALLUI_MODEL_I_CALL_DIALER_H__
-
-#include "types.h"
-
-namespace callui {
-
-       class ICallDialer: public ucl::Polymorphic {
-       public:
-               virtual ucl::Result dialVoiceCall(const std::string &number, SimSlot simSlot) = 0;
-               virtual void addDialStatusHandler(DialStatusHandler handler) = 0;
-               virtual void removeDialStatusHandler(DialStatusHandler handler) = 0;
-       };
-}
-
-#endif // __CALLUI_MODEL_I_CALL_DIALER_H__
index 8442cfd9a0ad1f3ba34e7cb325684922c2cb8935..92bcbe86f18e60f5eaa792c267b152d49a66af82 100644 (file)
@@ -23,13 +23,10 @@ namespace callui {
 
        class ICallManager : public ucl::Polymorphic {
        public:
-               virtual ICallDialerWRef getDialer() = 0;
                virtual IIncomingCallWRef getIncomingCall() = 0;
                virtual IActiveCallWRef getActiveCall() = 0;
                virtual IHeldCallWRef getHeldCall() = 0;
                virtual IEndCallWRef getEndCall() = 0;
-               virtual void addCallStateHandler(CallStateHandler handler) = 0;
-               virtual void removeCallStateHandler(CallStateHandler handler) = 0;
        };
 }
 
diff --git a/inc/model/ICallManagerListener.h b/inc/model/ICallManagerListener.h
new file mode 100644 (file)
index 0000000..f3433ad
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
+#define __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
+
+#include "types.h"
+
+namespace callui {
+
+       class ICallManagerListener : public ucl::Polymorphic {
+       public:
+               virtual void onCallEvent(CallEventType type) = 0;
+               virtual void onError(CallManagerErr err) = 0;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
index a5a1ff2bba50c3209ea41e7a2123fb6cf1cb1640..2b86f22f8a2cd540f7714f34791d0fc9852468c6 100644 (file)
 namespace callui {
 
        enum class SimSlot {
+               UNDEFINED,
                FIRST,
                SECOND,
                DEFAULT
        };
 
+       enum class CallManagerErr {
+               NONE,
+               DIAL_CANCEL,
+               DIAL_FAIL,
+               DIAL_FAIL_SS,
+               DIAL_FAIL_FDN,
+               DIAL_FLIGHT_MODE
+       };
+
        enum class CallAnswerType {
                NORMAL,
                HOLD_ACTIVE_AND_ACCEPT,
@@ -37,15 +47,6 @@ namespace callui {
                RELEASE_ALL_AND_ACCEPT
        };
 
-       enum class DialStatus {
-               SUCCESS,
-               CANCEL,
-               FAIL,
-               FAIL_SS,
-               FAIL_FDN,
-               FLIGHT_MODE
-       };
-
        enum class AudioStateType {
                NONE,
                SPEAKER,
@@ -90,7 +91,8 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(ICallManager);
        UCL_DECLARE_REF_ALIASES(ISoundManager);
-       UCL_DECLARE_REF_ALIASES(ICallDialer);
+
+       UCL_DECLARE_REF_ALIASES(ICallManagerListener);
 
        UCL_DECLARE_REF_ALIASES(IIncomingCall);
        UCL_DECLARE_REF_ALIASES(IActiveCall);
@@ -104,10 +106,6 @@ namespace callui {
        UCL_DECLARE_REF_ALIASES(IRejectMsgProvider);
        UCL_DECLARE_REF_ALIASES(IRejectMsg);
 
-       using CallStateHandler = ucl::Delegate<void(CallEventType)>;
-
-       using DialStatusHandler = ucl::Delegate<void(DialStatus)>;
-
        using AudioStateHandler = ucl::Delegate<void(AudioStateType)>;
        using MuteStateHandler = ucl::Delegate<void(bool)>;
 
index cdb0278e80c2316d19e5c86d937f5c517741e1b7..e2fbeff9332e721acdbf503aa378bf73f8d4c0c8 100644 (file)
 
 #include "main/Instance.h"
 
+#include "ucl/util/memory.h"
+
 #include <system_settings.h>
 #include <efl_extension.h>
 
 #include "../common.h"
 
+#include "model/ICallManager.h"
+#include "model/ICallManagerListener.h"
+#include "model/IIncomingCall.h"
+#include "model/IActiveCall.h"
+#include "model/IHeldCall.h"
+#include "model/IEndCall.h"
+#include "model/ICallInfo.h"
+
 namespace callui {
 
        using namespace ucl;
 
+       // For testing
+       UCL_DECLARE_REF_ALIASES(Listener);
+       class Listener : public ICallManagerListener {
+       public:
+               static ListenerSRef newInstance(Instance &instance)
+               {
+                       return makeShared<Listener>(instance);
+               }
+               virtual void onCallEvent(CallEventType type) override final
+               {
+                       WindowWRef win = m_instance.getWindow();
+                       CallWRef call = m_instance.getCall();
+                       ICallManagerSRef callMng = {};
+                       if (call) {
+                               callMng = call->getCallManager();
+                       }
+
+                       if (win && !win->isVisible()) {
+                               show(*win);
+                       }
+
+                       IIncomingCallWRef incom = callMng->getIncomingCall();
+                       IActiveCallWRef active = callMng->getActiveCall();
+                       IHeldCallWRef held = callMng->getHeldCall();
+                       IEndCallWRef end = callMng->getEndCall();
+
+                       ILOG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+                       if (incom) {
+                               ILOG("Incoming call available");
+                               logCallInfo(incom->getInfo());
+                       } else {
+                               ILOG("No incoming call");
+                       }
+
+                       if (active) {
+                               ILOG("Active call available");
+                               logCallInfo(active->getInfo());
+                       } else {
+                               ILOG("No active call");
+                       }
+
+                       if (held) {
+                               ILOG("Held call available");
+                               logCallInfo(held->getInfo());
+                       } else {
+                               ILOG("No held call");
+                       }
+
+                       if (end) {
+                               ILOG("End call available");
+                               logCallInfo(end->getInfo());
+                       } else {
+                               ILOG("No end call");
+                       }
+                       ILOG("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
+
+                       if (type == CallEventType::END) {
+                               if (!callMng->getIncomingCall()
+                                               && !callMng->getActiveCall()
+                                               && !callMng->getHeldCall()) {
+                                       IInstanceContext *ctx = m_instance.getContext();
+                                       if (ctx) {
+                                               ctx->exitApp();
+                                       }
+                               }
+                       }
+               }
+
+               virtual void onError(CallManagerErr err) override final
+               {
+                       ILOG();
+               }
+
+       private:
+               void logCallInfo(ICallInfoSCRef info)
+               {
+                       ILOG("* call id [%d]", info->getCallId());
+                       ILOG("* phone number [%s]", info->getPhoneNumber().c_str());
+                       ILOG("* conference member count [%d]", info->getConferenceMemberCount());
+               }
+
+       private:
+               friend class ucl::RefCountObj<Listener>;
+               Listener(Instance &instance):
+                       m_instance(instance)
+               {
+                       ILOG();
+               }
+       private:
+               Instance &m_instance;
+       };
+
        Instance::Instance(SysEventProvider &sysEventProvider) :
                m_sysEventProvider(sysEventProvider),
                m_context(nullptr)
@@ -43,7 +145,15 @@ namespace callui {
                eext_object_event_callback_add(*m_win, EEXT_CALLBACK_BACK,
                                CALLBACK_A(Instance::onBack), this);
 
-               m_call = Call::newInstance();
+               // For testing
+               static ListenerSRef listener = Listener::newInstance(*this);
+               m_call = Call::Builder().
+                               setListener(listener).
+                               build();
+
+               if (!m_call) {
+                       LOG_RETURN(RES_FAIL, "m_call is NULL");
+               }
 
                return RES_OK;
        }
@@ -65,8 +175,18 @@ namespace callui {
                ILOG("operation: %s", op);
                free(op);
 
-               if (!m_win->isVisible()) {
-                       show(*m_win);
+               // For testing
+               Result res = m_call->processAppControl(appControl);
+               if (res != RES_OK) {
+                       ELOG("processAppControl() failed!");
+                       ICallManagerSRef callManager = m_call->getCallManager();
+                       if (!callManager->getIncomingCall()
+                                       && !callManager->getActiveCall()
+                                       && !callManager->getHeldCall()
+                                       && !callManager->getEndCall()) {
+                               ILOG("No calls. Exit application");
+                               m_context->exitApp();
+                       }
                }
        }
 
@@ -94,4 +214,19 @@ namespace callui {
                        break;
                }
        }
+
+       WindowWRef Instance::getWindow()
+       {
+               return m_win;
+       }
+
+       IInstanceContext *Instance::getContext()
+       {
+               return m_context;
+       }
+
+       CallWRef Instance::getCall()
+       {
+               return m_call;
+       }
 }
index e238abd69c0ccf7ab3ba204da05259eeed6cd261..8bbc9a43e6371e2c482cc01b6e45502d2b39739e 100644 (file)
@@ -29,7 +29,6 @@ namespace callui {
        using namespace ucl;
 
        ActiveCall::ActiveCall(CallManager &cm, cm_call_data_h callData):
-                       BaseCall(callData),
                        m_cm(cm),
                        m_isDialing(false)
        {
@@ -46,20 +45,20 @@ namespace callui {
                }
 
                auto result = makeShared<ActiveCall>(cm, callData);
-               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
                return result;
        }
 
-       Result ActiveCall::prepare()
+       Result ActiveCall::prepare(cm_call_data_h callData)
        {
-               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), m_callData);
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
                if (!m_callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
                }
 
                cm_call_state_e callState = CM_CALL_STATE_IDLE;
                FAIL_RETURN(convertCMResult(
-                               cm_call_data_get_call_state(m_callData, &callState)),
+                               cm_call_data_get_call_state(callData, &callState)),
                                "cm_call_data_get_call_state() failed!");
                m_isDialing = (callState == CM_CALL_STATE_DIALING);
 
index 7a60d093c6aa95097b2986af346b17bf3442297c..d85464c192fca2af4fce231b582ddc2f507b9046 100644 (file)
 
 #include <call-manager-ext.h>
 
-#include "BaseCall.h"
 #include "model/IActiveCall.h"
 
 #include "implTypes.h"
 
 namespace callui {
 
-       class ActiveCall final :
-               public BaseCall,
-               public IActiveCall {
+       class ActiveCall final : public IActiveCall {
        public:
                static ActiveCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
                virtual ~ActiveCall();
@@ -45,7 +42,7 @@ namespace callui {
                friend class ucl::RefCountObj<ActiveCall>;
                ActiveCall(CallManager &cm, cm_call_data_h callData);
 
-               ucl::Result prepare();
+               ucl::Result prepare(cm_call_data_h callData);
 
        private:
                CallManager &m_cm;
diff --git a/src/model/BaseCall.cpp b/src/model/BaseCall.cpp
deleted file mode 100644 (file)
index ece1fbb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BaseCall.h"
-
-namespace callui {
-
-       BaseCall::BaseCall(cm_call_data_h callData):
-                       m_callData(callData)
-       {
-       }
-
-       BaseCall::~BaseCall()
-       {
-       }
-
-       cm_call_data_h BaseCall::getCallData()
-       {
-               return m_callData;
-       }
-
-}
diff --git a/src/model/BaseCall.h b/src/model/BaseCall.h
deleted file mode 100644 (file)
index 85c612b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CALLUI_MODEL_BASE_CALL_H__
-#define __CALLUI_MODEL_BASE_CALL_H__
-
-#include <call-manager-ext.h>
-
-namespace callui {
-
-       class BaseCall {
-       public:
-               BaseCall(cm_call_data_h callData);
-               virtual ~BaseCall();
-
-               cm_call_data_h getCallData();
-       protected:
-               cm_call_data_h m_callData;
-       };
-
-}
-
-#endif // __CALLUI_MODEL_BASE_CALL_H__
index 0c4b7166be14bd5cbd135af9386d8310b4fd4e58..327fefa841669bbb42645738d201c3b1c19d8daa 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "model/Call.h"
 
+#include <app_control.h>
+
 #include "CallClient.h"
 #include "CallManager.h"
 #include "SoundManager.h"
@@ -26,29 +28,110 @@ namespace callui {
 
        using namespace ucl;
 
-       Call::Call()
+       Call::Builder::Builder():
+                       m_listener(nullptr)
        {
        }
 
-       Call::~Call()
+       Call::Builder &Call::Builder::setListener(ICallManagerListenerWRef value)
        {
+               m_listener = value;
+               return *this;
        }
 
-       CallSRef Call::newInstance()
+       CallSRef Call::Builder::build() const
        {
                auto result = makeShared<Call>();
-               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               FAIL_RETURN_VALUE(result->prepare(m_listener), {}, "result->prepare() failed!");
                return result;
        }
 
-       Result Call::prepare()
+       Call::Call()
+       {
+       }
+
+       Call::~Call()
+       {
+       }
+
+       Result Call::processAppControl(app_control_h appControl)
+       {
+               if (!appControl) {
+                       FAIL_RETURN(RES_INVALID_ARGUMENTS, "appControl is NULL");
+               }
+
+               Result ret = RES_FAIL;
+
+               char *operation = nullptr;
+               int res = app_control_get_operation(appControl, &operation);
+               if (res != APP_CONTROL_ERROR_NONE) {
+                       LOG_RETURN(RES_FAIL, "app_control_get_operation() failed!");
+               }
+               if (!operation) {
+                       LOG_RETURN(RES_FAIL, "operation is NULL!");
+               }
+
+               char *uri = nullptr;
+               res = app_control_get_uri(appControl, &uri);
+               if (res != APP_CONTROL_ERROR_NONE) {
+                       free(operation);
+                       LOG_RETURN(RES_FAIL, "app_control_get_uri() failed!");
+               }
+               if (!uri) {
+                       free(operation);
+                       LOG_RETURN(RES_FAIL, "uri is NULL!");
+               }
+
+               if (strcmp(operation, APP_CONTROL_OPERATION_CALL) || strncmp(uri, "tel:", 4)) {
+                       free(operation);
+                       free(uri);
+                       LOG_RETURN(RES_FAIL, "Not processed operation!");
+               }
+
+               char *tmp = nullptr;
+               if (!strncmp(uri, "tel:MT", 6)) {
+                       res = app_control_get_extra_data(appControl, "sim_slot", &tmp);
+                       if (res != APP_CONTROL_ERROR_NONE) {
+                               ELOG("app_control_get_extra_data() failed!");
+                       }
+                       if (!tmp) {
+                               free(operation);
+                               free(uri);
+                               LOG_RETURN(RES_FAIL, "Sim slot is NULL!");
+                       }
+                       DLOG("Sim slot [%s]", tmp);
+                       free(tmp);
+
+                       ret = m_callManager->processIncomingCall(
+                                       convertCMSimSlot(static_cast<cm_multi_sim_slot_type_e>(atoi(tmp))));
+
+               } else {
+                       tmp = static_cast<char *>(uri + 4);
+                       DLOG("number [%s]", tmp);
+
+                       if (!tmp) {
+                               free(operation);
+                               free(uri);
+                               LOG_RETURN(RES_FAIL, "number is NULL");
+                       }
+
+                       ret = m_callManager->processOutgoingCall(tmp);
+               }
+
+               free(operation);
+               free(uri);
+
+               return ret;
+       }
+
+       Result Call::prepare(ICallManagerListenerWRef listener)
        {
                CallClientSRef callClient = CallClient::newInstance();
                if (!callClient) {
                        LOG_RETURN(RES_FAIL, "Client::newInstance() failed!");
                }
 
-               m_callManager = CallManager::newInstance(callClient);
+               m_callManager = CallManager::newInstance(callClient, listener);
                if (!m_callManager) {
                        LOG_RETURN(RES_FAIL, "CallManager::newInstance() failed!");
                }
diff --git a/src/model/CallDialer.cpp b/src/model/CallDialer.cpp
deleted file mode 100644 (file)
index 4bfef71..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "CallDialer.h"
-
-#include "CallManager.h"
-#include "CallClient.h"
-
-#include "common.h"
-
-namespace callui {
-
-       using namespace ucl;
-
-       CallDialer::CallDialer(CallManager &cm):
-               m_cm(cm)
-       {
-       }
-
-       CallDialer::~CallDialer()
-       {
-               cm_unset_dial_status_cb(*(m_cm.getCallClient()));
-       }
-
-       CallDialerSRef CallDialer::newInstance(CallManager &cm)
-       {
-               auto result = makeShared<CallDialer>(cm);
-               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
-               return result;
-       }
-
-       void CallDialer::DialStatusChangedCb(cm_dial_status_e status)
-       {
-               m_event.invoke(convertCMDialStatus(status));
-       }
-
-       Result CallDialer::prepare()
-       {
-               return convertCMResult(
-                               cm_set_dial_status_cb(*(m_cm.getCallClient()),
-                                               CALLBACK_B(CallDialer::DialStatusChangedCb), this));
-       }
-
-       Result CallDialer::dialVoiceCall(const std::string &number, SimSlot simSlot)
-       {
-               char buff[TEL_NUMBER_MAX_SIZE] = { 0 };
-               snprintf(buff, sizeof(buff), "%s", number.c_str());
-
-               return convertCMResult(
-                               cm_dial_call(*(m_cm.getCallClient()),
-                                               buff, CM_CALL_TYPE_VOICE, convertCUISimSlot(simSlot)));
-       }
-
-       void CallDialer::addDialStatusHandler(DialStatusHandler handler)
-       {
-               m_event += handler;
-       }
-
-       void CallDialer::removeDialStatusHandler(DialStatusHandler handler)
-       {
-               m_event -= handler;
-       }
-}
diff --git a/src/model/CallDialer.h b/src/model/CallDialer.h
deleted file mode 100644 (file)
index f1a7d5e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CALLUI_MODEL_CALL_DIALER_H__
-#define __CALLUI_MODEL_CALL_DIALER_H__
-
-#include <call-manager-ext.h>
-
-#include "model/ICallDialer.h"
-
-#include "implTypes.h"
-
-namespace callui {
-
-       class CallDialer final : public ICallDialer {
-       public:
-               static CallDialerSRef newInstance(CallManager &cm);
-               virtual ~CallDialer();
-
-               // ICallDialer
-
-               virtual ucl::Result dialVoiceCall(const std::string &number, SimSlot simSlot) override final;
-               virtual void addDialStatusHandler(DialStatusHandler handler) override final;
-               virtual void removeDialStatusHandler(DialStatusHandler handler) override final;
-
-       private:
-               friend class ucl::RefCountObj<CallDialer>;
-               CallDialer(CallManager &cm);
-
-               ucl::Result prepare();
-               void DialStatusChangedCb(cm_dial_status_e dial_status);
-
-       private:
-               CallManager &m_cm;
-               DialStatusEvent m_event;
-       };
-
-}
-
-#endif // __CALLUI_MODEL_CALL_DIALER_H__
index 5c4f823aa5dbe66b30c6ebfeb33666138f40bec2..ab507a5dee8e61f09a2c7cf7048009e8ebc90e2c 100644 (file)
 
 #include "CallManager.h"
 
+#include "model/ICallManagerListener.h"
+
 #include "CallClient.h"
 #include "RejectMsgProvider.h"
-#include "CallDialer.h"
 #include "IncomingCall.h"
 #include "ActiveCall.h"
 #include "HeldCall.h"
@@ -33,8 +34,12 @@ namespace callui {
 
        using namespace ucl;
 
-       CallManager::CallManager(const CallClientSRef &callClient):
-                       m_callClient(callClient)
+       CallManager::CallManager(const CallClientSRef &callClient,
+                       ICallManagerListenerWRef listener):
+                       m_callClient(callClient),
+                       m_listener(listener),
+                       m_slot(SimSlot::UNDEFINED),
+                       m_waitDialing(false)
        {
        }
 
@@ -42,24 +47,26 @@ namespace callui {
        {
        }
 
-       CallManagerSRef CallManager::newInstance(const CallClientSRef &callClient)
+       CallManagerSRef CallManager::newInstance(const CallClientSRef &callClient,
+                       ICallManagerListenerWRef listener)
        {
-               auto result = makeShared<CallManager>(callClient);
+               auto result = makeShared<CallManager>(callClient, listener);
                FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
                return result;
        }
 
        Result CallManager::prepare()
        {
-               m_dialer = CallDialer::newInstance(*this);
-               if (!m_dialer) {
-                       LOG_RETURN(RES_FAIL, "CallDialer::getInstance() failed!");
-               }
-
                FAIL_RETURN(initCalls(), "initCalls() failed!");
 
                FAIL_RETURN(convertCMResult(
-                               cm_set_call_event_cb(*m_callClient, CALLBACK_B(CallManager::callEventCb), this)),
+                               cm_set_dial_status_cb(*m_callClient,
+                                               CALLBACK_B(CallManager::dialStatusCb), this)),
+                               "cm_set_call_event_cb() failed!");
+
+               FAIL_RETURN(convertCMResult(
+                               cm_set_call_event_cb(*m_callClient,
+                                               CALLBACK_B(CallManager::callEventCb), this)),
                                "cm_set_call_event_cb() failed!");
 
                return RES_OK;
@@ -75,66 +82,24 @@ namespace callui {
                                cm_get_all_calldata(*m_callClient, &incom, &active, &held)),
                                "cm_get_all_calldata() failed!");
 
-               FAIL_RETURN(updateIncomingCall(incom), "updateIncomingCall() failed!");
-               FAIL_RETURN(updateActiveCall(active), "updateActiveCall() failed!");
-               FAIL_RETURN(updateHeldCall(held), "updateHeldCall() failed!");
+               FAIL_RETURN(updateCall(m_incomingCall, incom), "updateCall() failed!");
+               FAIL_RETURN(updateCall(m_activeCall, active), "updateCall() failed!");
+               FAIL_RETURN(updateCall(m_heldCall, held), "updateCall() failed!");
 
                return RES_OK;
        }
 
-       Result CallManager::updateIncomingCall(cm_call_data_h incom, SimSlot slot)
+       template <class TYPE, class TYPE2>
+       Result CallManager::updateCall(SharedRef<TYPE> &call, TYPE2 &&data)
        {
-               if (incom) {
-                       m_incomingCall = IncomingCall::newInstance(*this, incom, slot);
-                       if (!m_incomingCall) {
-                               LOG_RETURN(RES_FAIL, "IncomingCall::newInstance() failed!");
-                       }
-               } else {
-                       m_incomingCall.reset();
-               }
+               call.reset();
 
-               return RES_OK;
-       }
-
-       Result CallManager::updateActiveCall(cm_call_data_h active)
-       {
-               if (active) {
-                       m_activeCall = ActiveCall::newInstance(*this, active);
-                       if (!m_activeCall) {
-                               LOG_RETURN(RES_FAIL, "ActiveCall::newInstance() failed!");
+               if (data) {
+                       call = TYPE::newInstance(*this, std::forward<TYPE2>(data));
+                       if (!call) {
+                               LOG_RETURN(RES_FAIL, "newInstance() failed!");
                        }
-               } else {
-                       m_activeCall.reset();
                }
-
-               return RES_OK;
-       }
-
-       Result CallManager::updateHeldCall(cm_call_data_h held)
-       {
-               if (held) {
-                       m_heldCall = HeldCall::newInstance(*this, held);
-                       if (!m_heldCall) {
-                               LOG_RETURN(RES_FAIL, "HeldCall::newInstance() failed!");
-                       }
-               } else {
-                       m_heldCall.reset();
-               }
-
-               return RES_OK;
-       }
-
-       Result CallManager::updateEndCall(cm_call_data_h end, SimSlot slot)
-       {
-               if (end) {
-                       m_endCall = EndCall::newInstance(*this, end, slot);
-                       if (!m_endCall) {
-                               LOG_RETURN(RES_FAIL, "EndCall::newInstance() failed!");
-                       }
-               } else {
-                       m_endCall.reset();
-               }
-
                return RES_OK;
        }
 
@@ -143,9 +108,9 @@ namespace callui {
                return m_callClient;
        }
 
-       ICallDialerWRef CallManager::getDialer()
+       SimSlot CallManager::getSimSlot() const
        {
-               return m_dialer;
+               return m_slot;
        }
 
        IIncomingCallWRef CallManager::getIncomingCall()
@@ -168,14 +133,13 @@ namespace callui {
                return m_endCall;
        }
 
-       void CallManager::addCallStateHandler(CallStateHandler handler)
+       Result CallManager::dialVoiceCall(const std::string &number)
        {
-               m_event += handler;
-       }
+               char buff[TEL_NUMBER_MAX_SIZE] = { 0 };
+               snprintf(buff, sizeof(buff), "%s", number.c_str());
 
-       void CallManager::removeCallStateHandler(CallStateHandler handler)
-       {
-               m_event -= handler;
+               return convertCMResult(
+                               cm_dial_call(*m_callClient, buff, CM_CALL_TYPE_VOICE, convertCUISimSlot(m_slot)));
        }
 
        Result CallManager::endCall(unsigned int callId, CallReleaseType type)
@@ -211,7 +175,7 @@ namespace callui {
                return m_rejectMsgProvider;
        }
 
-       Result CallManager::processEndCallEvent(cm_call_event_data_h callEventData, SimSlot simSlot)
+       Result CallManager::processEndCallEvent(cm_call_event_data_h callEventData)
        {
                unsigned int callId = 0;
                FAIL_RETURN(convertCMResult(
@@ -220,26 +184,26 @@ namespace callui {
 
                Result res = RES_OK;
                if (m_incomingCall && callId == m_incomingCall->getInfo()->getCallId()) {
-                       res = updateEndCall(m_incomingCall->getCallData(), simSlot);
+                       res = updateCall(m_endCall, m_incomingCall->getInfo());
                        m_incomingCall.reset();
                } else if (m_activeCall && callId == m_activeCall->getInfo()->getCallId()) {
-                       res = updateEndCall(m_activeCall->getCallData(), simSlot);
+                       res = updateCall(m_endCall, m_activeCall->getInfo());
                        m_activeCall.reset();
                } else if (m_heldCall && callId == m_heldCall->getInfo()->getCallId()) {
-                       res = updateEndCall(m_heldCall->getCallData(), simSlot);
+                       res = updateCall(m_endCall, m_heldCall->getInfo());
                        m_heldCall.reset();
                } else if (m_activeCall && m_activeCall->getInfo()->getConferenceMemberCount() > 1) {
-                       res = updateEndCall(m_activeCall->getCallData(), simSlot);
+                       res = updateCall(m_endCall, m_activeCall->getInfo());
                        m_activeCall.reset();
                } else if (m_heldCall && m_heldCall->getInfo()->getConferenceMemberCount() > 1) {
-                       res = updateEndCall(m_heldCall->getCallData(), simSlot);
+                       res = updateCall(m_endCall, m_heldCall->getInfo());
                        m_heldCall.reset();
                }
 
                return res;
        }
 
-       Result CallManager::processCommonCallEvent(cm_call_event_data_h callEventData, CallEventType type, SimSlot simSlot)
+       Result CallManager::processCommonCallEvent(cm_call_event_data_h callEventData, CallEventType type)
        {
                unsigned int callId = 0;
                cm_call_data_h cmIncom = nullptr;
@@ -262,19 +226,17 @@ namespace callui {
                                cm_call_event_data_get_held_call(callEventData, &cmHeld)),
                                "cm_call_event_data_get_held_call() failed!");
 
-               if (type == CallEventType::INCOMING) {
-                       FAIL_RETURN(updateIncomingCall(cmIncom, simSlot), "updateIncomingCall() failed!");
-               } else if (!cmIncom) {
-                       m_incomingCall.reset();
-               }
-               FAIL_RETURN(updateActiveCall(cmActive), "updateActiveCall() failed!");
-               FAIL_RETURN(updateHeldCall(cmHeld), "updateHeldCall() failed!");
+               FAIL_RETURN(updateCall(m_incomingCall, cmIncom), "updateCall() failed!");
+               FAIL_RETURN(updateCall(m_activeCall, cmActive), "updateCall() failed!");
+               FAIL_RETURN(updateCall(m_heldCall, cmHeld), "updateCall() failed!");
 
                return RES_OK;
        }
 
        void CallManager::callEventCb(cm_call_event_e callEvent, cm_call_event_data_h callEventData)
        {
+               m_waitDialing = false;
+
                if (!callEventData) {
                        ELOG("callEventData is NULL");
                        return;
@@ -286,17 +248,19 @@ namespace callui {
 
                DLOG("Call event changed on [%d]", type);
 
-               cm_multi_sim_slot_type_e cmSimSlot;
-               FAIL_RETURN_VOID(convertCMResult(
-                               cm_call_event_data_get_sim_slot(callEventData, &cmSimSlot)),
-                               "cm_call_event_data_get_sim_slot() failed!");
-               SimSlot simSlot = convertCMSimSlot(cmSimSlot);
+               if (m_slot == SimSlot::UNDEFINED) {
+                       cm_multi_sim_slot_type_e cmSimSlot;
+                       FAIL_RETURN_VOID(convertCMResult(
+                                       cm_call_event_data_get_sim_slot(callEventData, &cmSimSlot)),
+                                       "cm_call_event_data_get_sim_slot() failed!");
+                       m_slot = convertCMSimSlot(cmSimSlot);
+               }
 
                m_endCall.reset();
 
                switch (type) {
                case CallEventType::END:
-                       FAIL_RETURN_VOID(processEndCallEvent(callEventData, simSlot),
+                       FAIL_RETURN_VOID(processEndCallEvent(callEventData),
                                        "processEndCallEvent() failed!");
                case CallEventType::ACTIVE:
                case CallEventType::INCOMING:
@@ -306,14 +270,50 @@ namespace callui {
                case CallEventType::SWAPPED:
                case CallEventType::JOIN:
                case CallEventType::SPLIT:
-                       FAIL_RETURN_VOID(processCommonCallEvent(callEventData, type, simSlot),
+                       FAIL_RETURN_VOID(processCommonCallEvent(callEventData, type),
                                        "processCommonCallEvent() failed!");
                        break;
                default:
                        return;
                }
 
-               m_event.invoke(type);
+               if (m_listener) {
+                       m_listener->onCallEvent(type);
+               }
+       }
+
+       void CallManager::dialStatusCb(cm_dial_status_e status)
+       {
+               m_waitDialing = false;
+
+               CallManagerErr err = convertCMDialStatusIntoErr(status);
+               if (err != CallManagerErr::NONE && m_listener) {
+                       m_listener->onError(err);
+               }
+       }
+
+       Result CallManager::processOutgoingCall(const std::string &telNum)
+       {
+               if (!m_waitDialing) {
+                       m_waitDialing = true;
+                       return dialVoiceCall(telNum);
+               }
+               return RES_FAIL;
+       }
+
+       Result CallManager::processIncomingCall(SimSlot slot)
+       {
+               if (m_incomingCall) {
+                       if (m_slot == SimSlot::UNDEFINED) {
+                               m_slot = slot;
+                       }
+                       if (m_listener) {
+                               m_listener->onCallEvent(CallEventType::INCOMING);
+                       }
+                       return RES_OK;
+               }
+               ELOG("Incoming call is NULL");
+               return RES_FAIL;
        }
 
 }
index 4e2770bbf00a33f607b2a2ec699ffc2726bc9011..6dba3f7b93563e9ec6c6ea11a809b690d0aa341f 100644 (file)
@@ -19,8 +19,6 @@
 
 #include <call-manager-ext.h>
 
-#include "ucl/misc/Event.h"
-
 #include "model/ICallManager.h"
 
 #include "implTypes.h"
@@ -29,49 +27,56 @@ namespace callui {
 
        class CallManager final : public ICallManager {
        public:
-               static CallManagerSRef newInstance(const CallClientSRef &callClient);
+               static CallManagerSRef newInstance(const CallClientSRef &callClient,
+                               ICallManagerListenerWRef listener);
                virtual ~CallManager();
 
                CallClientSRef getCallClient();
+               SimSlot getSimSlot() const;
+               ucl::Result dialVoiceCall(const std::string &number);
                ucl::Result endCall(unsigned int callId, CallReleaseType type);
                ucl::Result splitCalls(CallInfoSRef callInfo,
                                const IConferenceCallInfoSCRef &confCallInfo);
                RejectMsgProviderSRef getRejectMsgProvider();
 
+               ucl::Result processOutgoingCall(const std::string &telNum);
+               ucl::Result processIncomingCall(SimSlot slot);
+
                // ICallManager
 
-               virtual ICallDialerWRef getDialer() override final;
                virtual IIncomingCallWRef getIncomingCall() override final;
                virtual IActiveCallWRef getActiveCall() override final;
                virtual IHeldCallWRef getHeldCall() override final;
                virtual IEndCallWRef getEndCall() override final;
-               virtual void addCallStateHandler(CallStateHandler handler) override final;
-               virtual void removeCallStateHandler(CallStateHandler handler) override final;
 
        private:
                friend class ucl::RefCountObj<CallManager>;
-               CallManager(const CallClientSRef &callClient);
+               CallManager(const CallClientSRef &callClient,
+                               ICallManagerListenerWRef listener);
 
                ucl::Result prepare();
                ucl::Result initCalls();
-               ucl::Result updateIncomingCall(cm_call_data_h incom, SimSlot slot = SimSlot::DEFAULT);
-               ucl::Result updateActiveCall(cm_call_data_h active);
-               ucl::Result updateHeldCall(cm_call_data_h active);
-               ucl::Result updateEndCall(cm_call_data_h end, SimSlot slot = SimSlot::DEFAULT);
-               ucl::Result processEndCallEvent(cm_call_event_data_h callEventData, SimSlot slot);
+
+               template <class TYPE, class TYPE2>
+               ucl::Result updateCall(ucl::SharedRef<TYPE> &call, TYPE2 &&data);
+
+               ucl::Result processEndCallEvent(cm_call_event_data_h callEventData);
                ucl::Result processCommonCallEvent(cm_call_event_data_h callEventData,
-                               CallEventType type, SimSlot simSlot);
+                               CallEventType type);
                void callEventCb(cm_call_event_e call_event, cm_call_event_data_h call_state_data);
+               void dialStatusCb(cm_dial_status_e status);
 
        private:
                CallClientSRef m_callClient;
                RejectMsgProviderSRef m_rejectMsgProvider;
-               CallDialerSRef m_dialer;
+               MsgClientSRef m_msgClient;
+               ICallManagerListenerWRef m_listener;
                IncomingCallSRef m_incomingCall;
                ActiveCallSRef m_activeCall;
                HeldCallSRef m_heldCall;
                EndCallSRef m_endCall;
-               CallStateEvent m_event;
+               SimSlot m_slot;
+               bool m_waitDialing;
        };
 
 }
index 65a70c6d6bae032475e0282bdc9a34e210b8a29f..7d5881dcd3b970347e346aee5de4bdca6f05466d 100644 (file)
@@ -19,7 +19,6 @@
 #include "CallClient.h"
 #include "CallManager.h"
 #include "CallInfo.h"
-#include "model/ICallDialer.h"
 
 #include "common.h"
 
@@ -27,10 +26,9 @@ namespace callui {
 
        using namespace ucl;
 
-       EndCall::EndCall(CallManager &cm, cm_call_data_h callData, SimSlot slot):
-                       BaseCall(callData),
+       EndCall::EndCall(CallManager &cm, ICallInfoSCRef callInfo):
                        m_cm(cm),
-                       m_slot(slot)
+                       m_callInfo(callInfo)
        {
        }
 
@@ -38,24 +36,12 @@ namespace callui {
        {
        }
 
-       EndCallSRef EndCall::newInstance(CallManager &cm, cm_call_data_h callData, SimSlot slot)
+       EndCallSRef EndCall::newInstance(CallManager &cm, ICallInfoSCRef callInfo)
        {
-               if (!callData) {
-                       LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
+               if (!callInfo) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "callInfo is NULL");
                }
-
-               auto result = makeShared<EndCall>(cm, callData, slot);
-               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
-               return result;
-       }
-
-       Result EndCall::prepare()
-       {
-               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), m_callData);
-               if (!m_callInfo) {
-                       LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
-               }
-               return RES_OK;
+               return makeShared<EndCall>(cm, callInfo);
        }
 
        ICallInfoSCRef EndCall::getInfo() const
@@ -65,12 +51,7 @@ namespace callui {
 
        Result EndCall::callBack()
        {
-               ICallDialerWRef dialer = m_cm.getDialer();
-               if (dialer) {
-                       return dialer->dialVoiceCall(m_callInfo->getPhoneNumber(), m_slot);
-               } else {
-                       return RES_FAIL;
-               }
+               return m_cm.dialVoiceCall(m_callInfo->getPhoneNumber());
        }
 
        Result EndCall::writeMessage()
index 7a60d8995402c0d0560f5dc54b5a88ed3916b792..ceff93648383409a662fd96a978c9d804b89a7c6 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <call-manager-ext.h>
 
-#include "BaseCall.h"
 #include "model/IEndCall.h"
 
 #include "implTypes.h"
@@ -28,13 +27,9 @@ namespace callui {
 
        class CallManager;
 
-       class EndCall final :
-               public BaseCall,
-               public IEndCall {
+       class EndCall final : public IEndCall {
        public:
-               static EndCallSRef newInstance(CallManager &cm,
-                               cm_call_data_h callData,
-                               SimSlot slot = SimSlot::DEFAULT);
+               static EndCallSRef newInstance(CallManager &cm, ICallInfoSCRef callInfo);
 
                virtual ~EndCall();
 
@@ -46,14 +41,13 @@ namespace callui {
 
        private:
                friend class ucl::RefCountObj<EndCall>;
-               EndCall(CallManager &cm, cm_call_data_h callData, SimSlot slot);
+               EndCall(CallManager &cm, ICallInfoSCRef callInfo);
 
                ucl::Result prepare();
 
        private:
                CallManager &m_cm;
-               CallInfoSRef m_callInfo;
-               SimSlot m_slot;
+               ICallInfoSCRef m_callInfo;
        };
 
 }
index ff7766c97eb63974f4a0e2f8b6a9f9d3de854263..8bc5604b5e412ce637a892420ebd27e7af5647fc 100644 (file)
@@ -28,7 +28,6 @@ namespace callui {
        using namespace ucl;
 
        HeldCall::HeldCall(CallManager &cm, cm_call_data_h callData):
-                       BaseCall(callData),
                        m_cm(cm)
        {
        }
@@ -44,13 +43,13 @@ namespace callui {
                }
 
                auto result = makeShared<HeldCall>(cm, callData);
-               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
                return result;
        }
 
-       Result HeldCall::prepare()
+       Result HeldCall::prepare(cm_call_data_h callData)
        {
-               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), m_callData);
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
                if (!m_callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
                }
index 80f7d011ee0a8b65647672b4984e7c9a064dbbfd..609c4192235573026f8d47f1625f9683969895ba 100644 (file)
 
 #include <call-manager-ext.h>
 
-#include "BaseCall.h"
 #include "model/IHeldCall.h"
 
 #include "implTypes.h"
 
 namespace callui {
 
-       class HeldCall final :
-               public BaseCall,
-               public IHeldCall {
+       class HeldCall final : public IHeldCall {
        public:
                static HeldCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
                virtual ~HeldCall();
@@ -46,7 +43,7 @@ namespace callui {
                friend class ucl::RefCountObj<HeldCall>;
                HeldCall(CallManager &cm, cm_call_data_h callData);
 
-               ucl::Result prepare();
+               ucl::Result prepare(cm_call_data_h callData);
 
        private:
                CallManager &m_cm;
index d45c10547d8bd2e57f5b65c44c021141de335fc2..0af24bf4dd51d0275984d31ee22c592a3f3b9735 100644 (file)
@@ -29,10 +29,8 @@ namespace callui {
 
        using namespace ucl;
 
-       IncomingCall::IncomingCall(CallManager &cm, cm_call_data_h callData, SimSlot slot):
-                       BaseCall(callData),
-                       m_cm(cm),
-                       m_simSlot(slot)
+       IncomingCall::IncomingCall(CallManager &cm, cm_call_data_h callData):
+                       m_cm(cm)
        {
        }
 
@@ -40,20 +38,20 @@ namespace callui {
        {
        }
 
-       IncomingCallSRef IncomingCall::newInstance(CallManager &cm, cm_call_data_h callData, SimSlot slot)
+       IncomingCallSRef IncomingCall::newInstance(CallManager &cm, cm_call_data_h callData)
        {
                if (!callData) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
                }
 
-               auto result = makeShared<IncomingCall>(cm, callData, slot);
-               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               auto result = makeShared<IncomingCall>(cm, callData);
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
                return result;
        }
 
-       Result IncomingCall::prepare()
+       Result IncomingCall::prepare(cm_call_data_h callData)
        {
-               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), m_callData);
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
                if (!m_callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
                }
@@ -89,7 +87,8 @@ namespace callui {
                if (!msg) {
                        LOG_RETURN(RES_FAIL, "message is not RejectMsg type!");
                }
-               return msg->send(m_callInfo->getPhoneNumber(), m_simSlot);
+               return msg->send(m_callInfo->getPhoneNumber(), m_cm.getSimSlot());
+
        }
 
        Result IncomingCall::stopAlert()
index f64f73e8f966a418feaebf719e029c6a0ea23b0d..cfa374232438861017cea9ab0d84d8a7c3435b59 100644 (file)
 
 #include <call-manager-ext.h>
 
-#include "BaseCall.h"
 #include "model/IIncomingCall.h"
 
 #include "implTypes.h"
 
 namespace callui {
 
-       class IncomingCall final :
-               public BaseCall,
-               public IIncomingCall {
+       class IncomingCall final : public IIncomingCall {
        public:
-               static IncomingCallSRef newInstance(CallManager &cm,
-                               cm_call_data_h callData,
-                               SimSlot slot = SimSlot::DEFAULT);
+               static IncomingCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
 
                virtual ~IncomingCall();
 
@@ -47,14 +42,13 @@ namespace callui {
 
        private:
                friend class ucl::RefCountObj<IncomingCall>;
-               IncomingCall(CallManager &cm, cm_call_data_h callData, SimSlot slot);
+               IncomingCall(CallManager &cm, cm_call_data_h callData);
 
-               ucl::Result prepare();
+               ucl::Result prepare(cm_call_data_h callData);
 
        private:
                CallManager &m_cm;
                CallInfoSRef m_callInfo;
-               SimSlot m_simSlot;
        };
 
 }
index d1014e23aa15fcdb98706aafdfe9ffb1507dc8ee..66f5a53df402af1a4f0a050d0c6c8e5687fb313b 100644 (file)
@@ -28,7 +28,7 @@ namespace callui {
 
        AudioStateType convertCMAudioState(cm_audio_state_type_e state);
 
-       DialStatus convertCMDialStatus(cm_dial_status_e status);
+       CallManagerErr convertCMDialStatusIntoErr(cm_dial_status_e status);
 
        cm_multi_sim_slot_type_e convertCUISimSlot(SimSlot slot);
 
index d645901b7d5ab4efc952f44816618f920883666e..d80b80080717cfa3019dad46c736d74bf6a7b421 100644 (file)
@@ -47,17 +47,17 @@ namespace callui {
                }
        }
 
-       inline DialStatus convertCMDialStatus(cm_dial_status_e status)
+       inline CallManagerErr convertCMDialStatusIntoErr(cm_dial_status_e status)
        {
                switch (status) {
-               case CM_DIAL_SUCCESS:           return DialStatus::SUCCESS;
-               case CM_DIAL_CANCEL:            return DialStatus::CANCEL;
-               case CM_DIAL_FAIL:              return DialStatus::FAIL;
-               case CM_DIAL_FAIL_SS:           return DialStatus::FAIL_SS;
-               case CM_DIAL_FAIL_FDN:          return DialStatus::FAIL_FDN;
-               case CM_DIAL_FAIL_FLIGHT_MODE:  return DialStatus::FLIGHT_MODE;
+               case CM_DIAL_SUCCESS:           return CallManagerErr::NONE;
+               case CM_DIAL_CANCEL:            return CallManagerErr::DIAL_CANCEL;
+               case CM_DIAL_FAIL:              return CallManagerErr::DIAL_FAIL;
+               case CM_DIAL_FAIL_SS:           return CallManagerErr::DIAL_FAIL_SS;
+               case CM_DIAL_FAIL_FDN:          return CallManagerErr::DIAL_FAIL_FDN;
+               case CM_DIAL_FAIL_FLIGHT_MODE:  return CallManagerErr::DIAL_FLIGHT_MODE;
                default:
-                       return DialStatus::FAIL;
+                       return CallManagerErr::DIAL_FAIL;
                }
        }
 
index 4db1188e3781b763008b33b9fbe8408cf9f82111..e1e185c06b71a2b62ebde71cde7ddedc76b2ab2f 100644 (file)
@@ -33,7 +33,6 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(SoundManager);
        UCL_DECLARE_REF_ALIASES(CallManager);
-       UCL_DECLARE_REF_ALIASES(CallDialer);
 
        UCL_DECLARE_REF_ALIASES(IncomingCall);
        UCL_DECLARE_REF_ALIASES(ActiveCall);
@@ -48,10 +47,8 @@ namespace callui {
        UCL_DECLARE_REF_ALIASES(RejectMsgProvider);
        UCL_DECLARE_REF_ALIASES(RejectMsg);
 
-       using CallStateEvent = ucl::Event<CallStateHandler>;
        using AudioStateEvent = ucl::Event<AudioStateHandler>;
        using MuteStateEvent = ucl::Event<MuteStateHandler>;
-       using DialStatusEvent = ucl::Event<DialStatusHandler>;
 }
 
 #endif // __CALLUI_MODEL_IMPL_TYPES_H__
index c3ee103a7f0a68b6132b747e03bb6f81432dd1c8..27ffd04982ab9adf81c9ca77cf710a3ff1fd4f75 100644 (file)
@@ -4,6 +4,12 @@
     <ui-application appid="org.tizen.call-ui" exec="call-ui" multiple="false" nodisplay="false" taskmanage="true" type="capp">
         <label>call-ui</label>
         <icon>call-ui.png</icon>
+        <app-control>
+            <operation name="http://tizen.org/appcontrol/operation/call"/>
+            <uri name="tel"/>
+        </app-control>
+        <metadata key="http://tizen.org/metadata/background-category/media"/>
+        <metadata key="http://tizen.org/metadata/background-category/background-network"/>
     </ui-application>
     <privileges>
         <privilege>http://tizen.org/privilege/keygrab</privilege>