+++ /dev/null
-/*
- * 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_MAIN_INSTANCE_H__
-#define __CALLUI_MAIN_INSTANCE_H__
-
-#include "types.h"
-
-#include "ucl/appfw/IInstance.h"
-#include "ucl/appfw/IInstanceAppControlExt.h"
-
-#include "ucl/appfw/SysEventProvider.h"
-
-#include "model/ICall.h"
-
-namespace callui {
-
- class Instance :
- public ucl::IInstance,
- public ucl::IInstanceAppControlExt {
- public:
- Instance(ucl::SysEventProvider &sysEventProvider);
-
- // For testing
- ucl::WindowWRef getWindow();
- ucl::IInstanceContext *getContext();
- ICallWRef getCall();
-
- // IInstance //
-
- virtual ucl::Result onCreate(
- ucl::IInstanceContext *context) final override;
- virtual void onPause() final override;
- virtual void onResume() final override;
-
- // IInstanceAppControlExt //
-
- virtual void onAppControl(app_control_h appControl) final override;
-
- private:
- void onBack(Evas_Object *obj, void *event_info);
- void onSysEvent(const ucl::SysEvent sysEvent);
-
- private:
- ucl::SysEventProvider &m_sysEventProvider;
- ucl::IInstanceContext *m_context;
- ucl::WindowSRef m_win;
- ICallSRef m_call;
- };
-}
-
-#endif // __CALLUI_MAIN_INSTANCE_H__
+++ /dev/null
-/*
- * 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_MAIN_INSTANCE_MANAGER_H__
-#define __CALLUI_MAIN_INSTANCE_MANAGER_H__
-
-#include "types.h"
-
-#include "ucl/appfw/InstanceManagerBase.h"
-
-namespace callui {
-
- class InstanceManager : public ucl::InstanceManagerBase {
- public:
- InstanceManager();
-
- // ucl::InstanceManagerBase //
-
- virtual ucl::IInstanceSRef newInstance() const final override;
- };
-}
-
-#endif // __CALLUI_MAIN_INSTANCE_MANAGER_H__
--- /dev/null
+/*
+ * 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_PRESENTERS_INSTANCE_H__
+#define __CALLUI_PRESENTERS_INSTANCE_H__
+
+#include "types.h"
+
+#include "ucl/appfw/IInstance.h"
+#include "ucl/appfw/IInstanceAppControlExt.h"
+
+#include "ucl/appfw/SysEventProvider.h"
+
+#include "model/ICall.h"
+
+namespace callui {
+
+ class Instance :
+ public ucl::IInstance,
+ public ucl::IInstanceAppControlExt {
+ public:
+ Instance(ucl::SysEventProvider &sysEventProvider);
+
+ // For testing
+ ucl::WindowWRef getWindow();
+ ucl::IInstanceContext *getContext();
+ ICallWRef getCall();
+
+ // IInstance //
+
+ virtual ucl::Result onCreate(
+ ucl::IInstanceContext *context) final override;
+ virtual void onPause() final override;
+ virtual void onResume() final override;
+
+ // IInstanceAppControlExt //
+
+ virtual void onAppControl(app_control_h appControl) final override;
+
+ private:
+ void onBack(Evas_Object *obj, void *event_info);
+ void onSysEvent(const ucl::SysEvent sysEvent);
+
+ private:
+ ucl::SysEventProvider &m_sysEventProvider;
+ ucl::IInstanceContext *m_context;
+ ucl::WindowSRef m_win;
+ ICallSRef m_call;
+ };
+}
+
+#endif // __CALLUI_PRESENTERS_INSTANCE_H__
--- /dev/null
+/*
+ * 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_PRESENTERS_INSTANCE_MANAGER_H__
+#define __CALLUI_PRESENTERS_INSTANCE_MANAGER_H__
+
+#include "types.h"
+
+#include "ucl/appfw/InstanceManagerBase.h"
+
+namespace callui {
+
+ class InstanceManager : public ucl::InstanceManagerBase {
+ public:
+ InstanceManager();
+
+ // ucl::InstanceManagerBase //
+
+ virtual ucl::IInstanceSRef newInstance() const final override;
+ };
+}
+
+#endif // __CALLUI_PRESENTERS_INSTANCE_MANAGER_H__
--- /dev/null
+/*
+ * 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/appfw/UIApp.h"
+
+#include "presenters/InstanceManager.h"
+
+#include "common.h"
+
+using namespace ucl;
+using namespace callui;
+
+int main(int argc, char *argv[])
+{
+ InstanceManager mgr;
+ const int ret = UIApp(mgr).run(argc, argv);
+ ILOG("ret: %d", ret);
+ return ret;
+}
+++ /dev/null
-/*
- * 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 "main/Instance.h"
-
-#include "ucl/util/memory.h"
-
-#include <system_settings.h>
-#include <efl_extension.h>
-
-#include "model/CallBuilder.h"
-#include "model/ICallManager.h"
-#include "model/IIncomingCall.h"
-#include "model/IActiveCall.h"
-#include "model/IHeldCall.h"
-#include "model/IEndCall.h"
-#include "model/ICallInfo.h"
-#include "model/ICallListener.h"
-
-#include "../common.h"
-
-namespace callui {
-
- using namespace ucl;
-
- // For testing
- UCL_DECLARE_REF_ALIASES(Listener);
- class Listener : public ICallListener {
- public:
- static ListenerSRef newInstance(Instance &instance)
- {
- return makeShared<Listener>(instance);
- }
-
- virtual void onCallEvent(CallEventType type) override final
- {
- WindowWRef win = m_instance.getWindow();
- ICallWRef 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(CallErr err) override final
- {
- ILOG();
- }
-
- private:
- friend class ucl::RefCountObj<Listener>;
- Listener(Instance &instance):
- m_instance(instance)
- {
- ILOG();
- }
-
- 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:
- Instance &m_instance;
- };
-
- Instance::Instance(SysEventProvider &sysEventProvider) :
- m_sysEventProvider(sysEventProvider),
- m_context(nullptr)
- {
- }
-
- Result Instance::onCreate(IInstanceContext *const context)
- {
- m_context = context;
-
- m_win = m_context->getWindow();
-
- m_sysEventProvider.addEventHandler(
- DELEGATE(Instance::onSysEvent, this));
-
- eext_object_event_callback_add(*m_win, EEXT_CALLBACK_BACK,
- CALLBACK_A(Instance::onBack), this);
-
- // For testing
- m_call = CallBuilder().build();
- if (!m_call) {
- LOG_RETURN(RES_FAIL, "m_call is NULL");
- }
-
- static ListenerSRef listener = Listener::newInstance(*this);
- m_call->setListener(listener);
-
- return RES_OK;
- }
-
- void Instance::onPause()
- {
- ILOG("PAUSED");
- }
-
- void Instance::onResume()
- {
- ILOG("RESUMED");
- }
-
- void Instance::onAppControl(app_control_h appControl)
- {
- char *op = {};
- app_control_get_operation(appControl, &op);
- ILOG("operation: %s", op);
- free(op);
-
- // 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();
- }
- }
- }
-
- void Instance::onBack(Evas_Object *obj, void *event_info)
- {
- ILOG("Exiting the application...");
- m_context->exitApp();
- }
-
- void Instance::onSysEvent(const SysEvent sysEvent)
- {
- switch(sysEvent) {
- case SysEvent::LANGUAGE_CHANGED:
- ILOG("SysEvent::LANGUAGE_CHANGED");
- {
- char *locale = NULL;
- system_settings_get_value_string(
- SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
- elm_language_set(locale);
- free(locale);
- }
- break;
- default:
- ILOG("sysEvent: %d", sysEvent);
- break;
- }
- }
-
- WindowWRef Instance::getWindow()
- {
- return m_win;
- }
-
- IInstanceContext *Instance::getContext()
- {
- return m_context;
- }
-
- ICallWRef Instance::getCall()
- {
- return m_call;
- }
-}
+++ /dev/null
-/*
- * 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 "main/InstanceManager.h"
-
-#include "main/Instance.h"
-
-namespace callui {
-
- using namespace ucl;
-
- InstanceManager::InstanceManager() :
- InstanceManagerBase(AppParams().
- set(AppParam::WINDOW_NAME, WINDOW_NAME).
- set(AppParam::BASE_SCALE, BASE_SCALE))
- {
- }
-
- IInstanceSRef InstanceManager::newInstance() const
- {
- return makeShared<Instance>(getSysEventProvider());
- }
-}
+++ /dev/null
-/*
- * 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/appfw/UIApp.h"
-
-#include "main/InstanceManager.h"
-
-#include "../common.h"
-
-using namespace ucl;
-using namespace callui;
-
-int main(int argc, char *argv[])
-{
- InstanceManager mgr;
- const int ret = UIApp(mgr).run(argc, argv);
- ILOG("ret: %d", ret);
- return ret;
-}
--- /dev/null
+/*
+ * 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 "presenters/Instance.h"
+
+#include "ucl/util/memory.h"
+
+#include <system_settings.h>
+#include <efl_extension.h>
+
+#include "model/CallBuilder.h"
+#include "model/ICallManager.h"
+#include "model/IIncomingCall.h"
+#include "model/IActiveCall.h"
+#include "model/IHeldCall.h"
+#include "model/IEndCall.h"
+#include "model/ICallInfo.h"
+#include "model/ICallListener.h"
+
+#include "../common.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ // For testing
+ UCL_DECLARE_REF_ALIASES(CallListener);
+ class CallListener : public ICallListener {
+ public:
+ static CallListenerSRef newInstance(Instance &instance)
+ {
+ return makeShared<CallListener>(instance);
+ }
+
+ virtual void onCallEvent(CallEventType type) override final
+ {
+ WindowWRef win = m_instance.getWindow();
+ ICallWRef 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(CallErr err) override final
+ {
+ ILOG();
+ }
+
+ private:
+ friend class ucl::RefCountObj<CallListener>;
+ CallListener(Instance &instance):
+ m_instance(instance)
+ {
+ ILOG();
+ }
+
+ 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:
+ Instance &m_instance;
+ };
+
+ Instance::Instance(SysEventProvider &sysEventProvider) :
+ m_sysEventProvider(sysEventProvider),
+ m_context(nullptr)
+ {
+ }
+
+ Result Instance::onCreate(IInstanceContext *const context)
+ {
+ m_context = context;
+
+ m_win = m_context->getWindow();
+
+ m_sysEventProvider.addEventHandler(
+ DELEGATE(Instance::onSysEvent, this));
+
+ eext_object_event_callback_add(*m_win, EEXT_CALLBACK_BACK,
+ CALLBACK_A(Instance::onBack), this);
+
+ // For testing
+ m_call = CallBuilder().build();
+ if (!m_call) {
+ LOG_RETURN(RES_FAIL, "m_call is NULL");
+ }
+
+ static CallListenerSRef callListener =
+ CallListener::newInstance(*this);
+ m_call->setListener(callListener);
+
+ return RES_OK;
+ }
+
+ void Instance::onPause()
+ {
+ ILOG("PAUSED");
+ }
+
+ void Instance::onResume()
+ {
+ ILOG("RESUMED");
+ }
+
+ void Instance::onAppControl(app_control_h appControl)
+ {
+ char *op = {};
+ app_control_get_operation(appControl, &op);
+ ILOG("operation: %s", op);
+ free(op);
+
+ // For testing
+ Result res = m_call->processAppControl(appControl);
+ if (res != RES_OK) {
+ ELOG("processAppControl() failed!");
+ ICallManagerSRef callManager = m_call->getCallManager();
+ if (!callManager->getAvailableCalls()) {
+ ILOG("No calls. Exit application");
+ m_context->exitApp();
+ }
+ }
+ }
+
+ void Instance::onBack(Evas_Object *obj, void *event_info)
+ {
+ ILOG("Exiting the application...");
+ m_context->exitApp();
+ }
+
+ void Instance::onSysEvent(const SysEvent sysEvent)
+ {
+ switch(sysEvent) {
+ case SysEvent::LANGUAGE_CHANGED:
+ ILOG("SysEvent::LANGUAGE_CHANGED");
+ {
+ char *locale = NULL;
+ system_settings_get_value_string(
+ SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+ }
+ break;
+ default:
+ ILOG("sysEvent: %d", sysEvent);
+ break;
+ }
+ }
+
+ WindowWRef Instance::getWindow()
+ {
+ return m_win;
+ }
+
+ IInstanceContext *Instance::getContext()
+ {
+ return m_context;
+ }
+
+ ICallWRef Instance::getCall()
+ {
+ return m_call;
+ }
+
+}
--- /dev/null
+/*
+ * 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 "presenters/InstanceManager.h"
+
+#include "presenters/Instance.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ InstanceManager::InstanceManager() :
+ InstanceManagerBase(AppParams().
+ set(AppParam::WINDOW_NAME, WINDOW_NAME).
+ set(AppParam::BASE_SCALE, BASE_SCALE))
+ {
+ }
+
+ IInstanceSRef InstanceManager::newInstance() const
+ {
+ return makeShared<Instance>(getSysEventProvider());
+ }
+}