TizenRefApp-8319 [Call UI] Prepare sceleton for Model call manager part 81/123281/3
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 3 Apr 2017 11:52:33 +0000 (14:52 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 6 Apr 2017 11:45:47 +0000 (14:45 +0300)
Change-Id: Ibc33372b1fbea346c1bcdabd0560e4b3a1af8e1f

32 files changed:
.cproject
inc/model/Call.h
inc/model/ISoundManager.h
inc/types.h
src/model/ActiveCall.cpp [new file with mode: 0644]
src/model/ActiveCall.h [new file with mode: 0644]
src/model/Call.cpp
src/model/CallClient.cpp [new file with mode: 0644]
src/model/CallClient.h [new file with mode: 0644]
src/model/CallDialer.cpp [new file with mode: 0644]
src/model/CallDialer.h [new file with mode: 0644]
src/model/CallInfo.cpp [new file with mode: 0644]
src/model/CallInfo.h [new file with mode: 0644]
src/model/CallManager.cpp [new file with mode: 0644]
src/model/CallManager.h [new file with mode: 0644]
src/model/ConferenceCallInfo.cpp [new file with mode: 0644]
src/model/ConferenceCallInfo.h [new file with mode: 0644]
src/model/ContactInfo.cpp [new file with mode: 0644]
src/model/ContactInfo.h [new file with mode: 0644]
src/model/EndCall.cpp [new file with mode: 0644]
src/model/EndCall.h [new file with mode: 0644]
src/model/HeldCall.cpp [new file with mode: 0644]
src/model/HeldCall.h [new file with mode: 0644]
src/model/IncomingCall.cpp [new file with mode: 0644]
src/model/IncomingCall.h [new file with mode: 0644]
src/model/SoundManager.cpp [new file with mode: 0644]
src/model/SoundManager.h [new file with mode: 0644]
src/model/helpers.h [new file with mode: 0644]
src/model/helpers.hpp [new file with mode: 0644]
src/model/implTypes.h [new file with mode: 0644]
src/types.cpp [new file with mode: 0644]
ucl/inc/ucl/config.h

index 137ec08fd06a332f5bbe6e44980fb114d7efb874..de009a078ef6644202a6c723c9d326d3735eb7f0 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                        <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.299151930" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
                                                        <builder autoBuildTarget="all" buildPath="${workspace_loc:/call-ui}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.287909858" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
                                                        <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.850939844" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
-                                                       <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
                                                                <option id="gnu.cpp.compiler.option.optimization.level.1977572256" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
                                                                <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1003532466" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.58197076" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.1780411914" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_gcc49.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_llvm37.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.2060575755" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/msg-service&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/rua/&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony-client&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/tzsh&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_dali&quot;"/>
                                                                <option id="gnu.cpp.compiler.option.dialect.std.2098907038" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.27127097" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
-                                                       <tool command="i386-linux-gnueabi-gcc" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1049599195" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1049599195" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
                                                                <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1400861396" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
                                                                <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.1157370620" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1654013693" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.c.compiler.option.551225658" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_gcc49.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_llvm37.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1481628386" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/msg-service&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/rua/&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony-client&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/tzsh&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_dali&quot;"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.890993403" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1743186514" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
-                                                       <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1743878166" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1743878166" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
                                                                <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.1017885244" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.219138009" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.588492684" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
                        <resource resourceType="PROJECT" workspacePath="/call-ui"/>
                </configuration>
        </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
 </cproject>
index b91a5f0b3fa491844549b7ff8fe408d16fc1035e..d3331e0240cbba8f3f542fe3405abfd28df66325 100644 (file)
@@ -21,6 +21,9 @@
 
 namespace callui {
 
+       UCL_DECLARE_REF_ALIASES(CallManager);
+       UCL_DECLARE_REF_ALIASES(SoundManager);
+
        class Call final : public ucl::NonCopyable {
        public:
                static CallSRef newInstance();
@@ -35,6 +38,10 @@ namespace callui {
 
                ucl::Result prepare();
 
+       private:
+               CallManagerSRef m_callManager;
+               SoundManagerSRef m_soundManager;
+
        };
 
 }
index 23b52d84d0b8614402075c40e6a606a300806d4c..1b34e51ce53598ba533abb77f22bd2481bf4ab35 100644 (file)
@@ -29,7 +29,7 @@ namespace callui {
        public:
                virtual ucl::Result setSpeakerState(bool isEnable) = 0;
                virtual ucl::Result setBluetoothState(bool isEnable) = 0;
-               virtual AudioStateType getAudioState() = 0;
+               virtual AudioStateType getAudioState() const = 0;
                virtual ucl::Result setMuteState(bool isEnable) = 0;
                virtual bool getMuteState() const = 0;
                virtual ucl::Result startDtmf(const unsigned char dtmfDigit) = 0;
index fa935caf381669898a88d2d9a1a9eea059966c61..75a622c353af5c5250918be69556dc01ed5951c1 100644 (file)
 #include "ucl/util/memory.h"
 #include "ucl/util/delegation.h"
 
+namespace callui {
+       enum {
+               _UCL_RESULT,
+
+               RES_PERMISSION_DENIED   = ucl::_RES_BEGIN - 1,
+               RES_NOT_REGISTERED      = ucl::_RES_BEGIN - 2,
+               RES_ALREADY_REGISTERED  = ucl::_RES_BEGIN - 3,
+               RES_OPERATION_FAILED    = ucl::_RES_BEGIN - 4
+       };
+}
+
 #endif // __CALLUI_TYPES_H__
diff --git a/src/model/ActiveCall.cpp b/src/model/ActiveCall.cpp
new file mode 100644 (file)
index 0000000..93a128a
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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 "ActiveCall.h"
+
+#include "CallClient.h"
+#include "CallManager.h"
+#include "CallInfo.h"
+
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       ActiveCall::ActiveCall(CallManager &cm):
+                       m_cm(cm)
+       {
+       }
+       ActiveCall::~ActiveCall()
+       {
+       }
+
+       ActiveCallSRef ActiveCall::newInstance(CallManager &cm, cm_call_data_h callData)
+       {
+               if (!callData) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
+               }
+
+               auto result = makeShared<ActiveCall>(cm);
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result ActiveCall::prepare(cm_call_data_h callData)
+       {
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
+               if (!m_callInfo) {
+                       LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
+               }
+               return RES_OK;
+       }
+
+       ICallInfoSCRef ActiveCall::getInfo() const
+       {
+               return m_callInfo;
+       }
+
+       bool ActiveCall::isDialingMode() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result ActiveCall::hold()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result ActiveCall::end()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result ActiveCall::split(const IConferenceCallInfoSRef &confCallInfo)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+}
diff --git a/src/model/ActiveCall.h b/src/model/ActiveCall.h
new file mode 100644 (file)
index 0000000..106fa6d
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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_ACTIVE_CALL_H__
+#define __CALLUI_MODEL_ACTIVE_CALL_H__
+
+#include <call-manager-ext.h>
+
+#include "model/IActiveCall.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class ActiveCall final : public IActiveCall {
+       public:
+               static ActiveCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
+               virtual ~ActiveCall();
+
+               // IActiveCall
+
+               virtual ICallInfoSCRef getInfo() const override final;
+               virtual bool isDialingMode() const override final;
+               virtual ucl::Result hold() override final;
+               virtual ucl::Result end() override final;
+               virtual ucl::Result split(const IConferenceCallInfoSRef &confCallInfo) override final;
+
+       private:
+               friend class ucl::RefCountObj<ActiveCall>;
+               ActiveCall(CallManager &cm);
+
+               ucl::Result prepare(cm_call_data_h callData);
+
+       private:
+               CallManager &m_cm;
+               CallInfoSRef m_callInfo;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_ACTIVE_CALL_H__
index 9a1e1170bbfbb6678ad4427e131086330cc6d0bf..497e326e3434b236e5b2fff6600e8cea7c4614b5 100644 (file)
 
 #include "model/Call.h"
 
+#include "CallClient.h"
+#include "CallManager.h"
+#include "SoundManager.h"
+
 #include "common.h"
 
 namespace callui {
@@ -39,6 +43,21 @@ namespace callui {
 
        ucl::Result Call::prepare()
        {
+               CallClientSRef client = CallClient::newInstance();
+               if (!client) {
+                       LOG_RETURN(RES_FAIL, "Client::newInstance() failed!");
+               }
+
+               m_callManager = CallManager::newInstance(client);
+               if (!m_callManager) {
+                       LOG_RETURN(RES_FAIL, "CallManager::newInstance() failed!");
+               }
+
+               m_soundManager = SoundManager::newInstance(client);
+               if (!m_soundManager) {
+                       LOG_RETURN(RES_FAIL, "SoundManage::newInstance() failed!");
+               }
+
                return RES_OK;
        }
 
diff --git a/src/model/CallClient.cpp b/src/model/CallClient.cpp
new file mode 100644 (file)
index 0000000..73e8212
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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 "CallClient.h"
+
+#include "common.h"
+#include "helpers.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       CallClient::CallClient():
+                       m_client()
+       {
+       }
+
+       CallClient::~CallClient()
+       {
+               if (m_client) {
+                       cm_deinit(m_client);
+               }
+       }
+
+       CallClientSRef CallClient::newInstance()
+       {
+               auto result = makeShared<CallClient>();
+               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       ucl::Result CallClient::prepare()
+       {
+               cm_client_h client;
+               FAIL_RETURN_VALUE(convertCallManagerResult(cm_init(&client)), {}, "cm_init() failed!");
+               m_client = client;
+
+               return RES_OK;
+       }
+
+       cm_client_h CallClient::getCmClient() const
+       {
+               return m_client;
+       }
+
+       CallClient::operator cm_client_h() const
+       {
+               return getCmClient();
+       }
+
+}
diff --git a/src/model/CallClient.h b/src/model/CallClient.h
new file mode 100644 (file)
index 0000000..3bdea83
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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_CLIENT_H__
+#define __CALLUI_MODEL_CALL_CLIENT_H__
+
+#include <call-manager.h>
+
+#include "types.h"
+#include "implTypes.h"
+
+namespace callui {
+
+       class CallClient {
+       public:
+               static CallClientSRef newInstance();
+               virtual ~CallClient();
+               cm_client_h getCmClient() const;
+               operator cm_client_h() const;
+
+       private:
+               friend class ucl::RefCountObj<CallClient>;
+               CallClient();
+               ucl::Result prepare();
+
+       private:
+               cm_client_h m_client;
+       };
+}
+
+#endif // __CALLUI_MODEL_CALL_CLIENT_H__
diff --git a/src/model/CallDialer.cpp b/src/model/CallDialer.cpp
new file mode 100644 (file)
index 0000000..0699b49
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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 "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       CallDialer::CallDialer(CallManager &cm):
+               m_cm(cm)
+       {
+       }
+
+       CallDialer::~CallDialer()
+       {
+       }
+
+       CallDialerSRef CallDialer::newInstance(CallManager &cm)
+       {
+               auto result = makeShared<CallDialer>(cm);
+               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result CallDialer::prepare()
+       {
+               return RES_OK;
+       }
+
+       Result CallDialer::dialVoiceCall(const std::string &number, SimSlot simSlot)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result CallDialer::addDialStatusHandler(DialStatusHandler handler)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result CallDialer::removeDialStatusHandler(DialStatusHandler handler)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+}
diff --git a/src/model/CallDialer.h b/src/model/CallDialer.h
new file mode 100644 (file)
index 0000000..4dcf865
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 "types.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 ucl::Result addDialStatusHandler(DialStatusHandler handler) override final;
+               virtual ucl::Result removeDialStatusHandler(DialStatusHandler handler) override final;
+
+       private:
+               ucl::Result prepare();
+       private:
+               friend class ucl::RefCountObj<CallDialer>;
+               CallDialer(CallManager &cm);
+
+       private:
+               CallManager &m_cm;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_CALL_DIALER_H__
diff --git a/src/model/CallInfo.cpp b/src/model/CallInfo.cpp
new file mode 100644 (file)
index 0000000..d9b3192
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * 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 "CallInfo.h"
+
+#include <call-manager-extension.h>
+#include <glib/gslist.h>
+#include <glib/gtypes.h>
+
+#include "ContactInfo.h"
+#include "CallClient.h"
+#include "ConferenceCallInfo.h"
+
+#include "common.h"
+#include "helpers.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       CallInfo::CallInfo():
+               m_callId(-1),
+               m_startTime(0),
+               m_isEmergency(false),
+               m_isDialing(false),
+               m_confMemberCount(0)
+       {
+       }
+
+       CallInfo::~CallInfo()
+       {
+       }
+
+       CallInfoSRef CallInfo::newInstance(CallClient &client, cm_call_data_h callData)
+       {
+               if (!client) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "client is NULL");
+               }
+
+               if (!callData) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
+               }
+
+               auto result = makeShared<CallInfo>();
+               FAIL_RETURN_VALUE(result->prepare(client, callData), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result CallInfo::prepare(CallClient &client, cm_call_data_h callData)
+       {
+               Result res = convertCallManagerResult(cm_call_data_get_call_id(callData, &m_callId));
+               FAIL_RETURN(res, "cm_call_data_get_call_id() failed!");
+
+               char *number = nullptr;
+               res = convertCallManagerResult(cm_call_data_get_call_number(callData, &number));
+               FAIL_RETURN(res, "cm_call_data_get_call_number() failed!");
+               m_phoneNum = nz(number);
+               // XXX: According to documentation it must be free, but it leads to crash
+//             free(number);
+
+               gboolean isEmergency;
+               res = convertCallManagerResult(cm_call_data_is_emergency_call(callData, &isEmergency));
+               FAIL_RETURN(res, "cm_call_data_is_emergency_call() failed!");
+               m_isEmergency = isEmergency;
+
+               cm_call_state_e callState = CM_CALL_STATE_IDLE;
+               res = convertCallManagerResult(cm_call_data_get_call_state(callData, &callState));
+               FAIL_RETURN(res, "cm_call_data_get_call_state() failed!");
+               m_isDialing = (callState == CM_CALL_STATE_DIALING);
+
+               res = convertCallManagerResult(cm_call_data_get_start_time(callData, &m_startTime));
+               FAIL_RETURN(res, "cm_call_data_get_start_time() failed!");
+
+               int personId = -1;
+               res = convertCallManagerResult(cm_call_data_get_person_id(callData, &personId));
+               FAIL_RETURN(res, "cm_call_data_get_person_id() failed!");
+
+               if (personId >= 0) {
+                       m_contactInfo = ContactInfo::newInstance(personId);
+                       if (!m_contactInfo) {
+                               LOG_RETURN(RES_FAIL, "ContactInfo::newInstance() failed!");
+                       }
+               }
+
+               res = convertCallManagerResult(cm_call_data_get_call_member_count(callData, &m_confMemberCount));
+               FAIL_RETURN(res, "cm_call_data_get_call_member_count() failed!");
+
+               if (m_confMemberCount > 1) {
+                       res = initConferenceCallInfoList(client);
+                       FAIL_RETURN(res, "initConferenceCallInfoList() failed!");
+               }
+
+               return RES_OK;
+       }
+
+       Result CallInfo::initConferenceCallInfoList(CallClient &client)
+       {
+               // XXX: must be initialized with nullptr. If not an there is no conference calls
+               // cm_get_conference_callList return CM_ERROR_NONE and pointer will be not changed.
+               GSList *callList = nullptr;
+               Result res = convertCallManagerResult(cm_get_conference_call_list(client, &callList));
+               FAIL_RETURN(res, "cm_get_conference_call_list() failed!");
+
+               if (callList) {
+                       res = RES_OK;
+                       GSList *l = callList;
+                       for (; l != nullptr; l = g_slist_next(l)) {
+                               auto confCallInfo = ConferenceCallInfo::newInstance(static_cast<cm_conf_call_data_t *>(l->data));
+                               if (!confCallInfo) {
+                                       ELOG("ConferenceCallInfo::newInstance() failed!");
+                                       res = RES_OUT_OF_MEMORY;
+                                       break;
+                               }
+                               m_confMemberList.push_back(confCallInfo);
+                       }
+
+                       if (res != RES_OK) {
+                               m_confMemberList.clear();
+                       }
+                       g_slist_free_full(callList, [](gpointer data)
+                                       {
+                                               cm_conf_call_data_free(static_cast<cm_conf_call_data_t *>(data));
+                                       });
+               }
+               return res;
+       }
+
+       unsigned int CallInfo::getCallId()
+       {
+               return m_callId;
+       }
+
+       const std::string &CallInfo::getPhoneNumber() const
+       {
+               return m_phoneNum;
+       }
+
+       IContactInfoSCRef CallInfo::getContactInfo() const
+       {
+               return m_contactInfo;
+       }
+
+       long CallInfo::getStartTime() const
+       {
+               return m_startTime;
+       }
+
+       bool CallInfo::isEmergency() const
+       {
+               return m_isEmergency;
+       }
+
+       bool CallInfo::isDialing() const
+       {
+               return m_isDialing;
+       }
+
+       int CallInfo::getConferenceMemberCount() const
+       {
+               return m_confMemberCount;
+       }
+
+       const ConfMemberCallList &CallInfo::getConferenceMemberList() const
+       {
+               return m_confMemberList;
+       }
+
+}
diff --git a/src/model/CallInfo.h b/src/model/CallInfo.h
new file mode 100644 (file)
index 0000000..5b1cd8d
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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_INFO_H__
+#define __CALLUI_MODEL_CALL_INFO_H__
+
+#include <call-manager-ext.h>
+
+#include "model/ICallInfo.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class CallInfo final : public ICallInfo {
+       public:
+               static CallInfoSRef newInstance(CallClient &client, cm_call_data_h callData);
+               virtual ~CallInfo();
+
+               unsigned int getCallId();
+
+               // ICallInfo
+
+               virtual const std::string &getPhoneNumber() const override final;
+               virtual IContactInfoSCRef getContactInfo() const override final;
+               virtual long getStartTime() const override final;
+               virtual bool isEmergency() const override final;
+               virtual bool isDialing() const override final;
+               virtual int getConferenceMemberCount() const override final;
+               virtual const ConfMemberCallList &getConferenceMemberList() const override final;
+
+       private:
+               friend class ucl::RefCountObj<CallInfo>;
+               CallInfo();
+
+               ucl::Result prepare(CallClient &client, cm_call_data_h callData);
+               ucl::Result initConferenceCallInfoList(CallClient &client);
+
+       private:
+               unsigned int m_callId;
+               std::string m_phoneNum;
+               ContactInfoSRef m_contactInfo;
+               long m_startTime;
+               bool m_isEmergency;
+               bool m_isDialing;
+               int m_confMemberCount;
+               ConfMemberCallList m_confMemberList;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_CALL_INFO_H__
diff --git a/src/model/CallManager.cpp b/src/model/CallManager.cpp
new file mode 100644 (file)
index 0000000..c01d3b0
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * 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 "CallManager.h"
+
+#include <call-manager-ext.h>
+#include <call-manager-extension.h>
+
+#include "CallClient.h"
+#include "CallDialer.h"
+#include "IncomingCall.h"
+#include "ActiveCall.h"
+#include "HeldCall.h"
+#include "EndCall.h"
+
+#include "helpers.h"
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       CallManager::CallManager(const CallClientSRef &client):
+                       m_client(client),
+                       m_availableCalls(0)
+       {
+       }
+
+       CallManager::~CallManager()
+       {
+               ILOG();
+       }
+
+       CallManagerSRef CallManager::newInstance(const CallClientSRef &client)
+       {
+               auto result = makeShared<CallManager>(client);
+               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!");
+               }
+
+               Result res = updateCalls();
+               FAIL_RETURN_VALUE(res, res, "updateCalls() failed");
+
+               return RES_OK;
+       }
+
+       void CallManager::resetCalls()
+       {
+               m_incomingCall.reset();
+               m_activeCall.reset();
+               m_heldCall.reset();
+               m_endCall.reset();
+
+               m_availableCalls = 0;
+       }
+
+       Result CallManager::updateCalls()
+       {
+               resetCalls();
+
+               cm_call_data_h incom = nullptr;
+               cm_call_data_h active = nullptr;
+               cm_call_data_h held = nullptr;
+               Result res = convertCallManagerResult(cm_get_all_calldata(*m_client, &incom, &active, &held));
+               FAIL_RETURN_VALUE(res, res, "cm_get_all_calldata() failed");
+
+               if (incom) {
+                       m_incomingCall = IncomingCall::newInstance(*this, incom);
+                       if (!m_incomingCall) {
+                               LOG_RETURN(RES_FAIL, "IncomingCall::newInstance() failed!");
+                       }
+                       m_availableCalls |= CALL_FLAG_INCOMING;
+               }
+
+               if (active) {
+                       m_activeCall = ActiveCall::newInstance(*this, active);
+                       if (!m_activeCall) {
+                               LOG_RETURN(RES_FAIL, "ActiveCall::newInstance() failed!");
+                       }
+                       m_availableCalls |= CALL_FLAG_ACTIVE;
+               }
+
+               if (held) {
+                       m_heldCall = HeldCall::newInstance(*this, held);
+                       if (!m_heldCall) {
+                               LOG_RETURN(RES_FAIL, "HeldCall::newInstance() failed!");
+                       }
+                       m_availableCalls |= CALL_FLAG_HELD;
+               }
+
+               // TODO: need to implement End Call logic according to system call manager events
+
+               return RES_OK;
+
+       }
+
+       CallClientSRef CallManager::getCallClient()
+       {
+               return m_client;
+       }
+
+       ICallDialerWRef CallManager::getDialer()
+       {
+               return m_dialer;
+       }
+
+       IIncomingCallWRef CallManager::getIncomingCall()
+       {
+               return m_incomingCall;
+       }
+
+       IActiveCallWRef CallManager::getActiveCall()
+       {
+               return m_activeCall;
+       }
+
+       IHeldCallWRef CallManager::getHeldCall()
+       {
+               return m_heldCall;
+       }
+
+       IEndCallWRef CallManager::getEndCall()
+       {
+               return m_endCall;
+       }
+
+       CallMask CallManager::getAvailableCallMask() const
+       {
+               return m_availableCalls;
+       }
+
+       void CallManager::addCallStateHandler(const CallStateHandler handler)
+       {
+               m_event += handler;
+       }
+
+       void CallManager::removeCallStateHandler(const CallStateHandler handler)
+       {
+               m_event -= handler;
+       }
+
+}
diff --git a/src/model/CallManager.h b/src/model/CallManager.h
new file mode 100644 (file)
index 0000000..02aba12
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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_MANAGER_H__
+#define __CALLUI_MODEL_CALL_MANAGER_H__
+
+#include "model/ICallManager.h"
+
+#include "ucl/misc/Event.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class CallManager final : public ICallManager {
+       public:
+               static CallManagerSRef newInstance(const CallClientSRef &client);
+               virtual ~CallManager();
+
+               CallClientSRef getCallClient();
+
+               // 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 CallMask getAvailableCallMask() const override final;
+               virtual void addCallStateHandler(const CallStateHandler handler) override final;
+               virtual void removeCallStateHandler(const CallStateHandler handler) override final;
+
+       private:
+               friend class ucl::RefCountObj<CallManager>;
+               CallManager(const CallClientSRef &callClient);
+
+               ucl::Result prepare();
+               ucl::Result updateCalls();
+               void resetCalls();
+
+       private:
+               CallClientSRef m_client;
+               CallDialerSRef m_dialer;
+               IncomingCallSRef m_incomingCall;
+               ActiveCallSRef m_activeCall;
+               HeldCallSRef m_heldCall;
+               EndCallSRef m_endCall;
+               CallMask m_availableCalls;
+               ucl::Event<CallStateHandler> m_event;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_CALL_MANAGER_H__
diff --git a/src/model/ConferenceCallInfo.cpp b/src/model/ConferenceCallInfo.cpp
new file mode 100644 (file)
index 0000000..2cfd385
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * 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 "ConferenceCallInfo.h"
+
+#include <call-manager-ext.h>
+
+#include "ContactInfo.h"
+
+#include "common.h"
+#include "helpers.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       ConferenceCallInfo::ConferenceCallInfo():
+               m_callId(-1)
+       {
+       }
+
+       ConferenceCallInfo::~ConferenceCallInfo()
+       {
+       }
+
+       ConferenceCallInfoSRef ConferenceCallInfo::newInstance(cm_conf_call_data_t *confCallData)
+       {
+               if (!confCallData) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
+               }
+
+               auto result = makeShared<ConferenceCallInfo>();
+               FAIL_RETURN_VALUE(result->prepare(confCallData), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result ConferenceCallInfo::prepare(cm_conf_call_data_t *confCallData)
+       {
+               Result res = convertCallManagerResult(cm_conf_call_data_get_call_id(confCallData, &m_callId));
+               FAIL_RETURN_VALUE(res, res, "cm_conf_call_data_get_call_id() failed!");
+
+               char *number = nullptr;
+               res = convertCallManagerResult(cm_conf_call_data_get_call_number(confCallData, &number));
+               FAIL_RETURN_VALUE(res, res, "cm_conf_call_data_get_call_number() failed!");
+               m_phoneNum = nz(number);
+               // XXX: According to documentation it must be free, but it leads to crash
+//             free(number);
+
+               int personId = -1;
+               res = convertCallManagerResult(cm_conf_call_data_get_person_id(confCallData, &personId));
+               FAIL_RETURN_VALUE(res, res, "cm_conf_call_data_get_person_id() failed!");
+
+               if (personId >= 0) {
+                       m_contactInfo = ContactInfo::newInstance(personId);
+                       if (!m_contactInfo) {
+                               LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "ContactInfo::newInstance() failed!");
+                       }
+               }
+               return RES_OK;
+       }
+
+       unsigned int ConferenceCallInfo::getCallId()
+       {
+               return m_callId;
+       }
+
+       const std::string &ConferenceCallInfo::getPhoneNumber() const
+       {
+               return m_phoneNum;
+       }
+
+       IContactInfoSRef ConferenceCallInfo::getContactInfo() const
+       {
+               return m_contactInfo;
+       }
+
+}
diff --git a/src/model/ConferenceCallInfo.h b/src/model/ConferenceCallInfo.h
new file mode 100644 (file)
index 0000000..8e2aaeb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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_CONFERENCE_CALL_INFO_H__
+#define __CALLUI_MODEL_CONFERENCE_CALL_INFO_H__
+
+#include <call-manager-ext.h>
+
+#include "model/IConferenceCallInfo.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class ConferenceCallInfo final : public IConferenceCallInfo {
+       public:
+               static ConferenceCallInfoSRef newInstance(cm_conf_call_data_t *confCallData);
+               virtual ~ConferenceCallInfo();
+
+               unsigned int getCallId();
+
+               // IConferenceCallInfo
+
+               virtual const std::string &getPhoneNumber() const override final;
+               virtual IContactInfoSRef getContactInfo() const override final;
+
+       private:
+               friend class ucl::RefCountObj<ConferenceCallInfo>;
+               ConferenceCallInfo();
+
+               ucl::Result prepare(cm_conf_call_data_t *confCallData);
+       private:
+               unsigned int m_callId;
+               std::string m_phoneNum;
+               ContactInfoSRef m_contactInfo;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_CONFERENCE_CALL_INFO_H__
diff --git a/src/model/ContactInfo.cpp b/src/model/ContactInfo.cpp
new file mode 100644 (file)
index 0000000..e0ced61
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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 <call-manager-extension.h>
+#include <contacts.h>
+
+#include "ContactInfo.h"
+
+#include "common.h"
+#include "helpers.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       ContactInfo::ContactInfo(int personId):
+                       m_personId(personId),
+                       m_nameSource(ContactNameSourceType::INVALID)
+       {
+       }
+
+       ContactInfo::~ContactInfo()
+       {
+       }
+
+       ContactInfoSRef ContactInfo::newInstance(int personId)
+       {
+               auto result = makeShared<ContactInfo>(personId);
+               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       inline ContactNameSourceType ContactInfo::convertContactNameSourceType(contacts_display_name_source_type_e cdbType)
+       {
+               switch (cdbType) {
+               case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_INVALID:  return ContactNameSourceType::INVALID;
+               case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_EMAIL:    return ContactNameSourceType::EMAIL;
+               case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NUMBER:   return ContactNameSourceType::NUMBER;
+               case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NICKNAME: return ContactNameSourceType::NICKNAME;
+               case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_COMPANY:  return ContactNameSourceType::COMPANY;
+               case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME:     return ContactNameSourceType::NAME;
+               default:
+                       return ContactNameSourceType::INVALID;
+               }
+       }
+
+       Result ContactInfo::prepare()
+       {
+               DLOG("Contact exists with index [%d]", m_personId);
+
+               contacts_filter_h filter = nullptr;
+               contacts_list_h list = nullptr;
+               contacts_query_h query = nullptr;
+               contacts_record_h record = nullptr;
+
+               contacts_filter_create(_contacts_contact._uri, &filter);
+               contacts_filter_add_int(filter, _contacts_contact.person_id, CONTACTS_MATCH_EQUAL, m_personId);
+               contacts_query_create(_contacts_contact._uri, &query);
+               contacts_query_set_filter(query, filter);
+
+               contacts_db_get_records_with_query(query, 0, 1, &list);
+               contacts_list_get_current_record_p(list, &record);
+
+               if (record) {
+                       char *name = nullptr;
+                       contacts_record_get_str_p(record, _contacts_contact.display_name, &name);
+                       m_name = nz(name);
+
+                       int type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_INVALID;
+                       contacts_record_get_int(record, _contacts_contact.display_source_type, &type);
+                       m_nameSource = convertContactNameSourceType(static_cast<contacts_display_name_source_type_e>(type));
+
+                       int count = 0;
+                       contacts_record_get_child_record_count(record, _contacts_contact.image, &count);
+                       if (count > 0) {
+                               char *imgPath = nullptr;
+                               contacts_record_h childRecord = NULL;
+                               contacts_record_get_child_record_at_p(record, _contacts_contact.image, 0, &childRecord);
+                               contacts_record_get_str_p(childRecord, _contacts_image.path, &imgPath);
+                               m_imagePath = nz(imgPath);
+                       }
+               }
+               contacts_list_destroy(list, true);
+               contacts_filter_destroy(filter);
+               contacts_query_destroy(query);
+
+               DLOG("PersonID [%d]", m_personId);
+               DLOG("Contact name [%s]", m_name.c_str());
+               DLOG("Contact image path [%s]", m_imagePath.c_str());
+
+               return RES_OK;
+       }
+
+       int ContactInfo::getPersonId() const
+       {
+               return m_personId;
+       }
+
+       void ContactInfo::setName(const std::string &name)
+       {
+               m_name = name;
+       }
+
+       void ContactInfo::setImagePath(const std::string &imagePath)
+       {
+               m_imagePath = imagePath;
+       }
+
+       void ContactInfo::setContactNameSourceType(ContactNameSourceType type)
+       {
+               m_nameSource = type;
+       }
+
+       const std::string &ContactInfo::getName() const
+       {
+               return m_name;
+       }
+
+       const std::string &ContactInfo::getImagePath() const
+       {
+               return m_imagePath;
+       }
+
+       ContactNameSourceType ContactInfo::getNameSourceType() const
+       {
+               return m_nameSource;
+       }
+
+}
diff --git a/src/model/ContactInfo.h b/src/model/ContactInfo.h
new file mode 100644 (file)
index 0000000..cd62571
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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_CONTACT_INFO_H__
+#define __CALLUI_MODEL_CONTACT_INFO_H__
+
+#include "contacts_types.h"
+
+#include "model/IContactInfo.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class ContactInfo final : public IContactInfo {
+       public:
+               static ContactInfoSRef newInstance(int personId);
+               virtual ~ContactInfo();
+
+               int getPersonId() const;
+               void setName(const std::string &name);
+               void setImagePath(const std::string &imagePath);
+               void setContactNameSourceType(ContactNameSourceType type);
+
+               // IContactInfo
+
+               virtual const std::string &getName() const override final;
+               virtual const std::string &getImagePath() const override final;
+               virtual ContactNameSourceType getNameSourceType() const override final;
+
+       private:
+               friend class ucl::RefCountObj<ContactInfo>;
+               ContactInfo(int personId);
+
+               ucl::Result prepare();
+               ContactNameSourceType convertContactNameSourceType(contacts_display_name_source_type_e cdbType);
+
+       private:
+               int m_personId;
+               std::string m_name;
+               std::string m_imagePath;
+               ContactNameSourceType m_nameSource;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_CONTACT_INFO_H__
diff --git a/src/model/EndCall.cpp b/src/model/EndCall.cpp
new file mode 100644 (file)
index 0000000..c93ef62
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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 "EndCall.h"
+
+#include "CallClient.h"
+#include "CallManager.h"
+#include "CallInfo.h"
+
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       EndCall::EndCall(CallManager &cm):
+                       m_cm(cm)
+       {
+       }
+
+       EndCall::~EndCall()
+       {
+       }
+
+       EndCallSRef EndCall::newInstance(CallManager &cm, cm_call_data_h callData)
+       {
+               if (!callData) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
+               }
+
+               auto result = makeShared<EndCall>(cm);
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result EndCall::prepare(cm_call_data_h callData)
+       {
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
+               if (!m_callInfo) {
+                       LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
+               }
+               return RES_OK;
+       }
+
+       ICallInfoSCRef EndCall::getInfo() const
+       {
+               return m_callInfo;
+       }
+
+       Result EndCall::callBack()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result EndCall::writeMessage()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+}
diff --git a/src/model/EndCall.h b/src/model/EndCall.h
new file mode 100644 (file)
index 0000000..2ea64ac
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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_END_CALL_H__
+#define __CALLUI_MODEL_END_CALL_H__
+
+#include <call-manager-ext.h>
+
+#include "model/IEndCall.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class CallManager;
+
+       class EndCall final : public IEndCall {
+       public:
+               static EndCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
+               virtual ~EndCall();
+
+               // IEndCall
+
+               virtual ICallInfoSCRef getInfo() const override final;
+               virtual ucl::Result callBack() override final;
+               virtual ucl::Result writeMessage() override final;
+
+       private:
+               friend class ucl::RefCountObj<EndCall>;
+               EndCall(CallManager &cm);
+
+               ucl::Result prepare(cm_call_data_h callData);
+
+       private:
+               CallManager &m_cm;
+               CallInfoSRef m_callInfo;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_END_CALL_H__
diff --git a/src/model/HeldCall.cpp b/src/model/HeldCall.cpp
new file mode 100644 (file)
index 0000000..d5afa10
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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 "HeldCall.h"
+
+#include "CallClient.h"
+#include "CallManager.h"
+#include "CallInfo.h"
+
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       HeldCall::HeldCall(CallManager &cm):
+                       m_cm(cm)
+       {
+       }
+
+       HeldCall::~HeldCall()
+       {
+       }
+
+       HeldCallSRef HeldCall::newInstance(CallManager &cm, cm_call_data_h callData)
+       {
+               if (!callData) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL");
+               }
+
+               auto result = makeShared<HeldCall>(cm);
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result HeldCall::prepare(cm_call_data_h callData)
+       {
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
+               if (!m_callInfo) {
+                       LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
+               }
+               return RES_OK;
+       }
+
+       ICallInfoSCRef HeldCall::getInfo() const
+       {
+               return m_callInfo;
+       }
+
+       Result HeldCall::unhold()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result HeldCall::joinWithActive()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result HeldCall::swapWithActive()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result HeldCall::end()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result HeldCall::split(const IConferenceCallInfoSRef &confCallInfo)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+} /* namespace callui */
diff --git a/src/model/HeldCall.h b/src/model/HeldCall.h
new file mode 100644 (file)
index 0000000..44f8607
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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_HELD_CALL_H__
+#define __CALLUI_MODEL_HELD_CALL_H__
+
+#include <call-manager-ext.h>
+
+#include "model/IHeldCall.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class HeldCall final : public IHeldCall {
+       public:
+               static HeldCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
+               virtual ~HeldCall();
+
+               // IHeldCall
+
+               virtual ICallInfoSCRef getInfo() const override final;
+               virtual ucl::Result unhold() override final;
+               virtual ucl::Result joinWithActive() override final;
+               virtual ucl::Result swapWithActive() override final;
+               virtual ucl::Result end() override final;
+               virtual ucl::Result split(const IConferenceCallInfoSRef &confCallInfo) override final;
+
+       private:
+               friend class ucl::RefCountObj<HeldCall>;
+               HeldCall(CallManager &cm);
+
+               ucl::Result prepare(cm_call_data_h callData);
+
+       private:
+               CallManager &m_cm;
+               CallInfoSRef m_callInfo;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_HELD_CALL_H__
diff --git a/src/model/IncomingCall.cpp b/src/model/IncomingCall.cpp
new file mode 100644 (file)
index 0000000..28cf1b0
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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 "IncomingCall.h"
+
+#include "CallClient.h"
+#include "CallManager.h"
+#include "CallInfo.h"
+
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       IncomingCall::IncomingCall(CallManager &cm):
+                       m_cm(cm)
+       {
+       }
+
+       IncomingCall::~IncomingCall()
+       {
+       }
+
+       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);
+               FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result IncomingCall::prepare(cm_call_data_h callData)
+       {
+               m_callInfo = CallInfo::newInstance(*m_cm.getCallClient(), callData);
+               if (!m_callInfo) {
+                       LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
+               }
+               return RES_OK;
+       }
+
+       ICallInfoSCRef IncomingCall::getInfo() const
+       {
+               return m_callInfo;
+       }
+
+       Result IncomingCall::answer(CallAnswerType type)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result IncomingCall::reject()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result IncomingCall::rejectWithMessage(const std::string &message)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result IncomingCall::stopAlert()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+}
diff --git a/src/model/IncomingCall.h b/src/model/IncomingCall.h
new file mode 100644 (file)
index 0000000..536cdc9
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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_ICOMING_CALL_H__
+#define __CALLUI_MODEL_ICOMING_CALL_H__
+
+#include <call-manager-ext.h>
+
+#include "model/IIncomingCall.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class IncomingCall final : public IIncomingCall {
+       public:
+               static IncomingCallSRef newInstance(CallManager &cm, cm_call_data_h callData);
+               virtual ~IncomingCall();
+
+               // IIncomingCall
+
+               virtual ICallInfoSCRef getInfo() const override final;
+               virtual ucl::Result answer(CallAnswerType type) override final;
+               virtual ucl::Result reject() override final;
+               virtual ucl::Result rejectWithMessage(const std::string &message) override final;
+               virtual ucl::Result stopAlert() override final;
+
+       private:
+               friend class ucl::RefCountObj<IncomingCall>;
+               IncomingCall(CallManager &cm);
+
+               ucl::Result prepare(cm_call_data_h callData);
+
+       private:
+               CallManager &m_cm;
+               CallInfoSRef m_callInfo;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_ICOMING_CALL_H__
diff --git a/src/model/SoundManager.cpp b/src/model/SoundManager.cpp
new file mode 100644 (file)
index 0000000..c2aa137
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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 "SoundManager.h"
+
+#include "CallClient.h"
+
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       SoundManager::SoundManager(const CallClientSRef &client):
+                       m_client(client)
+       {
+       }
+
+       SoundManager::~SoundManager()
+       {
+       }
+
+       SoundManagerSRef SoundManager::newInstance(const CallClientSRef &client)
+       {
+               auto result = makeShared<SoundManager>(client);
+               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result SoundManager::prepare()
+       {
+               return RES_OK;
+       }
+
+       Result SoundManager::setSpeakerState(bool isEnable)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::setBluetoothState(bool isEnable)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       AudioStateType SoundManager::getAudioState() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::setMuteState(bool isEnable)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       bool SoundManager::getMuteState() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::startDtmf(const unsigned char dtmfDigit)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::stopDtmf()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::addAudioStateChangeHandler(AudioStateHandler handler)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::removeAudioStateChangeHandler(AudioStateHandler handler)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::addMuteStateChangeHandler(MuteStateHandler handler)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result SoundManager::removeMuteStateChangeHandler(MuteStateHandler handler)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+}
diff --git a/src/model/SoundManager.h b/src/model/SoundManager.h
new file mode 100644 (file)
index 0000000..deed388
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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_SOUND_MANAGER_H__
+#define __CALLUI_MODEL_SOUND_MANAGER_H__
+
+#include "model/ISoundManager.h"
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class SoundManager final : public ISoundManager {
+       public:
+               static SoundManagerSRef newInstance(const CallClientSRef &client);
+               virtual ~SoundManager();
+
+               virtual ucl::Result setSpeakerState(bool isEnable) override final;
+               virtual ucl::Result setBluetoothState(bool isEnable) override final;
+               virtual AudioStateType getAudioState() const override final;
+               virtual ucl::Result setMuteState(bool isEnable) override final;
+               virtual bool getMuteState() const override final;
+               virtual ucl::Result startDtmf(const unsigned char dtmfDigit) override final;
+               virtual ucl::Result stopDtmf() override final;
+               virtual ucl::Result addAudioStateChangeHandler(AudioStateHandler handler) override final;
+               virtual ucl::Result removeAudioStateChangeHandler(AudioStateHandler handler) override final;
+               virtual ucl::Result addMuteStateChangeHandler(MuteStateHandler handler) override final;
+               virtual ucl::Result removeMuteStateChangeHandler(MuteStateHandler handler) override final;
+
+       private:
+               friend class ucl::RefCountObj<SoundManager>;
+               SoundManager(const CallClientSRef &client);
+
+               ucl::Result prepare();
+       private:
+               CallClientSRef m_client;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_SOUND_MANAGER_H__
diff --git a/src/model/helpers.h b/src/model/helpers.h
new file mode 100644 (file)
index 0000000..409ef74
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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_HELPERS_H__
+#define __CALLUI_MODEL_HELPERS_H__
+
+#include "model/types.h"
+
+namespace callui {
+
+       ucl::Result convertCallManagerResult(int cmRes);
+}
+
+#include "helpers.hpp"
+
+#endif // __CALLUI_MODEL_HELPERS_H__
diff --git a/src/model/helpers.hpp b/src/model/helpers.hpp
new file mode 100644 (file)
index 0000000..040b63c
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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 <call-manager.h>
+
+namespace callui {
+
+       inline ucl::Result convertCallManagerResult(int cmRes)
+       {
+               switch (cmRes) {
+               case CM_ERROR_NONE:               return ucl::RES_OK;
+               case CM_ERROR_OUT_OF_MEMORY:      return ucl::RES_OUT_OF_MEMORY;
+               case CM_ERROR_INVALID_PARAMETER:  return ucl::RES_INVALID_ARGUMENTS;
+               case CM_ERROR_PERMISSION_DENIED:  return RES_PERMISSION_DENIED;
+               case CM_ERROR_NOT_SUPPORTED:      return ucl::RES_NOT_SUPPORTED;
+               case CM_ERROR_NOT_REGISTERED:     return ucl::RES_FATAL;
+               case CM_ERROR_ALREADY_REGISTERED: return RES_ALREADY_REGISTERED;
+               case CM_ERROR_OPERATION_FAILED:   return RES_OPERATION_FAILED;
+               default:
+                       return ucl::RES_FALSE;
+               }
+       }
+}
diff --git a/src/model/implTypes.h b/src/model/implTypes.h
new file mode 100644 (file)
index 0000000..213ebb4
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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_IMPL_TYPES_H__
+#define __CALLUI_MODEL_IMPL_TYPES_H__
+
+#include "ucl/util/memory.h"
+
+namespace callui {
+
+       UCL_DECLARE_REF_ALIASES(CallClient);
+
+       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);
+       UCL_DECLARE_REF_ALIASES(HeldCall);
+       UCL_DECLARE_REF_ALIASES(EndCall);
+
+       UCL_DECLARE_REF_ALIASES(CallInfo);
+       UCL_DECLARE_REF_ALIASES(ContactInfo);
+       UCL_DECLARE_REF_ALIASES(ConferenceCallInfo);
+
+}
+
+#endif // __CALLUI_MODEL_IMPL_TYPES_H__
diff --git a/src/types.cpp b/src/types.cpp
new file mode 100644 (file)
index 0000000..5b3d286
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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 "ucl/util/logging.h"
+#include "types.h"
+
+ucl::ResultData getUCLResultData(const ucl::Result result)
+{
+       switch (result.value) {
+       case callui::RES_PERMISSION_DENIED:  return {"RES_PERMISSION_DENIED", DLOG_FATAL};
+       case callui::RES_NOT_REGISTERED:     return {"RES_NOT_REGISTERED", DLOG_FATAL};
+       case callui::RES_ALREADY_REGISTERED: return {"RES_ALREADY_REGISTERED", DLOG_FATAL};
+       case callui::RES_OPERATION_FAILED:   return {"RES_OPERATION_FAILED", DLOG_FATAL};
+       default:
+               return ucl::getResultData(result);
+       }
+}
index d012c6b34e9bc031ede0c556c59b0c34f74f1fd5..7b4254418697dd585637bc2e0c4d51a6be5aec33 100644 (file)
@@ -5,7 +5,7 @@
 #define UCL_DEBUG
 #endif
 
-#define UCL_DEFINE_GET_UCL_RESULT_DATA 1
+#define UCL_DEFINE_GET_UCL_RESULT_DATA 0
 
 #define UCL_LOG_LEVEL_VERBOSE 6
 #define UCL_LOG_LEVEL_DEBUG   5