2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
19 * @file FNetNetAccountManager.h
20 * @brief This is the header file for the %NetAccountManager class.
22 * This header file contains the declarations of the %NetAccountManager class.
24 #ifndef _FNET_NET_ACCOUNT_MANAGER_H_
25 #define _FNET_NET_ACCOUNT_MANAGER_H_
27 #include <FBaseString.h>
28 #include <FBaseObject.h>
29 #include <FBaseResult.h>
30 #include <FBaseColIList.h>
31 #include <FBaseColArrayList.h>
32 #include <FBaseColArrayListT.h>
33 #include <FNetNetTypes.h>
34 #include <FNetNetAccountInfo.h>
36 namespace Tizen { namespace Net
38 class _NetAccountManagerImpl;
41 * @class NetAccountManager
42 * @brief This class provides methods for creating, deleting, and administering network accounts in the system.
46 * The %NetAccountManager class provides methods for creating, deleting, and administering components that can be used for configuring the
47 * network accounts. These accounts can then be used for connecting to the network.
49 * For more information on the class features, see
50 * <a href="../org.tizen.native.appprogramming/html/guide/net/network_accounts.htm">Network Accounts</a>.
52 class _OSP_EXPORT_ NetAccountManager
53 : public Tizen::Base::Object
57 * 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.
61 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
63 NetAccountManager(void);
66 * This destructor overrides Tizen::Base::Object::~Object().
70 virtual ~NetAccountManager(void);
73 * Initializes this instance of %NetAccountManager.
77 * @return An error code
78 * @exception E_SUCCESS The method is successful.
79 * @exception E_SYSTEM An internal initialization procedure has failed.
81 result Construct(void);
85 * Creates a new network account.
90 * @privilege %http://tizen.org/privilege/network.account
91 * @feature %http://tizen.org/feature/network.telephony
93 * @return The @c NetAccountId assigned by the creation of a new network account, @n
94 * else @c INVALID_HANDLE if an error occurs
95 * @param[in,out] netAccountInfo A NetAccountInfo instance containing network information to create an account
96 * @exception E_SUCCESS The method is successful.
97 * @exception E_INVALID_ARG The specified input parameter is invalid.
98 * @exception E_OUT_OF_MEMORY The memory is insufficient.
99 * @exception E_MAX_EXCEEDED The registry is full. @n Cannot create a new network account.
100 * @exception E_SYSTEM An internal error has occurred.
101 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
102 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
103 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
105 * - This method creates a new network account and returns a @c NetAccountId value that can be used in method calls later to operate on the
106 * account. If @c INVALID_HANDLE is returned, the specific error code can be accessed using the GetLastResult() method. A Wi-Fi account
107 * cannot be created using %NetAccountManager.
108 * - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
109 * @see GetNetAccountInfoN()
110 * @see UpdateNetAccount()
111 * @see DeleteNetAccount()
113 NetAccountId CreateNetAccount(NetAccountInfo& netAccountInfo);
116 * Deletes a network account from the registry. @n
117 * If the account is read-only or in service, the deletion fails. The Wi-Fi accounts cannot be deleted by %NetAccountManager.
122 * @privilege %http://tizen.org/privilege/network.account
124 * @return An error code
125 * @param[in] netAccountId A NetAccountId instance containing valid account information
126 * @exception E_SUCCESS The method is successful.
127 * @exception E_INVALID_ACCOUNT The specified network account is invalid.
128 * @exception E_INVALID_OPERATION This operation is not allowed on this network account instance.
129 * @exception E_SYSTEM An internal error has occurred.
130 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
131 * @remarks If the network account is created by another application, this method fails.
132 * This method must use a warning pop-up to notify the user.
133 * @see CreateNetAccount()
134 * @see GetNetAccountInfoN()
135 * @see UpdateNetAccount()
137 result DeleteNetAccount(NetAccountId netAccountId);
140 * Updates an existing network account.
145 * @privilege %http://tizen.org/privilege/network.account
146 * @feature %http://tizen.org/feature/network.telephony
148 * @return An error code
149 * @param[in] netAccountInfo A NetAccountInfo instance containing network information to update an account
150 * @exception E_SUCCESS The method is successful.
151 * @exception E_INVALID_ARG The specified input parameter is invalid.
152 * @exception E_INVALID_ACCOUNT The input is invalid.
153 * @exception E_OUT_OF_MEMORY The memory is insufficient.
154 * @exception E_SYSTEM An internal error has occurred.
155 * @exception E_INVALID_OPERATION This operation is not allowed on this network account instance.
156 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
157 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
158 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
160 * - This method fails if the network account is read-only, in service, or created by another application.
161 * A Wi-Fi account cannot be updated using %NetAccountManager.
162 * This method must use a warning pop-up to notify the user.
163 * - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
164 * @see CreateNetAccount()
165 * @see GetNetAccountInfoN()
166 * @see UpdateNetAccount()
167 * @see DeleteNetAccount()
169 result UpdateNetAccount(const NetAccountInfo& netAccountInfo);
172 * Updates an existing system network account.
176 * @privlevel platform
177 * @privilege %http://tizen.org/privilege/networkmanager
178 * @feature %http://tizen.org/feature/network.telephony or %http://tizen.org/feature/network.telephony.mms
180 * @return An error code
181 * @param[in] netAccountInfo A NetAccountInfo instance containing network information to update an account
182 * @exception E_SUCCESS The method is successful.
183 * @exception E_INVALID_ARG The specified input parameter is invalid.
184 * @exception E_INVALID_ACCOUNT The input account ID is invalid.
185 * @exception E_OPERATION_FAILED This request operation has failed due to an internal error.
186 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
187 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
188 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
189 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
190 * @see GetNetAccountInfoN()
191 * @see UpdateNetAccount()
193 result UpdateSystemNetAccount(const NetAccountInfo& netAccountInfo);
196 * Gets the information on a network account.
200 * @return A NetAccountInfo instance containing account information
201 * @param[in] netAccountId The account ID whose information is required
202 * @exception E_SUCCESS The method is successful.
203 * @exception E_INVALID_ACCOUNT The specified network account is invalid.
204 * @exception E_OUT_OF_MEMORY The memory is insufficient.
205 * @exception E_SYSTEM An internal error has occurred.
206 * @exception E_INVALID_OPERATION This operation is not allowed on this network account instance.
207 * @exception E_INVALID_PROXY The proxy address is invalid.
208 * @remarks The specific error code can be accessed using the GetLastResult() method.
209 * @remarks This method returns:
210 * - the NetAccountInfo instance for a PS account (NET_BEARER_PS) @n
211 * - the WifiNetAccountInfo instance for a WLAN account (NET_BEARER_WIFI) in the %NetAccountInfo type @n
212 * The Wi-Fi account info contains the default %NetAccountInfo and additional Wi-Fi specific information. @n
213 * To determine the type of instance returned, use the GetBearerType() method.
214 * The instance can then be cast down to %WifiNetAccountInfo and used in a NET_BEARER_WIFI case. If the
215 * application gets the last result by E_INVALID_PROXY, it must use a warning pop-up to notify the user.
216 * @see CreateNetAccount()
217 * @see UpdateNetAccount()
218 * @see DeleteNetAccount()
220 NetAccountInfo* GetNetAccountInfoN(NetAccountId netAccountId) const;
223 * Gets a list of all the accounts in the registry.
227 * @return A Tizen::Base::Collection::IList with NetAccoundIds, which are in the registry
228 * @exception E_SUCCESS The method is successful.
229 * @exception E_OBJ_NOT_FOUND The NetAccountInfo is not found in the registry.
230 * @exception E_SYSTEM An internal error has occurred.
231 * @remarks The specific error code can be accessed using the GetLastResult() method.
233 Tizen::Base::Collection::IListT <NetAccountId>* GetNetAccountIdsN(void) const;
236 * Gets a list of names of all the registered accounts.
240 * @return A Tizen::Base::Collection::IList containing the indexes to the NetAccountInfos in the registry
241 * @exception E_SUCCESS The method is successful.
242 * @exception E_OBJ_NOT_FOUND The NetAccountInfo is not found in the registry.
243 * @exception E_OUT_OF_MEMORY The memory is insufficient.
244 * @exception E_SYSTEM An internal error has occurred (baseband or system).
245 * @remarks The specific error code can be accessed using the GetLastResult() method.
247 Tizen::Base::Collection::IList* GetNetAccountNamesN(void) const;
250 * Gets a network account, which has the specified name.
254 * @return The NetAccountID with the specified name, @n
255 * else @c INVALID_HANDLE in case of an error or if NetAccountInfo is not found
256 * @param[in] netAccountName The network account name to search for
257 * @exception E_SUCCESS The method is successful.
258 * @exception E_INVALID_ARG The specified @c netAccountName is invalid or NetAccountInfo with this name does not exist.
259 * @exception E_SYSTEM An internal error has occurred.
260 * @remarks The specific error code can be accessed using the GetLastResult() method.
262 NetAccountId GetNetAccountId(const Tizen::Base::String& netAccountName) const;
265 * Gets a network account, which is set for the Tizen application on each bearer.
269 * @feature %http://tizen.org/feature/network.telephony, %http://tizen.org/feature/network.telephony.mms, %http://tizen.org/feature/network.wifi, %http://tizen.org/feature/network.wifi.direct, or %http://tizen.org/feature/usb.host
271 * @return The network account, @n
272 * else INVALID_HANDLE in case of an error or if NetAccountInfo is not found
273 * @param[in] netBearerType The network account type of bearer
274 * @exception E_SUCCESS The method is successful.
275 * @exception E_SYSTEM An internal error has occurred (baseband).
276 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
277 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
279 * - The specific error code can be accessed using the GetLastResult() method.
280 * - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
282 NetAccountId GetNetAccountId(NetBearerType netBearerType = NET_BEARER_PS) const;
285 * Gets a network account, which is set for the application like email, IM, and so on.
290 * @privilege %http://tizen.org/privilege/customnetaccount
291 * @feature %http://tizen.org/feature/network.telephony or %http://tizen.org/feature/network.telephony.mms
293 * @return The @c NetAccountID with the specified name, @n
294 * else INVALID_HANDLE is returned in case of an error or if %NetAccountInfo is not found
295 * @param[in] netProfileName The network profile name for an application such as email
296 * @exception E_SUCCESS The method is successful.
297 * @exception E_INVALID_ARG The @c netAccountName is invalid or %NetAccountInfo with this name does not exist.
298 * @exception E_SYSTEM An internal error has occurred.
299 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
300 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
301 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
303 * - The specific error code can be accessed using the GetLastResult() method.
304 * - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
306 NetAccountId GetAppNetAccountId(const Tizen::Base::String& netProfileName) const;
309 * Sets the application-wise default account ID to the one specified by the input argument value.
314 * @privilege %http://tizen.org/privilege/customnetaccount
316 * @return An error code
317 * @param[in] netAccountId The network account ID
318 * @exception E_SUCCESS The method is successful.
319 * @exception E_INVALID_ARG The specified @c netAccountId is invalid.
320 * @exception E_SYSTEM An internal error has occurred.
321 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
323 result SetNetAccountId(NetAccountId netAccountId);
327 * Gets the preferred network.
329 * @brief <i> [Deprecated] </i>
330 * @deprecated This method is deprecated because it is moved to the NetConnectionManager class.
333 * @return The preferred network, @n
334 * else @c NET_WIFI_FIRST in case of an error or if the preferred network is not set
335 * @exception E_SUCCESS The method is successful.
336 * @remarks The specific error code can be accessed using the GetLastResult() method.
339 NetPreferenceType GetNetPreference(void) const;
343 * Sets the preferred network.
345 * @brief <i> [Deprecated] </i>
346 * @deprecated This method is deprecated because it is moved to the NetConnectionManager class.
350 * @privilege %http://tizen.org/privilege/network.connection
351 * @feature %http://tizen.org/feature/network.wifi or %http://tizen.org/feature/network.telephony
353 * @return An error code
354 * @param[in] netPreference The preferred network
355 * @exception E_SUCCESS The method is successful.
356 * @exception E_INVALID_OPERATION This operation is not allowed.
357 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
358 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
359 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
361 * - If this method is not used, the default connection works in the Wi-Fi first mode.
362 * - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
365 result SetNetPreference(NetPreferenceType netPreference = NET_WIFI_FIRST);
369 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
371 * @param[in] rhs An instance of %NetAccountManager
373 NetAccountManager(const NetAccountManager& rhs);
376 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
378 * @param[in] rhs An instance of %NetAccountManager
380 NetAccountManager& operator =(const NetAccountManager& rhs);
383 _NetAccountManagerImpl* __pNetAccountManagerImpl;
385 friend class _NetAccountManagerImpl;
386 }; // NetAccountManager
389 #endif // _FNET_NET_ACCOUNT_MANAGER_H_