4e42e5ddc27619731779c667088073c3e7780fed
[platform/framework/native/telephony.git] / inc / FTelNetworkManager.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        FTelNetworkManager.h
19  * @brief       This is the header file for the %NetworkManager class.
20  *
21  * This header file contains the declarations of the %NetworkManager class.
22  */
23 #ifndef _FTEL_NETWORK_MANAGER_H_
24 #define _FTEL_NETWORK_MANAGER_H_
25
26
27 #include <FBase.h>
28 #include <FTelNetworkInfo.h>
29 #include <FTelNetworkStatus.h>
30
31
32 namespace Tizen { namespace Telephony
33 {
34 class _NetworkManagerImpl;
35 class ITelephonyNetworkEventListener;
36 class ITelephonyNetworkSettingListener;
37
38 /**
39  * @class       NetworkManager
40  * @brief       This class provides information about the current active network.
41  *
42  * @since       2.0
43  *
44  * The %NetworkManager class is used to register listeners who monitor network status changes,
45  * as well as get information about current active network.
46  *
47  * The following example demonstrates how to use the %NetworkManager class to get the network information.
48  *
49  * @code
50  *
51  *      result
52  *      MyClass::GetNetworkManagerInfo(void)
53  *      {
54  *              NetworkStatus networkStatus;
55  *              NetworkInfo networkInfo;
56  *
57  *              NetworkManager* pNetworkManager = new NetworkManager();
58  *
59  *              result r = pNetworkManager->Construct(this);
60  *              if (IsFailed(r))
61  *              {
62  *                      delete pNetworkManager;
63  *                      return r;
64  *              }
65  *
66  *              r = pNetworkManager->GetNetworkStatus(networkStatus);
67  *              if (IsFailed(r))
68  *              {
69  *                      delete pNetworkManager;
70  *                      return r;
71  *              }
72  *
73  *              r = pNetworkManager->GetNetworkInfo(networkInfo);
74  *              if (IsFailed(r))
75  *              {
76  *                      delete pNetworkManager;
77  *                      return r;
78  *              }
79  *
80  *              delete pNetworkManager;
81  *              return E_SUCCESS;
82  *      }
83  *
84  *      void
85  *      MyClass::OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus)
86  *      {
87  *              bool isCallAvail = networkStatus.IsCallServiceAvailable();
88  *              bool isDataAvail = networkStatus.IsDataServiceAvailable();
89  *              bool isRoaming = networkStatus.IsRoaming();
90  *      }
91  *
92  * @endcode
93  */
94 class _OSP_EXPORT_ NetworkManager
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         NetworkManager(void);
104
105         /**
106      *  This destructor overrides Tizen::Base::Object::~Object().
107      *
108      * @since   2.0
109      */
110         virtual ~NetworkManager(void);
111
112         /**
113      *  Initializes a new instance of this class. @n
114      *  This is the two phase construction.
115          * If a @c null pointer is passed during the construction, then there
116      *  is no listener for telephony network status change callbacks.
117      *
118      * @since           2.0
119          * @feature     %http://tizen.org/feature/network.telephony
120      * @return          An error code
121          * @param[in]   pListener       The listener for change in status of a telephony network
122      * @exception       E_SUCCESS               The method is successful.
123      * @exception       E_SYSTEM                A system error has occurred.
124          * @exception   E_UNSUPPORTED_OPERATION  The Emulator or target device does not support the required feature. @b Since: @b 2.1
125          *                                                                               For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
126          * @remarks     Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
127      */
128         result Construct(ITelephonyNetworkEventListener* pListener);
129
130         /**
131      * Gets the network status.
132      *
133      * @since           2.0
134      * @privlevel       public
135      * @privilege   %http://tizen.org/privilege/telephony
136      *
137      * @return          An error code
138      * @param[out]      networkStatus   The network status
139      * @exception       E_SUCCESS       The method is successful.
140      * @exception       E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
141      * @exception       E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
142      * @exception       E_SYSTEM        A system error has occurred.
143      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
144      */
145         result GetNetworkStatus(NetworkStatus& networkStatus) const;
146
147         /**
148      * Gets the network information.
149      *
150      * @since   2.0
151      * @privlevel       public
152      * @privilege   %http://tizen.org/privilege/telephony
153      *
154      * @return  An error code
155      * @param[out]      networkInfo     The network information
156      * @exception       E_SUCCESS       The method is successful.
157      * @exception       E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
158      * @exception       E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
159      * @exception       E_SYSTEM        A system error has occurred.
160      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
161      */
162         result GetNetworkInfo(NetworkInfo& networkInfo) const;
163
164     /**
165      * Sets the listener for receiving the responses of the search network and the network selection mode.
166      *
167      * @since 2.0
168      *
169      * @privlevel       platform
170      * @privilege   %http://tizen.org/privilege/telephonymanager
171      *
172      * @return  An error code
173      * @param[in]   pListener           An instance of ITelephonyNetworkSettingListener @n
174      *                                  The parameter can be set to @c null to remove the listener.
175      * @exception   E_SUCCESS           The method is successful.
176      * @exception   E_SYSTEM            A system error has occurred.
177      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
178      */
179     result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener);
180
181     /**
182      * Gets the network selection mode.
183      *
184      * @since 2.0
185      *
186      * @privlevel       platform
187      * @privilege   %http://tizen.org/privilege/telephonymanager
188      *
189      * @return  An error code
190      * @exception   E_SUCCESS   The method is successful.
191      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
192      * @exception   E_SYSTEM                A system error has occurred.
193      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
194      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionModeReceived()
195      */
196     result GetNetworkSelectionMode(void);
197
198     /**
199      * Selects the manually searched network.
200      *
201      * @since 2.0
202      *
203      * @privlevel       platform
204      * @privilege   %http://tizen.org/privilege/telephonymanager
205      *
206      * @return  An error code
207      * @param[out]      networkInfo     The network information
208      * @exception   E_SUCCESS   The method is successful.
209      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
210      * @exception   E_SYSTEM                A system error has occurred.
211      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
212      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted()
213      */
214     result SelectNetwork(const NetworkInfo& networkInfo);
215
216     /**
217      * Selects the network automatically.
218      *
219      * @since 2.0
220      *
221      * @privlevel       platform
222      * @privilege   %http://tizen.org/privilege/telephonymanager
223      *
224      * @return  An error code
225      * @exception   E_SUCCESS   The method is successful.
226      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
227      * @exception   E_SYSTEM                A system error has occurred.
228      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
229      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted()
230      */
231     result SelectNetwork(void);
232
233     /**
234      * Searches for an available network.
235      *
236      * @since 2.0
237      *
238      * @privlevel       platform
239      * @privilege   %http://tizen.org/privilege/telephonymanager
240      *
241      * @return  An error code
242      * @exception   E_SUCCESS   The method is successful.
243      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
244      * @exception   E_SYSTEM                A system error has occurred.
245      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
246      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSearchCompletedN()
247      */
248     result SearchNetwork(void);
249
250
251 private:
252         /**
253      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
254      *
255      * @param[in]       rhs     An instance of %NetworkManager
256      */
257         NetworkManager(const NetworkManager& rhs);
258
259         /**
260      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
261      *
262      * @param[in]       rhs     An instance of %NetworkManager
263      */
264         NetworkManager& operator =(const NetworkManager& rhs);
265
266 private:
267         _NetworkManagerImpl * __pNetworkManagerImpl;
268
269         friend class _NetworkManagerImpl;
270 }; // NetworkManager
271
272 }} // Tizen::Telephony
273 #endif // _FTEL_NETWORK_MANAGER_H_