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 @n
154 * (%http://tizen.org/privilege/systeminfo is deprecated.)
156 * @return An error code
157 * @param[out] networkStatus The network status
158 * @exception E_SUCCESS The method is successful.
159 * @exception E_NETWORK_UNAVAILABLE The operation has failed because the device is in the offline mode.
160 * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode.
161 * @exception E_SYSTEM A system error has occurred.
162 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
164 result GetNetworkStatus(NetworkStatus& networkStatus) const;
167 * Gets the network information.
171 * @privilege %http://tizen.org/privilege/telephony @n
172 * (%http://tizen.org/privilege/systeminfo is deprecated.)
174 * @return An error code
175 * @param[out] networkInfo The network information
176 * @exception E_SUCCESS The method is successful.
177 * @exception E_NETWORK_UNAVAILABLE The operation has failed because the device is in the offline mode.
178 * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode.
179 * @exception E_SYSTEM A system error has occurred.
180 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
182 result GetNetworkInfo(NetworkInfo& networkInfo) const;
185 * Sets the listener for receiving the responses of the search network and the network selection mode.
189 * @privlevel platform
190 * @privilege %http://tizen.org/privilege/telephonymanager
192 * @return An error code
193 * @param[in] pListener An instance of ITelephonyNetworkSettingListener @n
194 * The parameter can be set to @c null to remove the listener.
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_SYSTEM A system error has occurred.
197 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
199 result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener);
202 * Gets the network selection mode.
206 * @privlevel platform
207 * @privilege %http://tizen.org/privilege/telephonymanager
209 * @return An error code
210 * @exception E_SUCCESS The method is successful.
211 * @exception E_OPERATION_FAILED This request operation has failed due to an internal error.
212 * @exception E_SYSTEM A system error has occurred.
213 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
214 * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionModeReceived()
216 result GetNetworkSelectionMode(void);
219 * Selects the manually searched network.
223 * @privlevel platform
224 * @privilege %http://tizen.org/privilege/telephonymanager
226 * @return An error code
227 * @param[out] networkInfo The network information
228 * @exception E_SUCCESS The method is successful.
229 * @exception E_OPERATION_FAILED This request operation has failed due to an internal error.
230 * @exception E_SYSTEM A system error has occurred.
231 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
232 * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted()
234 result SelectNetwork(const NetworkInfo& networkInfo);
237 * Selects the network automatically.
241 * @privlevel platform
242 * @privilege %http://tizen.org/privilege/telephonymanager
244 * @return An error code
245 * @exception E_SUCCESS The method is successful.
246 * @exception E_OPERATION_FAILED This request operation has failed due to an internal error.
247 * @exception E_SYSTEM A system error has occurred.
248 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
249 * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted()
251 result SelectNetwork(void);
254 * Searches for an available network.
258 * @privlevel platform
259 * @privilege %http://tizen.org/privilege/telephonymanager
261 * @return An error code
262 * @exception E_SUCCESS The method is successful.
263 * @exception E_OPERATION_FAILED This request operation has failed due to an internal error.
264 * @exception E_SYSTEM A system error has occurred.
265 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
266 * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSearchCompletedN()
268 result SearchNetwork(void);
273 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
275 * @param[in] rhs An instance of %NetworkManager
277 NetworkManager(const NetworkManager& rhs);
280 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
282 * @param[in] rhs An instance of %NetworkManager
284 NetworkManager& operator =(const NetworkManager& rhs);
287 _NetworkManagerImpl * __pNetworkManagerImpl;
289 friend class _NetworkManagerImpl;
292 }} // Tizen::Telephony
293 #endif // _FTEL_NETWORK_MANAGER_H_