#include "ucl/appfw/SysEventProvider.h"
-#include "model/Call.h"
+#include "model/ICall.h"
namespace callui {
// For testing
ucl::WindowWRef getWindow();
ucl::IInstanceContext *getContext();
- CallWRef getCall();
+ ICallWRef getCall();
// IInstance //
ucl::SysEventProvider &m_sysEventProvider;
ucl::IInstanceContext *m_context;
ucl::WindowSRef m_win;
- CallSRef m_call;
+ ICallSRef 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.
- */
-
-#ifndef __CALLUI_MODEL_CALL_H__
-#define __CALLUI_MODEL_CALL_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::NonCopyable {
- public:
- class Builder {
- public:
- Builder();
- Builder &setListener(ICallManagerListenerWRef value);
- CallSRef build() const;
- private:
- ICallManagerListenerWRef m_listener;
- };
-
- public:
- virtual ~Call();
-
- ucl::Result processAppControl(app_control_h appControl);
- ISoundManagerSRef getSoundManager();
- ICallManagerSRef getCallManager();
-
- private:
- friend class ucl::RefCountObj<Call>;
- Call();
-
- ucl::Result prepare(ICallManagerListenerWRef listener);
-
- private:
- CallManagerSRef m_callManager;
- SoundManagerSRef m_soundManager;
- };
-
-}
-
-#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.
+ */
+
+#ifndef CALLUI_MODEL_CALL_BUILDER_H__
+#define CALLUI_MODEL_CALL_BUILDER_H__
+
+#include "types.h"
+
+namespace callui {
+
+ class CallBuilder {
+ public:
+ CallBuilder();
+ CallBuilder &setListener(ICallListenerWRef value);
+ ICallSRef build() const;
+
+ private:
+ ICallListenerWRef m_listener;
+ };
+
+}
+
+#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_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 ucl::Result processAppControl(app_control_h appControl) = 0;
+ virtual ISoundManagerSRef getSoundManager() = 0;
+ virtual ICallManagerSRef getCallManager() = 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_LISTENER_H__
+#define __CALLUI_MODEL_I_CALL_LISTENER_H__
+
+#include "types.h"
+
+namespace callui {
+
+ class ICallListener : public ucl::Polymorphic {
+ public:
+ virtual void onCallEvent(CallEventType type) = 0;
+ virtual void onError(CallErr err) = 0;
+ };
+
+}
+
+#endif // __CALLUI_MODEL_I_CALL_LISTENER_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_MANAGER_LISTENER_H__
-#define __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
-
-#include "types.h"
-
-namespace callui {
-
- class ICallManagerListener : public ucl::Polymorphic {
- public:
- virtual void onCallEvent(CallEventType type) = 0;
- virtual void onError(CallManagerErr err) = 0;
- };
-
-}
-
-#endif // __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
namespace callui {
+ enum class CallErr {
+ DIAL_CANCEL,
+ DIAL_FAIL,
+ DIAL_FLIGHT_MODE
+ };
+
enum class SimSlot {
UNDEFINED,
FIRST,
DEFAULT
};
- enum class CallManagerErr {
- NONE,
- DIAL_CANCEL,
- DIAL_FAIL,
- DIAL_FAIL_SS,
- DIAL_FAIL_FDN,
- DIAL_FLIGHT_MODE
- };
-
enum class CallAnswerType {
NORMAL,
HOLD_ACTIVE_AND_ACCEPT,
NAME
};
- UCL_DECLARE_REF_ALIASES(Call);
+ UCL_DECLARE_REF_ALIASES(ICall);
+ UCL_DECLARE_REF_ALIASES(ICallListener);
UCL_DECLARE_REF_ALIASES(ICallManager);
UCL_DECLARE_REF_ALIASES(ISoundManager);
- UCL_DECLARE_REF_ALIASES(ICallManagerListener);
-
UCL_DECLARE_REF_ALIASES(IIncomingCall);
UCL_DECLARE_REF_ALIASES(IActiveCall);
UCL_DECLARE_REF_ALIASES(IHeldCall);
#include "ucl/util/types.h"
#include "ucl/util/memory.h"
#include "ucl/util/delegation.h"
+#include "ucl/misc/RefCountAware.h"
namespace callui {
enum {
#include <system_settings.h>
#include <efl_extension.h>
-#include "../common.h"
-
+#include "model/CallBuilder.h"
#include "model/ICallManager.h"
-#include "model/ICallManagerListener.h"
#include "model/IIncomingCall.h"
#include "model/IActiveCall.h"
#include "model/IHeldCall.h"
#include "model/IEndCall.h"
#include "model/ICallInfo.h"
+#include "model/ICallListener.h"
+
+#include "../common.h"
namespace callui {
// For testing
UCL_DECLARE_REF_ALIASES(Listener);
- class Listener : public ICallManagerListener {
+ 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();
- CallWRef call = m_instance.getCall();
+ ICallWRef call = m_instance.getCall();
ICallManagerSRef callMng = {};
if (call) {
callMng = call->getCallManager();
}
}
- virtual void onError(CallManagerErr err) override final
+ 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("* conference member count [%d]", info->getConferenceMemberCount());
}
- private:
- friend class ucl::RefCountObj<Listener>;
- Listener(Instance &instance):
- m_instance(instance)
- {
- ILOG();
- }
private:
Instance &m_instance;
};
// For testing
static ListenerSRef listener = Listener::newInstance(*this);
- m_call = Call::Builder().
+ m_call = CallBuilder().
setListener(listener).
build();
return m_context;
}
- CallWRef Instance::getCall()
+ ICallWRef Instance::getCall()
{
return m_call;
}
* limitations under the License.
*/
-#include "model/Call.h"
+#include "Call.h"
#include <app_control.h>
#include "CallClient.h"
#include "CallManager.h"
#include "SoundManager.h"
+#include "model/ICallListener.h"
#include "common.h"
using namespace ucl;
- Call::Builder::Builder():
- m_listener(nullptr)
- {
- }
-
- Call::Builder &Call::Builder::setListener(ICallManagerListenerWRef value)
- {
- m_listener = value;
- return *this;
- }
-
- CallSRef Call::Builder::build() const
- {
- auto result = makeShared<Call>();
- FAIL_RETURN_VALUE(result->prepare(m_listener), {}, "result->prepare() failed!");
- return result;
- }
-
- Call::Call()
+ Call::Call(RefCountObjBase &rc, ICallListenerWRef listener):
+ RefCountAware(&rc),
+ m_listener(listener)
{
}
return ret;
}
- Result Call::prepare(ICallManagerListenerWRef listener)
+ Result Call::prepare()
{
CallClientSRef callClient = CallClient::newInstance();
if (!callClient) {
LOG_RETURN(RES_FAIL, "Client::newInstance() failed!");
}
- m_callManager = CallManager::newInstance(callClient, listener);
+ m_callManager = CallManager::newInstance(callClient, asWeak(*this));
if (!m_callManager) {
LOG_RETURN(RES_FAIL, "CallManager::newInstance() failed!");
}
return m_soundManager;
}
+ void Call::onCallEvent(CallEventType type)
+ {
+ if (m_listener) {
+ m_listener->onCallEvent(type);
+ }
+ }
+
+ void Call::onError(CallManagerErr err)
+ {
+ CallErr 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 (m_listener) {
+ m_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 ucl::Result processAppControl(app_control_h appControl) override final;
+ virtual ISoundManagerSRef getSoundManager() override final;
+ virtual ICallManagerSRef getCallManager() override final;
+
+ // ICallManagerListener
+
+ virtual void onCallEvent(CallEventType type) override final;
+ virtual void onError(CallManagerErr err) override final;
+
+ private:
+ friend class CallBuilder;
+ friend class ucl::RefCountObj<Call>;
+ Call(ucl::RefCountObjBase &rc, ICallListenerWRef listener);
+
+ ucl::Result prepare();
+
+ private:
+ CallManagerSRef m_callManager;
+ SoundManagerSRef m_soundManager;
+ ICallListenerWRef m_listener;
+ };
+
+}
+
+#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():
+ m_listener(nullptr)
+ {
+ }
+
+ CallBuilder &CallBuilder::setListener(ICallListenerWRef value)
+ {
+ m_listener = value;
+ return *this;
+ }
+
+ ICallSRef CallBuilder::build() const
+ {
+ auto result = makeShared<Call>(m_listener);
+ FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+ return result;
+ }
+
+}
#include "CallManager.h"
-#include "model/ICallManagerListener.h"
+#include "ICallManagerListener.h"
#include "CallClient.h"
#include "RejectMsgProvider.h"
{
m_waitDialing = false;
- CallManagerErr err = convertCMDialStatusIntoErr(status);
- if (err != CallManagerErr::NONE && m_listener) {
+ CallManagerErr err = CallManagerErr::DIAL_FAIL;
+ switch (status) {
+ case CM_DIAL_SUCCESS:
+ return;
+ case CM_DIAL_CANCEL:
+ err = CallManagerErr::DIAL_CANCEL;
+ break;
+ case CM_DIAL_FAIL:
+ err = CallManagerErr::DIAL_FAIL;
+ break;
+ case CM_DIAL_FAIL_SS:
+ err = CallManagerErr::DIAL_FAIL_SS;
+ break;
+ case CM_DIAL_FAIL_FDN:
+ err = CallManagerErr::DIAL_FAIL_FDN;
+ break;
+ case CM_DIAL_FAIL_FLIGHT_MODE:
+ err = CallManagerErr::DIAL_FLIGHT_MODE;
+ break;
+ default:
+ err = CallManagerErr::DIAL_FAIL;
+ break;
+ }
+
+ if (m_listener) {
m_listener->onError(err);
}
}
--- /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_MANAGER_LISTENER_H__
+#define __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
+
+#include "implTypes.h"
+
+namespace callui {
+
+ class ICallManagerListener : public ucl::Polymorphic {
+ public:
+ virtual void onCallEvent(CallEventType type) = 0;
+ virtual void onError(CallManagerErr err) = 0;
+ };
+
+}
+
+#endif // __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__
AudioStateType convertCMAudioState(cm_audio_state_type_e state);
- CallManagerErr convertCMDialStatusIntoErr(cm_dial_status_e status);
-
cm_multi_sim_slot_type_e convertCUISimSlot(SimSlot slot);
SimSlot convertCMSimSlot(cm_multi_sim_slot_type_e slot);
}
}
- inline CallManagerErr convertCMDialStatusIntoErr(cm_dial_status_e status)
- {
- switch (status) {
- case CM_DIAL_SUCCESS: return CallManagerErr::NONE;
- case CM_DIAL_CANCEL: return CallManagerErr::DIAL_CANCEL;
- case CM_DIAL_FAIL: return CallManagerErr::DIAL_FAIL;
- case CM_DIAL_FAIL_SS: return CallManagerErr::DIAL_FAIL_SS;
- case CM_DIAL_FAIL_FDN: return CallManagerErr::DIAL_FAIL_FDN;
- case CM_DIAL_FAIL_FLIGHT_MODE: return CallManagerErr::DIAL_FLIGHT_MODE;
- default:
- return CallManagerErr::DIAL_FAIL;
- }
- }
-
inline cm_multi_sim_slot_type_e convertCUISimSlot(SimSlot slot)
{
switch (slot) {
ALL_ACTIVE
};
+ enum class CallManagerErr {
+ DIAL_CANCEL,
+ DIAL_FAIL,
+ DIAL_FAIL_SS,
+ DIAL_FAIL_FDN,
+ DIAL_FLIGHT_MODE
+ };
+
UCL_DECLARE_REF_ALIASES(CallClient);
UCL_DECLARE_REF_ALIASES(SoundManager);
UCL_DECLARE_REF_ALIASES(CallManager);
+ UCL_DECLARE_REF_ALIASES(ICallManagerListener);
+
UCL_DECLARE_REF_ALIASES(IncomingCall);
UCL_DECLARE_REF_ALIASES(ActiveCall);
UCL_DECLARE_REF_ALIASES(HeldCall);
using AudioStateEvent = ucl::Event<AudioStateHandler>;
using MuteStateEvent = ucl::Event<MuteStateHandler>;
+
}
#endif // __CALLUI_MODEL_IMPL_TYPES_H__