+++ /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_MODEL_CALL_BUILDER_H__
-#define __CALLUI_MODEL_CALL_BUILDER_H__
-
-#include "types.h"
-
-namespace callui {
-
- class CallBuilder {
- public:
- CallBuilder();
- ICallSRef build() const;
- };
-
-}
-
-#endif // __CALLUI_MODEL_CALL_BUILDER_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_MODEL_CALL_UI_BUILDER_H__
+#define __CALLUI_MODEL_CALL_UI_BUILDER_H__
+
+#include "types.h"
+
+namespace callui {
+
+ class CallUIBuilder {
+ public:
+ CallUIBuilder();
+ ICallUISRef build() const;
+ };
+
+}
+
+#endif // __CALLUI_MODEL_CALL_UI_BUILDER_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_MODEL_I_CALL_H__
-#define __CALLUI_MODEL_I_CALL_H__
-
-#include <app_control.h>
-
-#include "types.h"
-
-namespace callui {
-
- class ICall : public ucl::Polymorphic {
- public:
- virtual void setListener(const ICallListenerWRef &listener) = 0;
- virtual ucl::Result processAppControl(app_control_h appControl) = 0;
- virtual ISoundManagerSRef getSoundManager() = 0;
- virtual ICallManagerSRef getCallManager() = 0;
- virtual IIndicatorStateProviderSRef getIndicatorStateProvider() = 0;
- };
-
-}
-
-#endif // __CALLUI_MODEL_I_CALL_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_MODEL_I_CALL_UI_H__
+#define __CALLUI_MODEL_I_CALL_UI_H__
+
+#include <app_control.h>
+
+#include "types.h"
+
+namespace callui {
+
+ class ICallUI : public ucl::Polymorphic {
+ public:
+ virtual void setListener(const ICallListenerWRef &listener) = 0;
+ virtual ucl::Result processAppControl(app_control_h appControl) = 0;
+ virtual ISoundManagerSRef getSoundManager() = 0;
+ virtual ICallManagerSRef getCallManager() = 0;
+ virtual IIndicatorStateProviderSRef getIndicatorStateProvider() = 0;
+ };
+}
+
+#endif // __CALLUI_MODEL_I_CALL_UI_H__
HD_VOICE
};
- UCL_DECLARE_REF_ALIASES(ICall);
+ UCL_DECLARE_REF_ALIASES(ICallUI);
UCL_DECLARE_REF_ALIASES(ICallListener);
UCL_DECLARE_REF_ALIASES(ICallManager);
ucl::SysEventProvider &m_sysEventProvider;
ucl::IInstanceContext *m_context;
- ICallSRef m_call;
+ ICallUISRef m_call;
ucl::WindowSRef m_win;
ucl::NaviframeSRef m_navi;
Builder();
~Builder();
Builder &setNaviframe(const ucl::NaviframeSRef &navi);
- Builder &setCall(const ICallSRef &call);
+ Builder &setCallUI(const ICallUISRef &call);
MainPageSRef build(const ExitRequestHandler handler) const;
private:
ucl::NaviframeSRef m_navi;
- ICallSRef m_call;
+ ICallUISRef m_call;
};
private:
MainPage(ucl::IRefCountObj &rc,
const ucl::NaviframeSRef &navi,
const ExitRequestHandler handler,
- const ICallSRef &call);
+ const ICallUISRef &call);
virtual ~MainPage();
ucl::Result doPrepare(ucl::NaviItem &item);
ucl::LayoutSRef m_rmLy;
ucl::StyledWidgetSRef m_bottomBtn;
- ICallSRef m_call;
+ ICallUISRef m_call;
ICallManagerSRef m_cm;
IndicatorPresenterSRef m_indicator;
CallInfoPresenterSRef m_callInfoPrs;
+++ /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 "Call.h"
-
-#include <app_control.h>
-
-#include "model/ICallListener.h"
-#include "model/IIncomingCall.h"
-#include "model/IActiveCall.h"
-#include "model/IHeldCall.h"
-#include "model/IEndCall.h"
-#include "model/ICallInfo.h"
-
-#include "CallClient.h"
-#include "CallManager.h"
-#include "SoundManager.h"
-
-#include "VoiceControlStateProvider.h"
-#include "IndicatorStateProvider.h"
-
-#include "ConnectionStateSource.h"
-#include "RssiStateSource.h"
-#include "BatteryStateSource.h"
-#include "VoiceControlStateSource.h"
-#include "SimSlotStateSource.h"
-#include "HdVoiceStateSource.h"
-
-#include "common.h"
-
-namespace callui {
-
- using namespace ucl;
-
- Call::Call(IRefCountObj &rc):
- RefCountAware(&rc)
- {
- }
-
- Call::~Call()
- {
- }
-
- void Call::setListener(const ICallListenerWRef &listener)
- {
- m_listener = listener;
- }
-
- Result Call::processAppControl(app_control_h appControl)
- {
- if (!appControl) {
- FAIL_RETURN(RES_INVALID_ARGUMENTS, "appControl is NULL");
- }
-
- Result ret = RES_FAIL;
-
- char *operation = nullptr;
- int res = app_control_get_operation(appControl, &operation);
- if (res != APP_CONTROL_ERROR_NONE) {
- LOG_RETURN(RES_FAIL, "app_control_get_operation() failed!");
- }
- if (!operation) {
- LOG_RETURN(RES_FAIL, "operation is NULL!");
- }
-
- char *uri = nullptr;
- res = app_control_get_uri(appControl, &uri);
- if (res != APP_CONTROL_ERROR_NONE) {
- free(operation);
- LOG_RETURN(RES_FAIL, "app_control_get_uri() failed!");
- }
- if (!uri) {
- free(operation);
- LOG_RETURN(RES_FAIL, "uri is NULL!");
- }
-
- if (strcmp(operation, APP_CONTROL_OPERATION_CALL) || strncmp(uri, "tel:", 4)) {
- free(operation);
- free(uri);
- LOG_RETURN(RES_FAIL, "Not processed operation!");
- }
-
- char *tmp = nullptr;
- if (!strncmp(uri, "tel:MT", 6)) {
- res = app_control_get_extra_data(appControl, "sim_slot", &tmp);
- if (res != APP_CONTROL_ERROR_NONE) {
- ELOG("app_control_get_extra_data() failed!");
- }
- if (!tmp) {
- free(operation);
- free(uri);
- LOG_RETURN(RES_FAIL, "Sim slot is NULL!");
- }
- DLOG("Sim slot [%s]", tmp);
- free(tmp);
-
- ret = m_callManager->processIncomingCall(
- convertCMSimSlot(static_cast<cm_multi_sim_slot_type_e>(atoi(tmp))));
-
- } else {
- tmp = static_cast<char *>(uri + 4);
- DLOG("number [%s]", tmp);
-
- if (!tmp) {
- free(operation);
- free(uri);
- LOG_RETURN(RES_FAIL, "number is NULL");
- }
-
- ret = m_callManager->processOutgoingCall(tmp);
- }
-
- free(operation);
- free(uri);
-
- return ret;
- }
-
- Result Call::prepare()
- {
- auto callClient = CallClient::newInstance();
- if (!callClient) {
- LOG_RETURN(RES_FAIL,
- "Client::newInstance() failed!");
- }
-
- m_callManager = CallManager::newInstance(callClient, asWeak(*this));
- if (!m_callManager) {
- LOG_RETURN(RES_FAIL,
- "CallManager::newInstance() failed!");
- }
-
- m_soundManager = SoundManager::newInstance(callClient);
- if (!m_soundManager) {
- LOG_RETURN(RES_FAIL,
- "SoundManage::newInstance() failed!");
- }
-
- m_voiceControlPrv = VoiceControlStateProvider::newInstance();
- if (!m_voiceControlPrv) {
- LOG_RETURN(RES_FAIL,
- "VoiceControlStateProvider::newInstance() failed!");
- }
-
- FAIL_RETURN(initInidcatorStateProvider(),
- "Init Indicator State Provider failed!");
-
- return RES_OK;
- }
-
- Result Call::initInidcatorStateProvider()
- {
- m_indicatorStPrv = IndicatorStateProvider::newInstance();
- if (!m_indicatorStPrv) {
- LOG_RETURN(RES_FAIL, "IndicatorStateProvider::newInstance() failed!");
- }
-
- auto connStateSource = ConnectionStateSource::newInstance();
- if (!connStateSource) {
- LOG_RETURN(RES_FAIL,
- "ConnectionStateSource::newInstance() failed!");
- }
- FAIL_RETURN(m_indicatorStPrv->setStateSource(
- IndicatorProperty::NW_CONNECTION, connStateSource),
- "setStateSource() failed!");
-
- auto rssiStSrc = RssiStateSource::newInstance();
- if (!rssiStSrc) {
- LOG_RETURN(RES_FAIL,
- "RssiStateSource::newInstance() failed!");
- }
- FAIL_RETURN(m_indicatorStPrv->setStateSource(
- IndicatorProperty::RSSI, rssiStSrc),
- "setStateSource() failed!");
-
- auto batteryStSrc = BatteryStateSource::newInstance();
- if (!batteryStSrc) {
- LOG_RETURN(RES_FAIL,
- "BatteryStateSource::newInstance() failed!");
- }
- FAIL_RETURN(m_indicatorStPrv->setStateSource(
- IndicatorProperty::BATTERY, batteryStSrc),
- "setStateSource() failed!");
-
- auto voiceControlStSrc =
- VoiceControlStateSource::newInstance(m_voiceControlPrv);
- if (!voiceControlStSrc) {
- LOG_RETURN(RES_FAIL,
- "VoiceControlStateSource::newInstance() failed!");
- }
- FAIL_RETURN(m_indicatorStPrv->setStateSource(
- IndicatorProperty::VOICE_CONTROL, voiceControlStSrc),
- "setStateSource() failed!");
-
- m_simSlotStSrc = makeShared<SimSlotStateSource>(
- m_callManager->getSimSlot(), getForwardedCallStatus());
- FAIL_RETURN(m_indicatorStPrv->setStateSource(
- IndicatorProperty::SIM_SLOT, m_simSlotStSrc),
- "setStateSource() failed!");
-
- m_hdCallStSrc = makeShared<HdVoiceStateSource>(
- getHDVoiceStatus());
- FAIL_RETURN(m_indicatorStPrv->setStateSource(
- IndicatorProperty::HD_VOICE, m_hdCallStSrc),
- "setStateSource() failed!");
-
- return RES_OK;
- }
-
- ICallManagerSRef Call::getCallManager()
- {
- return m_callManager;
- }
-
- ISoundManagerSRef Call::getSoundManager()
- {
- return m_soundManager;
- }
-
- IIndicatorStateProviderSRef Call::getIndicatorStateProvider()
- {
- return m_indicatorStPrv;
- }
-
- ICallInfoSCRef Call::getCurrentCallInfo() const
- {
- CallMask calls = m_callManager->getAvailableCalls();
- if (!calls) {
- DLOG("No available calls");
- return {};
- } else if (calls & CALL_FLAG_INCOMING) {
- return m_callManager->getIncomingCall()->getInfo();
- } else if (calls & CALL_FLAG_ACTIVE) {
- return m_callManager->getActiveCall()->getInfo();
- } else if (calls & CALL_FLAG_HELD) {
- return m_callManager->getHeldCall()->getInfo();
- } else if (calls & CALL_FLAG_END) {
- return m_callManager->getEndCall()->getInfo();
- }
- return {};
- }
-
- bool Call::getHDVoiceStatus() const
- {
- ICallInfoSCRef info = getCurrentCallInfo();
- if (info) {
- return info->isHDVoice();
- }
- return false;
- }
-
- bool Call::getForwardedCallStatus() const
- {
- ICallInfoSCRef info = getCurrentCallInfo();
- if (info) {
- return info->isForwarded();
- }
- return false;
- }
-
- void Call::updateHdVoiceStateSource()
- {
- m_hdCallStSrc->updateState(getHDVoiceStatus());
- }
-
- void Call::updateSimSlotStateSource()
- {
- m_simSlotStSrc->updateSimSlot(m_callManager->getSimSlot(),
- getForwardedCallStatus());
- }
-
- void Call::onCallEvent(CallEventType type)
- {
- updateSimSlotStateSource();
- updateHdVoiceStateSource();
-
- if (const auto listener = m_listener.lock()) {
- listener->onCallEvent(type);
- }
- }
-
- void Call::onError(CallManagerErr err)
- {
- auto callErr = CallErr::DIAL_FAIL;
- switch (err) {
- case CallManagerErr::DIAL_CANCEL:
- callErr = CallErr::DIAL_CANCEL;
- break;
- case CallManagerErr::DIAL_FLIGHT_MODE:
- callErr = CallErr::DIAL_FLIGHT_MODE;
- break;
- default:
- callErr = CallErr::DIAL_FAIL;
- break;
- }
-
- if (const auto listener = m_listener.lock()) {
- listener->onError(callErr);
- }
- }
-
-}
+++ /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_MODEL_CALL_H__
-#define __CALLUI_MODEL_CALL_H__
-
-#include "model/ICall.h"
-#include "ICallManagerListener.h"
-
-#include <app_control.h>
-
-#include "types.h"
-
-namespace callui {
-
- UCL_DECLARE_REF_ALIASES(CallManager);
- UCL_DECLARE_REF_ALIASES(SoundManager);
-
- class Call final :
- public ucl::RefCountAware,
- public ICall,
- public ICallManagerListener {
- public:
- virtual ~Call();
-
- // ICall
-
- virtual void setListener(const ICallListenerWRef &listener) override final;
- virtual ucl::Result processAppControl(app_control_h appControl) override final;
- virtual ISoundManagerSRef getSoundManager() override final;
- virtual ICallManagerSRef getCallManager() override final;
- virtual IIndicatorStateProviderSRef getIndicatorStateProvider() override final;
-
- // ICallManagerListener
-
- virtual void onCallEvent(CallEventType type) override final;
- virtual void onError(CallManagerErr err) override final;
-
- private:
- friend class CallBuilder;
- friend class ucl::ReffedObj<Call>;
- Call(ucl::IRefCountObj &rc);
-
- ucl::Result prepare();
-
- ucl::Result initInidcatorStateProvider();
-
- void updateHdVoiceStateSource();
- void updateSimSlotStateSource();
- ICallInfoSCRef getCurrentCallInfo() const;
- bool getHDVoiceStatus() const;
- bool getForwardedCallStatus() const;
-
- private:
- CallManagerSRef m_callManager;
- SoundManagerSRef m_soundManager;
- ICallListenerWRef m_listener;
- SimSlotStateSourceSRef m_simSlotStSrc;
- HdVoiceStateSourceSRef m_hdCallStSrc;
- IndicatorStateProviderSRef m_indicatorStPrv;
- VoiceControlStateProviderSRef m_voiceControlPrv;
- };
-
-}
-
-#endif // __CALLUI_MODEL_CALL_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 "model/CallBuilder.h"
-
-#include "Call.h"
-
-#include "common.h"
-
-namespace callui {
-
- using namespace ucl;
-
- CallBuilder::CallBuilder()
- {
- }
-
- ICallSRef CallBuilder::build() const
- {
- auto result = makeShared<Call>();
- FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
- return result;
- }
-
-}
--- /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 "CallUI.h"
+
+#include <app_control.h>
+
+#include "model/ICallListener.h"
+#include "model/IIncomingCall.h"
+#include "model/IActiveCall.h"
+#include "model/IHeldCall.h"
+#include "model/IEndCall.h"
+#include "model/ICallInfo.h"
+
+#include "CallClient.h"
+#include "CallManager.h"
+#include "SoundManager.h"
+
+#include "VoiceControlStateProvider.h"
+#include "IndicatorStateProvider.h"
+
+#include "ConnectionStateSource.h"
+#include "RssiStateSource.h"
+#include "BatteryStateSource.h"
+#include "VoiceControlStateSource.h"
+#include "SimSlotStateSource.h"
+#include "HdVoiceStateSource.h"
+
+#include "common.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ CallUI::CallUI(IRefCountObj &rc):
+ RefCountAware(&rc)
+ {
+ }
+
+ CallUI::~CallUI()
+ {
+ }
+
+ void CallUI::setListener(const ICallListenerWRef &listener)
+ {
+ m_listener = listener;
+ }
+
+ Result CallUI::processAppControl(app_control_h appControl)
+ {
+ if (!appControl) {
+ FAIL_RETURN(RES_INVALID_ARGUMENTS, "appControl is NULL");
+ }
+
+ Result ret = RES_FAIL;
+
+ char *operation = nullptr;
+ int res = app_control_get_operation(appControl, &operation);
+ if (res != APP_CONTROL_ERROR_NONE) {
+ LOG_RETURN(RES_FAIL, "app_control_get_operation() failed!");
+ }
+ if (!operation) {
+ LOG_RETURN(RES_FAIL, "operation is NULL!");
+ }
+
+ char *uri = nullptr;
+ res = app_control_get_uri(appControl, &uri);
+ if (res != APP_CONTROL_ERROR_NONE) {
+ free(operation);
+ LOG_RETURN(RES_FAIL, "app_control_get_uri() failed!");
+ }
+ if (!uri) {
+ free(operation);
+ LOG_RETURN(RES_FAIL, "uri is NULL!");
+ }
+
+ if (strcmp(operation, APP_CONTROL_OPERATION_CALL) || strncmp(uri, "tel:", 4)) {
+ free(operation);
+ free(uri);
+ LOG_RETURN(RES_FAIL, "Not processed operation!");
+ }
+
+ char *tmp = nullptr;
+ if (!strncmp(uri, "tel:MT", 6)) {
+ res = app_control_get_extra_data(appControl, "sim_slot", &tmp);
+ if (res != APP_CONTROL_ERROR_NONE) {
+ ELOG("app_control_get_extra_data() failed!");
+ }
+ if (!tmp) {
+ free(operation);
+ free(uri);
+ LOG_RETURN(RES_FAIL, "Sim slot is NULL!");
+ }
+ DLOG("Sim slot [%s]", tmp);
+ free(tmp);
+
+ ret = m_callManager->processIncomingCall(
+ convertCMSimSlot(static_cast<cm_multi_sim_slot_type_e>(atoi(tmp))));
+
+ } else {
+ tmp = static_cast<char *>(uri + 4);
+ DLOG("number [%s]", tmp);
+
+ if (!tmp) {
+ free(operation);
+ free(uri);
+ LOG_RETURN(RES_FAIL, "number is NULL");
+ }
+
+ ret = m_callManager->processOutgoingCall(tmp);
+ }
+
+ free(operation);
+ free(uri);
+
+ return ret;
+ }
+
+ Result CallUI::prepare()
+ {
+ auto callClient = CallClient::newInstance();
+ if (!callClient) {
+ LOG_RETURN(RES_FAIL,
+ "Client::newInstance() failed!");
+ }
+
+ m_callManager = CallManager::newInstance(callClient, asWeak(*this));
+ if (!m_callManager) {
+ LOG_RETURN(RES_FAIL,
+ "CallManager::newInstance() failed!");
+ }
+
+ m_soundManager = SoundManager::newInstance(callClient);
+ if (!m_soundManager) {
+ LOG_RETURN(RES_FAIL,
+ "SoundManage::newInstance() failed!");
+ }
+
+ m_voiceControlPrv = VoiceControlStateProvider::newInstance();
+ if (!m_voiceControlPrv) {
+ LOG_RETURN(RES_FAIL,
+ "VoiceControlStateProvider::newInstance() failed!");
+ }
+
+ FAIL_RETURN(initInidcatorStateProvider(),
+ "Init Indicator State Provider failed!");
+
+ return RES_OK;
+ }
+
+ Result CallUI::initInidcatorStateProvider()
+ {
+ m_indicatorStPrv = IndicatorStateProvider::newInstance();
+ if (!m_indicatorStPrv) {
+ LOG_RETURN(RES_FAIL, "IndicatorStateProvider::newInstance() failed!");
+ }
+
+ auto connStateSource = ConnectionStateSource::newInstance();
+ if (!connStateSource) {
+ LOG_RETURN(RES_FAIL,
+ "ConnectionStateSource::newInstance() failed!");
+ }
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::NW_CONNECTION, connStateSource),
+ "setStateSource() failed!");
+
+ auto rssiStSrc = RssiStateSource::newInstance();
+ if (!rssiStSrc) {
+ LOG_RETURN(RES_FAIL,
+ "RssiStateSource::newInstance() failed!");
+ }
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::RSSI, rssiStSrc),
+ "setStateSource() failed!");
+
+ auto batteryStSrc = BatteryStateSource::newInstance();
+ if (!batteryStSrc) {
+ LOG_RETURN(RES_FAIL,
+ "BatteryStateSource::newInstance() failed!");
+ }
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::BATTERY, batteryStSrc),
+ "setStateSource() failed!");
+
+ auto voiceControlStSrc =
+ VoiceControlStateSource::newInstance(m_voiceControlPrv);
+ if (!voiceControlStSrc) {
+ LOG_RETURN(RES_FAIL,
+ "VoiceControlStateSource::newInstance() failed!");
+ }
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::VOICE_CONTROL, voiceControlStSrc),
+ "setStateSource() failed!");
+
+ m_simSlotStSrc = makeShared<SimSlotStateSource>(
+ m_callManager->getSimSlot(), getForwardedCallStatus());
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::SIM_SLOT, m_simSlotStSrc),
+ "setStateSource() failed!");
+
+ m_hdCallStSrc = makeShared<HdVoiceStateSource>(
+ getHDVoiceStatus());
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::HD_VOICE, m_hdCallStSrc),
+ "setStateSource() failed!");
+
+ return RES_OK;
+ }
+
+ ICallManagerSRef CallUI::getCallManager()
+ {
+ return m_callManager;
+ }
+
+ ISoundManagerSRef CallUI::getSoundManager()
+ {
+ return m_soundManager;
+ }
+
+ IIndicatorStateProviderSRef CallUI::getIndicatorStateProvider()
+ {
+ return m_indicatorStPrv;
+ }
+
+ ICallInfoSCRef CallUI::getCurrentCallInfo() const
+ {
+ CallMask calls = m_callManager->getAvailableCalls();
+ if (!calls) {
+ DLOG("No available calls");
+ return {};
+ } else if (calls & CALL_FLAG_INCOMING) {
+ return m_callManager->getIncomingCall()->getInfo();
+ } else if (calls & CALL_FLAG_ACTIVE) {
+ return m_callManager->getActiveCall()->getInfo();
+ } else if (calls & CALL_FLAG_HELD) {
+ return m_callManager->getHeldCall()->getInfo();
+ } else if (calls & CALL_FLAG_END) {
+ return m_callManager->getEndCall()->getInfo();
+ }
+ return {};
+ }
+
+ bool CallUI::getHDVoiceStatus() const
+ {
+ ICallInfoSCRef info = getCurrentCallInfo();
+ if (info) {
+ return info->isHDVoice();
+ }
+ return false;
+ }
+
+ bool CallUI::getForwardedCallStatus() const
+ {
+ ICallInfoSCRef info = getCurrentCallInfo();
+ if (info) {
+ return info->isForwarded();
+ }
+ return false;
+ }
+
+ void CallUI::updateHdVoiceStateSource()
+ {
+ m_hdCallStSrc->updateState(getHDVoiceStatus());
+ }
+
+ void CallUI::updateSimSlotStateSource()
+ {
+ m_simSlotStSrc->updateSimSlot(m_callManager->getSimSlot(),
+ getForwardedCallStatus());
+ }
+
+ void CallUI::onCallEvent(CallEventType type)
+ {
+ updateSimSlotStateSource();
+ updateHdVoiceStateSource();
+
+ if (const auto listener = m_listener.lock()) {
+ listener->onCallEvent(type);
+ }
+ }
+
+ void CallUI::onError(CallManagerErr err)
+ {
+ auto callErr = CallErr::DIAL_FAIL;
+ switch (err) {
+ case CallManagerErr::DIAL_CANCEL:
+ callErr = CallErr::DIAL_CANCEL;
+ break;
+ case CallManagerErr::DIAL_FLIGHT_MODE:
+ callErr = CallErr::DIAL_FLIGHT_MODE;
+ break;
+ default:
+ callErr = CallErr::DIAL_FAIL;
+ break;
+ }
+
+ if (const auto listener = m_listener.lock()) {
+ listener->onError(callErr);
+ }
+ }
+
+}
--- /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_MODEL_CALL_UI_H__
+#define __CALLUI_MODEL_CALL_UI_H__
+
+#include "model/ICallUI.h"
+
+#include "ICallManagerListener.h"
+
+#include "types.h"
+
+namespace callui {
+
+ UCL_DECLARE_REF_ALIASES(CallManager);
+ UCL_DECLARE_REF_ALIASES(SoundManager);
+
+ class CallUI final :
+ public ucl::RefCountAware,
+ public ICallUI,
+ public ICallManagerListener {
+ public:
+ virtual ~CallUI();
+
+ // ICallUI
+
+ virtual void setListener(const ICallListenerWRef &listener) override final;
+ virtual ucl::Result processAppControl(app_control_h appControl) override final;
+ virtual ISoundManagerSRef getSoundManager() override final;
+ virtual ICallManagerSRef getCallManager() override final;
+ virtual IIndicatorStateProviderSRef getIndicatorStateProvider() override final;
+
+ // ICallManagerListener
+
+ virtual void onCallEvent(CallEventType type) override final;
+ virtual void onError(CallManagerErr err) override final;
+
+ private:
+ friend class CallUIBuilder;
+ friend class ucl::ReffedObj<CallUI>;
+ CallUI(ucl::IRefCountObj &rc);
+
+ ucl::Result prepare();
+
+ ucl::Result initInidcatorStateProvider();
+
+ void updateHdVoiceStateSource();
+ void updateSimSlotStateSource();
+ ICallInfoSCRef getCurrentCallInfo() const;
+ bool getHDVoiceStatus() const;
+ bool getForwardedCallStatus() const;
+
+ private:
+ CallManagerSRef m_callManager;
+ SoundManagerSRef m_soundManager;
+ ICallListenerWRef m_listener;
+ SimSlotStateSourceSRef m_simSlotStSrc;
+ HdVoiceStateSourceSRef m_hdCallStSrc;
+ IndicatorStateProviderSRef m_indicatorStPrv;
+ VoiceControlStateProviderSRef m_voiceControlPrv;
+ };
+
+}
+
+#endif // __CALLUI_MODEL_CALL_UI_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 "model/CallUIBuilder.h"
+
+#include "CallUI.h"
+
+#include "common.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ CallUIBuilder::CallUIBuilder()
+ {
+ }
+
+ ICallUISRef CallUIBuilder::build() const
+ {
+ auto result = makeShared<CallUI>();
+ FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+ return result;
+ }
+
+}
#include <system_settings.h>
-#include "model/CallBuilder.h"
-#include "model/ICall.h"
+#include "model/CallUIBuilder.h"
+#include "model/ICallUI.h"
#include "model/ICallManager.h"
#include "presenters/MainPage.h"
FAIL_RETURN(setupTheme(), "setupTheme() failed!");
- m_call = CallBuilder().build();
+ m_call = CallUIBuilder().build();
if (!m_call) {
LOG_RETURN(RES_FAIL, "m_call is NULL");
}
if (!m_page) {
auto page = MainPage::Builder().
setNaviframe(m_navi).
- setCall(m_call).
+ setCallUI(m_call).
build(WEAK_DELEGATE(Instance::onPageExitRequest,
asWeak(this)));
if (!page) {
#include "ucl/gui/Window.h"
#include "ucl/gui/Widget.h"
-#include "model/ICall.h"
+#include "model/ICallUI.h"
#include "model/ICallManager.h"
#include "model/IIncomingCall.h"
#include "model/IActiveCall.h"
return *this;
}
- MainPage::Builder &MainPage::Builder::setCall(
- const ICallSRef &call)
+ MainPage::Builder &MainPage::Builder::setCallUI(
+ const ICallUISRef &call)
{
m_call = call;
return *this;
MainPage::MainPage(IRefCountObj &rc,
const NaviframeSRef &navi,
const ExitRequestHandler handler,
- const ICallSRef &call) :
+ const ICallUISRef &call) :
Page(rc, navi, handler),
m_call(call),
m_mode(CallMode::UNDEFINED),