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_
27 #include "CallTypes.h"
28 #include "CallITelephonyEventListener.h"
29 #include "CalllogManager.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 EndActiveCall(Tizen::Base::Long callHandle);
67 void EndDialingCall(Tizen::Base::String& contactNumber);
68 //End the conference call
69 bool EndConferenceCall(void);
70 //Ends all active calls
71 void EndAllCall(void);
74 * @returns true if successful.
76 bool HoldCall(Tizen::Base::Long callHandle);
79 * @returns true if successful.
81 bool UnHoldCall(Tizen::Base::Long callHandle);
82 //Hold conference call
83 bool HoldConferenceCall(void);
84 //UnHold conference call
85 bool ActivateConferenceCall(void);
86 //Join active and held call to conference call.
88 //Swap between active and held call
91 bool SetMuteStatus(bool setMute);
92 //Get the call Muted status
93 bool IsCallMuted(void);
94 //Set speaker to On or Off mode.
95 bool SetSpeakerStatus(bool setSpeaker);
96 //Get the speaker status
97 bool IsSpeakerOn(void);
99 void SendDTMFSignal(Tizen::Base::String& textToBeSent);
100 //Function to get the conference call info
101 AppCallInfo* GetConferenceCallInfoN(void);
102 //Split this call from the conference call
103 void SplitFromConference(SplitConfCallerCmdIds splitCallerCmdId, Tizen::Base::Collection::IListT<AppCallInfo>* pConfCallList);
104 //End this single call from the conference call
105 void EndCallFromConference(EndConfCallerCmdIds endCallerCmdId, Tizen::Base::Collection::IListT<AppCallInfo>* pConfCallList);
106 //returns true, if split operation is allowed. Else, returns false.
107 bool IsSplitAllowed(void);
108 //Accept the incoming call as per the options
109 void AcceptIncomingCall(CallAnsweringOptions answerOptions,int callHandle);
110 //Reject an incoming call and send message, if required.
111 bool RejectCall(int callHandle, bool sendMsg, const Tizen::Base::String& contactNumber);
112 //Function used to add call
113 void AddCall(const Tizen::Base::String& phoneNumber);
114 //Get the current call count
115 int GetCurrentCallCount(void);
116 //Get the current call list
117 Tizen::Base::Collection::IListT<AppCallInfo>* GetCallListN(void);
118 //Check if modem and sim initialization is complete.
119 bool CheckSimInitializationIsCompleted();
120 //This function returns true, if contact number is emergency no.
121 bool IsEmergencyNumber(const Tizen::Base::String& phoneNumber, bool isSimInitialized);
122 //Start the alert in case of incoming call
123 void StartAlert(AppCallInfo& incomingCallInfo);
124 //Stop the alert in case of incoming call
125 void StopAlert(void);
126 //Gets the contact for the given phonenumber.returns null if not present.
127 Tizen::Social::Contact* GetContactN(const Tizen::Base::String& phoneNumber);
128 //Fetch the incoming call details.
129 AppCallInfo* FetchIncomingCallDetailsN(const Tizen::Base::String& callHandle, const Tizen::Base::String& contactNumber);
130 //Function is used to auto reject the call based on call settings and return true, if rejected.
131 bool CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo);
132 //Launch dial appcontrol for add call senario
133 result LaunchDialAppControl();
135 //Event Listener methods from ITelephonyEventListener
136 virtual void HandleCallConnected(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList);
137 virtual void HandleCallDisconnected(bool isLastCall, Tizen::Base::Collection::IListT<AppCallInfo>& pCallList);
138 virtual void HandleConferenceCall(AppCallInfo& pCallInfo);
139 virtual void HandleIncomingCall(AppCallInfo& pCallInfo);
140 virtual void HandleCallSwapOccured(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList);
141 virtual void HandleConferenceChange(void);
142 virtual void HandleTelephonyError(int errorCode);
143 //From IAppControlResponseListener
144 virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
145 virtual void OnAppForeground(void);
148 static CallPresentationModel* __pInstance;
149 //to forward telephony events
150 ITelephonyEventListener* __pTelEventListener;
151 TelephonyManager* __pTelephonyMgr;
152 SettingsPresentationModel* __pSettingsPresentor;
153 // This is only to save PhoneApp from closing when only 1 incoming call is present and
154 // incoming call is rejected with "Reject With message" by opening Msg AppControl.
155 bool __isMessageAppControlRunning;
156 bool __isDialAppControlRunning;
159 #endif // _PHN_CALL_PRESENTATION_MODEL_H_