1.Disconnecting call when no network 2.Support for Automatic:4dir
[apps/osp/Call.git] / inc / CallTelephonyManager.h
index 3f2e543..07053fa 100644 (file)
 
 #include <FBase.h>
 #include <FSocial.h>
+#include <FTelephony.h>
 #include "ITapiCall.h"
 #include "TapiUtility.h"
 #include "CallITelephonyEventListener.h"
 #include "CallSoundManager.h"
 #include "CalllogManager.h"
 
-class CallInfo;
+class AppCallInfo;
 class SettingsManager;
 
 /**
@@ -40,6 +41,7 @@ class SettingsManager;
  * And register to telephony events, interact with TAPI library.
  */
 class TelephonyManager
+: public Tizen::Telephony::ITelephonyNetworkEventListener
 {
 public:
        //Get singleton instance
@@ -80,13 +82,13 @@ public:
        //Function to check if split operation is allowed from the conference
        bool IsSplitAllowed(void);
        //Function to get the conference call info
-       CallInfo* GetConferenceCallInfoN(void);
+       AppCallInfo* GetConferenceCallInfoN(void);
        //Get the current call list
-       Tizen::Base::Collection::IListT<CallInfo>* GetCallListN(void);
+       Tizen::Base::Collection::IListT<AppCallInfo>* GetCallListN(void);
        //Get the current call count
        int GetCurrentCallCount(void);
        //Start the alert in case of incoming call
-       void StartAlert(CallInfo& incomingCallInfo);
+       void StartAlert(AppCallInfo& incomingCallInfo);
        //Stop the alert in case of incoming call
        void StopAlert(void);
        //Main Callback function used while registering to TAPI
@@ -114,20 +116,22 @@ public:
        //Gets the contact for the given phonenumber.returns null if not present.
        Tizen::Social::Contact* GetContactN(const Tizen::Base::String& phoneNumber);
        //This function make a synchronus API call to TAPI to fetch active/waiting incoming calls.
-       CallInfo* FetchIncomingCallHandleN(const Tizen::Base::String& callHandle, const Tizen::Base::String& contactNumber);
+       AppCallInfo* FetchIncomingCallHandleN(const Tizen::Base::String& callHandle, const Tizen::Base::String& contactNumber);
        //This callback function is called by TAPI each time for every single call.
        static void HandleIncomingCallStatusCallBack(TelCallStatus_t* pCallStatus, void* pUserData);
        //function used to process incoming call and decide whether to reject call based on call settings.
        //Rejects the call and returns true, Else returns false.
-       bool CheckIncomingCallToBeRejected(CallInfo* pIncomingCallInfo);
+       bool CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo);
        //End all active
        void EndAllCalls(void);
+       //From ITelephonyNetworkEventListener
+       virtual void OnTelephonyNetworkStatusChanged(const Tizen::Telephony::NetworkStatus& networkStatus);
        
 protected:
        //function to handle the idle callback(received when call is ended)
        void HandleIdleCallBack(void* pData);
        //function used to handle events for normal call disconnected.
-       bool HandleEndNormalActiveCall(CallInfo& endCallInfo);
+       bool HandleEndNormalActiveCall(AppCallInfo& endCallInfo);
        //function to handle the active callback(received when call is connected)
        void HandleActiveCallBack(void* pData);
        //function to handle call connected successfully
@@ -135,7 +139,7 @@ protected:
        //function to handle the dial call callback
        void HandleDialingCallBack(void* pData);
        //function to handle ending of single participant in conference call.
-       bool HandleParticipantEndedFromConference(unsigned int participantCallHandle, CallInfo& conferenceCall);
+       bool HandleParticipantEndedFromConference(unsigned int participantCallHandle, AppCallInfo& conferenceCall);
 
 private:
        //create a singleton instance
@@ -156,7 +160,7 @@ private:
        //unregister from the TAPI events
        void UnregisterEvents(void);
        //internal function to hold an active call
-       result HoldActiveCall(CallInfo* pActiveCallInfo, bool holdCall);
+       result HoldActiveCall(AppCallInfo* pActiveCallInfo, bool holdCall);
        //internal function to make a call
        result DialOutgoingCall(Tizen::Base::String& contactNumber, bool isEmergency);
        //internal function to handle waiting call options when single call is present
@@ -164,7 +168,7 @@ private:
        //internal function to handle waiting call options when multiple calls are present
        result AcceptMultipleCall(CallAnsweringOptions answerOptions, const int incomingCallHandle);
        //internal function to End Call
-       result EndCall(CallInfo& endCallInfo);
+       result EndCall(AppCallInfo& endCallInfo);
        /**
         * This function is internally used to fetch contact person details -
         * display name & photo id from AddressBook for the given phone number.
@@ -176,19 +180,19 @@ private:
        //check if given contact number is valid and returns 'E_SUCCESS', else 'E_FAILURE'.
        result CheckValidTelePhoneNumber(const Tizen::Base::String& contactNumber);
        //Used to save ended call Log info to Logs database.
-       void SaveCallInfoToLogsDb(CallInfo& endCallInfo);
+       void SaveCallInfoToLogsDb(AppCallInfo& endCallInfo);
 
 private:
        static TelephonyManager* __pManager;
 
        //Outgoing call Info
-       CallInfo* __pDialedCall;
+       AppCallInfo* __pDialedCall;
        //Incoming call Info
-       CallInfo* __pIncomingCall;
+       AppCallInfo* __pIncomingCall;
        //Active Calls - only 2 active calls at any time
        //can hold both Single or Conf. Calls
        //mapping of "Call handle" to "CallInfo"
-       Tizen::Base::Collection::HashMapT<long, CallInfo>* __pActiveCallList;
+       Tizen::Base::Collection::HashMapT<long, AppCallInfo>* __pActiveCallList;
 
        //Listener for telephony events
        ITelephonyEventListener* __pEventListener;
@@ -207,6 +211,7 @@ private:
        bool __isSpeakerOn;
        SoundManager* __pSoundManager;
        CallLogManager* __pCalllogMgr;
+       Tizen::Telephony::NetworkManager* __pNetworkManager;
 };
 
 #endif // _PHN_TELEPHONY_MANAGER_H_