abf921ff53f3e2427d36403c5e8d6c196dc857f1
[platform/framework/native/telephony.git] / inc / FTelCallManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file  FTelCallManager.h
19  * @brief This is the header file for the %CallManager class.
20  *
21  * This header file contains the declarations of the %CallManager class.
22  */
23 #ifndef _FTEL_CALL_MANAGER_H_
24 #define _FTEL_CALL_MANAGER_H_
25
26
27 #include <FBase.h>
28 #include <FTelTypes.h>
29 #include <FTelCallInfo.h>
30 #include <FTelITelephonyCallEventListener.h>
31 #include <FTelITelephonyCallForwardListener.h>
32
33
34 namespace Tizen { namespace Telephony
35 {
36 class _CallManagerImpl;
37
38 /**
39  * @class       CallManager
40  * @brief       This class provides methods to obtain information about the current call.
41  *
42  * @since       2.0
43  *
44  * The %CallManager class provides methods to obtain information about the current call type and its status.
45  *
46  * The following example demonstrates how to use the %CallManager class to obtain information about a call.
47  *
48  * @code
49  *
50  *      result
51  *      MyClass::GetCallInfo(void)
52  *      {
53  *              CallType callType = TYPE_UNDEFINED_CALL;
54  *              CallStatus callStatus = CALL_STATUS_UNDEFINED;
55  *
56  *              CallManager* pCallManager = new CallManager();
57  *
58  *              result r = pCallManager->Construct(*this);
59  *              if (IsFailed(r))
60  *              {
61  *                      delete pCallManager;
62  *                      return r;
63  *              }
64  *
65  *              callStatus = pCallManager->GetCurrentCallStatus();
66  *
67  *              if (callStatus == CALL_STATUS_COMMUNICATING)
68  *              {
69  *                      callType = pCallManager->GetCurrentCallType();
70  *              }
71  *
72  *              delete pCallManager;
73  *              return E_SUCCESS;
74  *      }
75  *
76  *      void
77  *      MyClass::OnTelephonyCallStatusChangedN(CallStatus  callStatus,CallInfo *  pCallInfo)
78  *      {
79  *              CallType        callType;
80  *              String          number;
81  *
82  *              if (callStatus == CALL_STATUS_RINGING)
83  *              {
84  *                      callType  = pCallInfo->GetCallType();
85  *                      number = pCallInfo->GetNumber();
86  *              }
87  *
88  *              delete pCallInfo;
89  *      }
90  *
91  *
92  * @endcode
93  */
94 class _OSP_EXPORT_ CallManager
95         : public Tizen::Base::Object
96 {
97 public:
98         /**
99      *   The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
100      *
101      * @since   2.0
102      */
103         CallManager(void);
104
105         /**
106      * This destructor overrides Tizen::Base::Object::~Object().
107      *
108      * @since   2.0
109      */
110         virtual ~CallManager(void);
111
112         /**
113      * Initializes a new instance of this class. @n
114      * This is the two phase construction.
115      *
116      * @since   2.0
117          *
118      * @return  An error code
119      * @exception   E_SUCCESS           The method is successful.
120      * @exception   E_SYSTEM            A system error has occurred.
121            * @exception   E_UNSUPPORTED_OPERATION       The device does not support the telephony feature. @b Since: @b 2.1
122      */
123         result Construct(void);
124
125         /**
126      * Initializes a new instance of this class. @n
127      * This is the two phase construction.
128      *
129      * @since   2.0
130          *
131      * @return  An error code
132      * @param[in]   listener  The listener for change in status of a call
133      * @exception   E_SUCCESS The method is successful.
134      * @exception   E_SYSTEM  A system error has occurred.
135            * @exception   E_UNSUPPORTED_OPERATION       The device does not support the telephony feature. @b Since: @b 2.1
136      */
137         result Construct(ITelephonyCallEventListener& listener);
138
139         /**
140      * Sets the listener that listens to the call forwarding request.
141      *
142      * @since   2.0
143          *
144      * @privlevel       platform
145      * @privilege   %http://tizen.org/privilege/callforward
146      *
147      * @return  An error code
148      * @param[in]   pListener           An ITelephonyCallForwardListener instance @n
149      *                                  The parameter can be set to @c null to remove listener.
150      * @exception   E_SUCCESS           The method is successful.
151      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
152      * @exception   E_SYSTEM            A system error has occurred.
153      */
154         result SetCallForwardListener(ITelephonyCallForwardListener* pListener);
155
156         /**
157      * Requests call forwarding with the specified number. @n
158      * This method sends the request to the network, and receives the response asynchronously.
159      *
160      * @since   2.0
161          *
162      * @privlevel       platform
163      * @privilege   %http://tizen.org/privilege/callforward
164      *
165      * @return  An error code
166      * @param[in]   phoneNumber The phone number for call forwarding
167      * @exception   E_SUCCESS               The method is successful.
168      * @exception   E_INVALID_STATE         This instance is in an invalid state.
169      * @exception   E_INVALID_FORMAT        The specified phone number is in an invalid format.
170      * @exception   E_IN_PROGRESS           The previous request is in progress.
171      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
172      * @exception   E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
173      * @exception   E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
174      * @exception   E_SYSTEM                A system error has occurred.
175      * @remarks The call will be forwarded unconditionally. Voice call only. @n
176      *          The phone number can start with plus(+) and the remaining part must be number.
177      * @see ITelephonyCallForwardListener::OnTelephonyCallForwardResponseReceived()
178      */
179         result RequestCallForward(const Tizen::Base::String& phoneNumber);
180
181     /**
182      * Stops call forwarding.
183      *
184      * @since   2.0
185          *
186      * @privlevel       platform
187      * @privilege   %http://tizen.org/privilege/callforward
188      *
189      * @return  An error code
190      * @exception       E_SUCCESS               The method is successful.
191      * @exception       E_INVALID_STATE         This instance is in an invalid state.
192      * @exception       E_IN_PROGRESS           The previous request is in progress.
193      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
194      * @exception       E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
195      * @exception       E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
196      * @exception       E_SYSTEM                A system error has occurred.
197      * @see ITelephonyCallForwardListener::OnTelephonyCallForwardStopped()
198      */
199         result StopCallForward(void);
200
201         /**
202      * Gets the phone number to which the call must be forwarded.
203      *
204      * @since   2.0
205          *
206      * @privlevel       platform
207      * @privilege   %http://tizen.org/privilege/callforward
208      *
209      * @return  An error code
210      * @exception   E_SUCCESS               The method is successful.
211      * @exception   E_IN_PROGRESS           The previous request is in progress.
212      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
213      * @exception   E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
214      * @exception   E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
215      * @exception   E_SYSTEM                A system error has occurred.
216      * @see ITelephonyCallForwardListener::OnTelephonyCallForwardNumberReceived
217      */
218         result GetCallForwardNumber(void) const;
219
220         /**
221      * Gets the call type of the current call.
222      *
223      * @since                   2.0
224          *
225      * @return      The current call type, @n
226      *              else @c TYPE_UNDEFINED_CALL if the method fails
227      */
228         CallType GetCurrentCallType(void) const;
229
230         /**
231      * Gets the call status of the current call.
232      *
233      * @since                   2.0
234          *
235      * @return      The current call status, @n
236      *              else @c CALL_STATUS_UNDEFINED if the method fails
237      */
238         CallStatus GetCurrentCallStatus(void) const;
239
240 private:
241         /**
242      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
243      *
244      * @param[in]       rhs     An instance of %CallManager
245      */
246         CallManager(const CallManager& rhs);
247
248         /**
249      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
250      *
251      * @param[in]       rhs     An instance of %CallManager
252      */
253         CallManager& operator =(const CallManager& rhs);
254
255 private:
256         _CallManagerImpl* __pCallManagerImpl;
257
258         friend class _CallManagerImpl;
259 }; // CallManager
260
261 } } // Tizen::Telephony
262 #endif // _FTEL_CALL_MANAGER_H_