2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file PhnCallPresentationModel.h
19 * @brief This is the header file for the %CallPresentationModel class.
21 * This header file contains the declarations for %CallPresentationModel class.
23 #ifndef _PHN_CALL_PRESENTATION_MODEL_H_
24 #define _PHN_CALL_PRESENTATION_MODEL_H_
28 #include "PhnITelephonyEventListener.h"
29 #include "PhnCalllogManager.h"
32 class TelephonyManager;
33 class SettingsPresentationModel;
36 * @class CallPresentationModel
37 * @brief CallPresentationModel is Singleton class and acts as interface between
38 * events from other managers and all the views.
41 class CallPresentationModel: public ITelephonyEventListener
42 , public Tizen::App::IAppControlResponseListener
45 //create a singleton instance
46 static CallPresentationModel* GetInstance(void);
49 CallPresentationModel(void);
50 CallPresentationModel(CallPresentationModel& presentor);
51 virtual ~CallPresentationModel(void);
52 CallPresentationModel& operator =(const CallPresentationModel& presentor);
55 result Construct(void);
56 static void CreateInstance(void);
57 static void DestroyInstance(void);
60 //set the telephony event listener
61 void SetTelEventListener(ITelephonyEventListener* pTelEventListener);
63 //Dial an outgoing call
64 void DialCall(Tizen::Base::String& contactNumber, bool isEmergency);
66 void EndCall(Tizen::Base::Long callHandle);
67 void EndCall(Tizen::Base::String& contactNumber);
68 //End the conference call
69 bool EndConferenceCall(void);
72 * @returns true if successful.
74 bool HoldCall(Tizen::Base::Long callHandle);
77 * @returns true if successful.
79 bool UnHoldCall(Tizen::Base::Long callHandle);
80 //Hold conference call
81 bool HoldConferenceCall(void);
82 //UnHold conference call
83 bool ActivateConferenceCall(void);
84 //Join active and held call to conference call.
86 //Swap between active and held call
89 bool SetMuteStatus(bool setMute);
90 //Get the call Muted status
91 bool IsCallMuted(void);
92 //Set speaker to On or Off mode.
93 bool SetSpeakerStatus(bool setSpeaker);
94 //Get the speaker status
95 bool IsSpeakerOn(void);
97 void SendDTMFSignal(Tizen::Base::String& textToBeSent);
98 //Function to get the conference call info
99 CallInfo* GetConferenceCallInfoN(void);
100 //Split this call from the conference call
101 void SplitFromConference(SplitConfCallerCmdIds splitCallerCmdId, Tizen::Base::Collection::IListT<CallInfo>* pConfCallList);
102 //End this single call from the conference call
103 void EndCallFromConference(EndConfCallerCmdIds endCallerCmdId, Tizen::Base::Collection::IListT<CallInfo>* pConfCallList);
104 //returns true, if split operation is allowed. Else, returns false.
105 bool IsSplitAllowed(void);
106 //Accept the incoming call as per the options
107 void AcceptIncomingCall(CallAnswerOptions answerOptions,int callHandle);
108 //Reject an incoming call and send message, if required.
109 bool RejectCall(int callHandle, bool sendMsg, const Tizen::Base::String& contactNumber);
110 //Get the current call count
111 int GetCurrentCallCount(void);
112 //Get the current call list
113 Tizen::Base::Collection::IListT<CallInfo>* GetCallListN(void);
114 //Check if modem and sim initialization is complete.
115 bool CheckSimInitializationIsCompleted();
116 //This function returns true, if contact number is emergency no.
117 bool IsEmergencyNumber(const Tizen::Base::String& phoneNumber, bool isSimInitialized);
118 //Start the alert in case of incoming call
119 void StartAlert(CallInfo& incomingCallInfo);
120 //Stop the alert in case of incoming call
121 void StopAlert(void);
122 //Gets the contact for the given phonenumber.returns null if not present.
123 Tizen::Social::Contact* GetContactN(const Tizen::Base::String& phoneNumber);
124 //Fetch the incoming call details.
125 CallInfo* FetchIncomingCallDetailsN(const Tizen::Base::String& callHandle, const Tizen::Base::String& contactNumber);
126 //Function is used to auto reject the call based on call settings and return true, if rejected.
127 bool CheckIncomingCallToBeRejected(CallInfo* pIncomingCallInfo);
129 //Event Listener methods from ITelephonyEventListener
130 virtual void HandleCallConnected(Tizen::Base::Collection::IListT<CallInfo>& pCallList);
131 virtual void HandleCallDisconnected(bool isLastCall, Tizen::Base::Collection::IListT<CallInfo>& pCallList);
132 virtual void HandleConferenceCall(CallInfo& pCallInfo);
133 virtual void HandleIncomingCall(CallInfo& pCallInfo);
134 virtual void HandleCallSwapOccured(Tizen::Base::Collection::IListT<CallInfo>& pCallList);
135 virtual void HandleConferenceChange(void);
136 virtual void HandleTelephonyError(int errorCode);
137 //From IAppControlResponseListener
138 virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
141 static CallPresentationModel* __pInstance;
142 //to forward telephony events
143 ITelephonyEventListener* __pTelEventListener;
144 TelephonyManager* __pTelephonyMgr;
145 SettingsPresentationModel* __pSettingsPresentor;
146 // This is only to save PhoneApp from closing when only 1 incoming call is present and
147 // incoming call is rejected with "Reject With message" by opening Msg AppControl.
148 bool __isMessageAppControlRunning;
151 #endif // _PHN_CALL_PRESENTATION_MODEL_H_