2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FTelNetworkManager.h
19 * @brief This is the header file for the %NetworkManager class.
21 * This header file contains the declarations of the %NetworkManager class.
23 #ifndef _FTEL_NETWORK_MANAGER_H_
24 #define _FTEL_NETWORK_MANAGER_H_
28 #include <FTelNetworkInfo.h>
29 #include <FTelNetworkStatus.h>
32 namespace Tizen { namespace Telephony
34 class _NetworkManagerImpl;
35 class ITelephonyNetworkEventListener;
36 class ITelephonyNetworkSettingListener;
39 * @class NetworkManager
40 * @brief This class provides information about the current active network.
44 * The %NetworkManager class is used to register listeners who monitor network status changes,
45 * as well as get information about current active network.
47 * The following example demonstrates how to use the %NetworkManager class to get the network information.
52 * #include <FTelephony.h>
54 * using namespace Tizen::Base;
55 * using namespace Tizen::Telephony;
59 * , public ITelephonyNetworkEventListener
65 * // ITelephonyNetworkEventListener
66 * void OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus);
68 * void GetNetworkManagerInfo(void);
72 * MyClass::OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus)
74 * bool isCallAvailable = networkStatus.IsCallServiceAvailable();
75 * bool isDataAvailable = networkStatus.IsDataServiceAvailable();
76 * bool isRoaming = networkStatus.IsRoaming();
80 * MyClass::GetNetworkManagerInfo(void)
82 * NetworkStatus networkStatus;
83 * NetworkInfo networkInfo;
85 * NetworkManager* pNetworkManager = new (std::nothrow) NetworkManager();
86 * result r = pNetworkManager->Construct(this);
89 * delete pNetworkManager;
93 * r = pNetworkManager->GetNetworkStatus(networkStatus);
96 * delete pNetworkManager;
100 * r = pNetworkManager->GetNetworkInfo(networkInfo);
103 * delete pNetworkManager;
107 * delete pNetworkManager;
112 class _OSP_EXPORT_ NetworkManager
113 : public Tizen::Base::Object
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.
121 NetworkManager(void);
124 * This destructor overrides Tizen::Base::Object::~Object().
128 virtual ~NetworkManager(void);
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.
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.
146 result Construct(ITelephonyNetworkEventListener* pListener);
149 * Gets the network status.
153 * @privilege %http://tizen.org/privilege/telephony
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.
163 result GetNetworkStatus(NetworkStatus& networkStatus) const;
166 * Gets the network information.
170 * @privilege %http://tizen.org/privilege/telephony
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.
180 result GetNetworkInfo(NetworkInfo& networkInfo) const;
183 * Sets the listener for receiving the responses of the search network and the network selection mode.
187 * @privlevel platform
188 * @privilege %http://tizen.org/privilege/telephonymanager
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.
197 result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener);
200 * Gets the network selection mode.
204 * @privlevel platform
205 * @privilege %http://tizen.org/privilege/telephonymanager
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()
214 result GetNetworkSelectionMode(void);
217 * Selects the manually searched network.
221 * @privlevel platform
222 * @privilege %http://tizen.org/privilege/telephonymanager
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()
232 result SelectNetwork(const NetworkInfo& networkInfo);
235 * Selects the network automatically.
239 * @privlevel platform
240 * @privilege %http://tizen.org/privilege/telephonymanager
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()
249 result SelectNetwork(void);
252 * Searches for an available network.
256 * @privlevel platform
257 * @privilege %http://tizen.org/privilege/telephonymanager
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()
266 result SearchNetwork(void);
271 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
273 * @param[in] rhs An instance of %NetworkManager
275 NetworkManager(const NetworkManager& rhs);
278 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
280 * @param[in] rhs An instance of %NetworkManager
282 NetworkManager& operator =(const NetworkManager& rhs);
285 _NetworkManagerImpl * __pNetworkManagerImpl;
287 friend class _NetworkManagerImpl;
290 }} // Tizen::Telephony
291 #endif // _FTEL_NETWORK_MANAGER_H_