From cece5d23ad956e4a29c799b618956b4342ff41fb Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Mon, 3 Apr 2017 14:51:58 +0300 Subject: [PATCH] TizenRefApp-8318 [Call UI] Prepare Model call manager part interface Change-Id: I0ef8561ea06c75ba1fd1ed6e8bb7ba9383bdf413 --- inc/model/Call.h | 42 ++++++++++++ inc/model/IActiveCall.h | 35 ++++++++++ inc/model/ICallDialer.h | 35 ++++++++++ inc/model/ICallInfo.h | 36 ++++++++++ inc/model/ICallManager.h | 37 ++++++++++ inc/model/IConferenceCallInfo.h | 31 +++++++++ inc/model/IContactInfo.h | 32 +++++++++ inc/model/IEndCall.h | 32 +++++++++ inc/model/IHeldCall.h | 35 ++++++++++ inc/model/IIncomingCall.h | 34 ++++++++++ inc/model/ISoundManager.h | 44 ++++++++++++ inc/model/types.h | 115 ++++++++++++++++++++++++++++++++ inc/types.h | 2 +- src/model/Call.cpp | 55 +++++++++++++++ src/model/common.h | 22 ++++++ 15 files changed, 586 insertions(+), 1 deletion(-) create mode 100644 inc/model/Call.h create mode 100644 inc/model/IActiveCall.h create mode 100644 inc/model/ICallDialer.h create mode 100644 inc/model/ICallInfo.h create mode 100644 inc/model/ICallManager.h create mode 100644 inc/model/IConferenceCallInfo.h create mode 100644 inc/model/IContactInfo.h create mode 100644 inc/model/IEndCall.h create mode 100644 inc/model/IHeldCall.h create mode 100644 inc/model/IIncomingCall.h create mode 100644 inc/model/ISoundManager.h create mode 100644 inc/model/types.h create mode 100644 src/model/Call.cpp create mode 100644 src/model/common.h diff --git a/inc/model/Call.h b/inc/model/Call.h new file mode 100644 index 0000000..b91a5f0 --- /dev/null +++ b/inc/model/Call.h @@ -0,0 +1,42 @@ +/* + * 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 "types.h" + +namespace callui { + + class Call final : public ucl::NonCopyable { + public: + static CallSRef newInstance(); + virtual ~Call(); + + ISoundManagerSRef getSoundManager(); + ICallManagerSRef getCallManager(); + + private: + friend class ucl::RefCountObj; + Call(); + + ucl::Result prepare(); + + }; + +} + +#endif // __CALLUI_MODEL_CALL_H__ diff --git a/inc/model/IActiveCall.h b/inc/model/IActiveCall.h new file mode 100644 index 0000000..5d51eda --- /dev/null +++ b/inc/model/IActiveCall.h @@ -0,0 +1,35 @@ +/* + * 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_ACTIVE_CALL_H__ +#define __CALLUI_MODEL_I_ACTIVE_CALL_H__ + +#include "types.h" + +namespace callui { + + class IActiveCall : public ucl::Polymorphic { + public: + virtual ICallInfoSCRef getInfo() const = 0; + virtual bool isDialingMode() const = 0; + virtual ucl::Result hold() = 0; + virtual ucl::Result end() = 0; + virtual ucl::Result split(const IConferenceCallInfoSRef &confCallInfo) = 0; + }; + +} + +#endif // __CALLUI_MODEL_I_ACTIVE_CALL_H__ diff --git a/inc/model/ICallDialer.h b/inc/model/ICallDialer.h new file mode 100644 index 0000000..1ca00b9 --- /dev/null +++ b/inc/model/ICallDialer.h @@ -0,0 +1,35 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CALLUI_MODEL_I_CALL_DIALER_H__ +#define __CALLUI_MODEL_I_CALL_DIALER_H__ + +#include "types.h" + +namespace callui { + + class ICallDialer: public ucl::Polymorphic { + public: + using DialStatusHandler = ucl::Delegate; + + public: + virtual ucl::Result dialVoiceCall(const std::string &number, SimSlot simSlot) = 0; + virtual ucl::Result addDialStatusHandler(DialStatusHandler handler) = 0; + virtual ucl::Result removeDialStatusHandler(DialStatusHandler handler) = 0; + }; +} + +#endif // __CALLUI_MODEL_I_CALL_DIALER_H__ diff --git a/inc/model/ICallInfo.h b/inc/model/ICallInfo.h new file mode 100644 index 0000000..568bf9d --- /dev/null +++ b/inc/model/ICallInfo.h @@ -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. + */ + +#ifndef __CALLUI_MODEL_I_CALL_INFO_H__ +#define __CALLUI_MODEL_I_CALL_INFO_H__ + +#include "types.h" + +namespace callui { + + class ICallInfo : public ucl::Polymorphic { + public: + virtual const std::string &getPhoneNumber() const = 0; + virtual IContactInfoSCRef getContactInfo() const = 0; + virtual long getStartTime() const = 0; + virtual bool isEmergency() const = 0; + virtual bool isDialing() const = 0; + virtual int getConferenceMemberCount() const = 0; + virtual const ConfMemberCallList &getConferenceMemberList() const = 0; + }; +} + +#endif // __CALLUI_MODEL_I_CALL_INFO_H__ diff --git a/inc/model/ICallManager.h b/inc/model/ICallManager.h new file mode 100644 index 0000000..7ffe4f9 --- /dev/null +++ b/inc/model/ICallManager.h @@ -0,0 +1,37 @@ +/* + * 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_STATE_PROVIDER_H__ +#define __CALLUI_MODEL_I_STATE_PROVIDER_H__ + +#include "types.h" + +namespace callui { + + class ICallManager : public ucl::Polymorphic { + public: + virtual ICallDialerWRef getDialer() = 0; + virtual IIncomingCallWRef getIncomingCall() = 0; + virtual IActiveCallWRef getActiveCall() = 0; + virtual IHeldCallWRef getHeldCall() = 0; + virtual IEndCallWRef getEndCall() = 0; + virtual CallMask getAvailableCallMask() const = 0; + virtual void addCallStateHandler(const CallStateHandler handler) = 0; + virtual void removeCallStateHandler(const CallStateHandler handler) = 0; + }; +} + +#endif // __CALLUI_MODEL_I_STATE_PROVIDER_H__ diff --git a/inc/model/IConferenceCallInfo.h b/inc/model/IConferenceCallInfo.h new file mode 100644 index 0000000..0801b46 --- /dev/null +++ b/inc/model/IConferenceCallInfo.h @@ -0,0 +1,31 @@ +/* + * 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_CONFERENCE_CALL_INFO_H__ +#define __CALLUI_MODEL_I_CONFERENCE_CALL_INFO_H__ + +#include "types.h" + +namespace callui { + + class IConferenceCallInfo : public ucl::Polymorphic { + public: + virtual const std::string &getPhoneNumber() const = 0; + virtual IContactInfoSRef getContactInfo() const = 0; + }; +} + +#endif // __CALLUI_MODEL_I_CONFERENCE_CALL_INFO_H__ diff --git a/inc/model/IContactInfo.h b/inc/model/IContactInfo.h new file mode 100644 index 0000000..a71fc9c --- /dev/null +++ b/inc/model/IContactInfo.h @@ -0,0 +1,32 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CALLUI_MODEL_I_CONTACT_INFO_H__ +#define __CALLUI_MODEL_I_CONTACT_INFO_H__ + +#include "types.h" + +namespace callui { + + class IContactInfo : public ucl::Polymorphic { + public: + virtual const std::string &getName() const = 0; + virtual const std::string &getImagePath() const = 0; + virtual ContactNameSourceType getNameSourceType() const = 0; + }; +} + +#endif // __CALLUI_MODEL_I_CONTACT_INFO_H__ diff --git a/inc/model/IEndCall.h b/inc/model/IEndCall.h new file mode 100644 index 0000000..bb16cab --- /dev/null +++ b/inc/model/IEndCall.h @@ -0,0 +1,32 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CALLUI_MODEL_I_END_CALL_H__ +#define __CALLUI_MODEL_I_END_CALL_H__ + +#include "types.h" + +namespace callui { + + class IEndCall : public ucl::Polymorphic { + public: + virtual ICallInfoSCRef getInfo() const = 0; + virtual ucl::Result callBack() = 0; + virtual ucl::Result writeMessage() = 0; + }; +} + +#endif // __CALLUI_MODEL_I_END_CALL_H__ diff --git a/inc/model/IHeldCall.h b/inc/model/IHeldCall.h new file mode 100644 index 0000000..3b46357 --- /dev/null +++ b/inc/model/IHeldCall.h @@ -0,0 +1,35 @@ +/* + * 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_HELD_CALL_H__ +#define __CALLUI_MODEL_I_HELD_CALL_H__ + +#include "types.h" + +namespace callui { + + class IHeldCall : public ucl::Polymorphic { + public: + virtual ICallInfoSCRef getInfo() const = 0; + virtual ucl::Result unhold() = 0; + virtual ucl::Result joinWithActive() = 0; + virtual ucl::Result swapWithActive() = 0; + virtual ucl::Result end() = 0; + virtual ucl::Result split(const IConferenceCallInfoSRef &confCallInfo) = 0; + }; +} + +#endif // __CALLUI_MODEL_I_HELD_CALL_H__ diff --git a/inc/model/IIncomingCall.h b/inc/model/IIncomingCall.h new file mode 100644 index 0000000..a1f70da --- /dev/null +++ b/inc/model/IIncomingCall.h @@ -0,0 +1,34 @@ +/* + * 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_INCOMING_CALL_H__ +#define __CALLUI_MODEL_I_INCOMING_CALL_H__ + +#include "types.h" + +namespace callui { + + class IIncomingCall : public ucl::Polymorphic { + public: + virtual ICallInfoSCRef getInfo() const = 0; + virtual ucl::Result answer(CallAnswerType type) = 0; + virtual ucl::Result reject() = 0; + virtual ucl::Result rejectWithMessage(const std::string &message) = 0; + virtual ucl::Result stopAlert() = 0; + }; +} + +#endif // __CALLUI_MODEL_I_INCOMING_CALL_H__ diff --git a/inc/model/ISoundManager.h b/inc/model/ISoundManager.h new file mode 100644 index 0000000..23b52d8 --- /dev/null +++ b/inc/model/ISoundManager.h @@ -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_I_SOUND_MANAGER_H__ +#define __CALLUI_MODEL_I_SOUND_MANAGER_H__ + +#include "types.h" + +namespace callui { + + class ISoundManager: public ucl::Polymorphic { + public: + using AudioStateHandler = ucl::Delegate; + using MuteStateHandler = ucl::Delegate; + + public: + virtual ucl::Result setSpeakerState(bool isEnable) = 0; + virtual ucl::Result setBluetoothState(bool isEnable) = 0; + virtual AudioStateType getAudioState() = 0; + virtual ucl::Result setMuteState(bool isEnable) = 0; + virtual bool getMuteState() const = 0; + virtual ucl::Result startDtmf(const unsigned char dtmfDigit) = 0; + virtual ucl::Result stopDtmf() = 0; + virtual ucl::Result addAudioStateChangeHandler(AudioStateHandler handler) = 0; + virtual ucl::Result removeAudioStateChangeHandler(AudioStateHandler handler) = 0; + virtual ucl::Result addMuteStateChangeHandler(MuteStateHandler handler) = 0; + virtual ucl::Result removeMuteStateChangeHandler(MuteStateHandler handler) = 0; + }; +} + +#endif // __CALLUI_MODEL_I_SOUND_MANAGER_H__ diff --git a/inc/model/types.h b/inc/model/types.h new file mode 100644 index 0000000..00c292c --- /dev/null +++ b/inc/model/types.h @@ -0,0 +1,115 @@ +/* + * 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_TYPES_H__ +#define __CALLUI_MODEL_TYPES_H__ + +#include "../types.h" +#include + +namespace callui { + + enum class SimSlot { + FIRST, + SECOND, + DEFAULT + }; + + enum class CallReleaseType { + BY_CALL_HANDLE, + ALL, + ALL_HOLD, + ALL_ACTIVE + }; + + enum class CallAnswerType { + NORMAL, + HOLD_ACTIVE_AND_ACCEPT, + RELEASE_ACTIVE_AND_ACCEPT, + RELEASE_HOLD_AND_ACCEPT, + RELEASE_ALL_AND_ACCEPT + }; + + enum class DialStatus { + SUCCESS, + CANCEL, + FAIL, + FAIL_SS, + FDN, + FLIGHT_MODE + }; + + enum class AudioStateType { + NONE, + SPEAKER, + RECEIVER, + EARJACK, + BT + }; + + enum { + CALL_FLAG_INCOMING = 1, + CALL_FLAG_ACTIVE = 2, + CALL_FLAG_HELD = 4, + CALL_FLAG_END = 8 + }; + using CallMask = int; + + enum class CallEventType { + END, + DIALING, + ACTIVE, + HELD, + ALERT, + INCOMING, + WAITING, + JOIN, + SPLIT, + SWAPPED, + RETRIEVED, + SAT_CALL_CONTROL + }; + + enum class ContactNameSourceType { + INVALID, + EMAIL, + NUMBER, + NICKNAME, + COMPANY, + NAME + }; + + UCL_DECLARE_REF_ALIASES(Call); + + UCL_DECLARE_REF_ALIASES(ICallManager); + UCL_DECLARE_REF_ALIASES(ISoundManager); + UCL_DECLARE_REF_ALIASES(ICallDialer); + + UCL_DECLARE_REF_ALIASES(IIncomingCall); + UCL_DECLARE_REF_ALIASES(IActiveCall); + UCL_DECLARE_REF_ALIASES(IHeldCall); + UCL_DECLARE_REF_ALIASES(IEndCall); + + UCL_DECLARE_REF_ALIASES(ICallInfo); + UCL_DECLARE_REF_ALIASES(IContactInfo); + UCL_DECLARE_REF_ALIASES(IConferenceCallInfo); + + using CallStateHandler = ucl::Delegate; + + using ConfMemberCallList = std::list; +} + +#endif // __GALLERY_MODEL_TYPES_H__ diff --git a/inc/types.h b/inc/types.h index efb664b..fa935ca 100644 --- a/inc/types.h +++ b/inc/types.h @@ -23,4 +23,4 @@ #include "ucl/util/memory.h" #include "ucl/util/delegation.h" -#endif // __CALLUI_TYPES_H_ +#endif // __CALLUI_TYPES_H__ diff --git a/src/model/Call.cpp b/src/model/Call.cpp new file mode 100644 index 0000000..9a1e117 --- /dev/null +++ b/src/model/Call.cpp @@ -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. + */ + +#include "model/Call.h" + +#include "common.h" + +namespace callui { + + using namespace ucl; + + Call::Call() + { + } + + Call::~Call() + { + } + + CallSRef Call::newInstance() + { + auto result = makeShared(); + FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!"); + return result; + } + + ucl::Result Call::prepare() + { + return RES_OK; + } + + ICallManagerSRef Call::getCallManager() + { + UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!"); + } + + ISoundManagerSRef Call::getSoundManager() + { + UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!"); + } + +} diff --git a/src/model/common.h b/src/model/common.h new file mode 100644 index 0000000..47bf580 --- /dev/null +++ b/src/model/common.h @@ -0,0 +1,22 @@ +/* + * 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_COMMON_H__ +#define __CALLUI_MODEL_COMMON_H__ + +#include "../common.h" + +#endif // __CALLUI_MODEL_COMMON_H__ -- 2.34.1