Modified doxygen sample code.
[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  *  #include <FBase.h>
52  *  #include <FTelephony.h>
53  *
54  *   using namespace Tizen::Base;
55  *   using namespace Tizen::Telephony;
56  *
57  *   class MyClass
58  *       : public Object
59  *       , public ITelephonyNetworkEventListener
60  *   {
61  *     public:
62  *       MyClass(void) {}
63  *       ~MyClass(void) {}
64  *
65  *       // ITelephonyNetworkEventListener
66  *       void OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus);
67  *
68  *       void GetNetworkManagerInfo(void);
69  *   };
70  *
71  *   void
72  *   MyClass::OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus)
73  *   {
74  *       bool isCallAvailable = networkStatus.IsCallServiceAvailable();
75  *       bool isDataAvailable = networkStatus.IsDataServiceAvailable();
76  *       bool isRoaming = networkStatus.IsRoaming();
77  *   }
78  *
79  *   void
80  *   MyClass::GetNetworkManagerInfo(void)
81  *   {
82  *       NetworkStatus networkStatus;
83  *       NetworkInfo networkInfo;
84  *
85  *       NetworkManager* pNetworkManager = new (std::nothrow) NetworkManager();
86  *       result r = pNetworkManager->Construct(this);
87  *       if (IsFailed(r))
88  *       {
89  *               delete pNetworkManager;
90  *               return;
91  *       }
92  *
93  *       r = pNetworkManager->GetNetworkStatus(networkStatus);
94  *       if (IsFailed(r))
95  *       {
96  *               delete pNetworkManager;
97  *               return;
98  *       }
99  *
100  *       r = pNetworkManager->GetNetworkInfo(networkInfo);
101  *       if (IsFailed(r))
102  *       {
103  *               delete pNetworkManager;
104  *               return;
105  *       }
106  *
107  *       delete pNetworkManager;
108  *   }
109  *
110  * @endcode
111  */
112 class _OSP_EXPORT_ NetworkManager
113         : public Tizen::Base::Object
114 {
115 public:
116         /**
117      * 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.
118      *
119      * @since   2.0
120      */
121         NetworkManager(void);
122
123         /**
124      *  This destructor overrides Tizen::Base::Object::~Object().
125      *
126      * @since   2.0
127      */
128         virtual ~NetworkManager(void);
129
130         /**
131      *  Initializes a new instance of this class. @n
132      *  This is the two phase construction.
133          * If a @c null pointer is passed during the construction, then there
134      *  is no listener for telephony network status change callbacks.
135      *
136      * @since           2.0
137          * @feature     %http://tizen.org/feature/network.telephony
138      * @return          An error code
139          * @param[in]   pListener       The listener for change in status of a telephony network
140      * @exception       E_SUCCESS               The method is successful.
141      * @exception       E_SYSTEM                A system error has occurred.
142          * @exception   E_UNSUPPORTED_OPERATION  The Emulator or target device does not support the required feature. @b Since: @b 2.1
143          *                                                                               For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
144          * @remarks     Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
145      */
146         result Construct(ITelephonyNetworkEventListener* pListener);
147
148         /**
149      * Gets the network status.
150      *
151      * @since           2.0
152      * @privlevel       public
153      * @privilege   %http://tizen.org/privilege/telephony
154      *
155      * @return          An error code
156      * @param[out]      networkStatus   The network status
157      * @exception       E_SUCCESS       The method is successful.
158      * @exception       E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
159      * @exception       E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
160      * @exception       E_SYSTEM        A system error has occurred.
161      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
162      */
163         result GetNetworkStatus(NetworkStatus& networkStatus) const;
164
165         /**
166      * Gets the network information.
167      *
168      * @since   2.0
169      * @privlevel       public
170      * @privilege   %http://tizen.org/privilege/telephony
171      *
172      * @return  An error code
173      * @param[out]      networkInfo     The network information
174      * @exception       E_SUCCESS       The method is successful.
175      * @exception       E_NETWORK_UNAVAILABLE   The operation has failed because the device is in the offline mode.
176      * @exception       E_SERVICE_UNAVAILABLE   The operation has failed because the device is out of the coverage area or in the emergency mode.
177      * @exception       E_SYSTEM        A system error has occurred.
178      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
179      */
180         result GetNetworkInfo(NetworkInfo& networkInfo) const;
181
182     /**
183      * Sets the listener for receiving the responses of the search network and the network selection mode.
184      *
185      * @since 2.0
186      *
187      * @privlevel       platform
188      * @privilege   %http://tizen.org/privilege/telephonymanager
189      *
190      * @return  An error code
191      * @param[in]   pListener           An instance of ITelephonyNetworkSettingListener @n
192      *                                  The parameter can be set to @c null to remove the listener.
193      * @exception   E_SUCCESS           The method is successful.
194      * @exception   E_SYSTEM            A system error has occurred.
195      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
196      */
197     result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener);
198
199     /**
200      * Gets the network selection mode.
201      *
202      * @since 2.0
203      *
204      * @privlevel       platform
205      * @privilege   %http://tizen.org/privilege/telephonymanager
206      *
207      * @return  An error code
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::OnTelephonyNetworkSelectionModeReceived()
213      */
214     result GetNetworkSelectionMode(void);
215
216     /**
217      * Selects the manually searched network.
218      *
219      * @since 2.0
220      *
221      * @privlevel       platform
222      * @privilege   %http://tizen.org/privilege/telephonymanager
223      *
224      * @return  An error code
225      * @param[out]      networkInfo     The network information
226      * @exception   E_SUCCESS   The method is successful.
227      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
228      * @exception   E_SYSTEM                A system error has occurred.
229      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
230      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted()
231      */
232     result SelectNetwork(const NetworkInfo& networkInfo);
233
234     /**
235      * Selects the network automatically.
236      *
237      * @since 2.0
238      *
239      * @privlevel       platform
240      * @privilege   %http://tizen.org/privilege/telephonymanager
241      *
242      * @return  An error code
243      * @exception   E_SUCCESS   The method is successful.
244      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
245      * @exception   E_SYSTEM                A system error has occurred.
246      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
247      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted()
248      */
249     result SelectNetwork(void);
250
251     /**
252      * Searches for an available network.
253      *
254      * @since 2.0
255      *
256      * @privlevel       platform
257      * @privilege   %http://tizen.org/privilege/telephonymanager
258      *
259      * @return  An error code
260      * @exception   E_SUCCESS   The method is successful.
261      * @exception   E_OPERATION_FAILED      This request operation has failed due to an internal error.
262      * @exception   E_SYSTEM                A system error has occurred.
263      * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
264      * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSearchCompletedN()
265      */
266     result SearchNetwork(void);
267
268
269 private:
270         /**
271      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
272      *
273      * @param[in]       rhs     An instance of %NetworkManager
274      */
275         NetworkManager(const NetworkManager& rhs);
276
277         /**
278      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
279      *
280      * @param[in]       rhs     An instance of %NetworkManager
281      */
282         NetworkManager& operator =(const NetworkManager& rhs);
283
284 private:
285         _NetworkManagerImpl * __pNetworkManagerImpl;
286
287         friend class _NetworkManagerImpl;
288 }; // NetworkManager
289
290 }} // Tizen::Telephony
291 #endif // _FTEL_NETWORK_MANAGER_H_