2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (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 FNetNetConnectionManager.h
20 * @brief This is the header file for the %NetConnectionManager class.
22 * This header file contains the declarations of the %NetConnectionManager class.
24 #ifndef _FNET_NET_CONNECTION_MANAGER_H_
25 #define _FNET_NET_CONNECTION_MANAGER_H_
28 #include <FNetNetTypes.h>
29 #include <FNetNetConnection.h>
30 #include <FNetManagedNetConnection.h>
32 namespace Tizen { namespace Net
34 class _NetConnectionManagerImpl;
37 * @class NetConnectionManager
38 * @brief This class provides methods for managing the network connections.
42 * The %NetConnectionManager class provides methods for creating and retrieving connections for data communication.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/net/managing_network_connections.htm">Managing Network Connections</a>.
46 class _OSP_EXPORT_ NetConnectionManager
47 : public Tizen::Base::Object
51 * The object is not fully constructed after this constructor is called. @n
52 * For full construction, the Construct() method must be called right after calling this constructor.
56 NetConnectionManager(void);
59 * This destructor overrides Tizen::Base::Object::~Object().
63 virtual ~NetConnectionManager(void);
66 * Initializes this instance of %NetConnectionManager.
70 * @return An error code
71 * @exception E_SUCCESS The method is successful.
72 * @exception E_SYSTEM An internal error has occurred.
74 result Construct(void);
78 * Creates a new network connection.
82 * @return A NetConnection instance containing the account information, @n
83 * else @c null if an error occurs
84 * @param[in] netAccountId The index of the network account to which this %NetConnection is bound
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_INVALID_ACCOUNT The specified network account ID is invalid.
87 * @exception E_MAX_EXCEEDED Unable to setup a new connection due to too many existing connections.
88 * @exception E_OUT_OF_MEMORY The memory is insufficient.
89 * @exception E_SYSTEM An internal error has occurred.
90 * @remarks The specific error code can be accessed using the GetLastResult() method.
92 NetConnection* CreateNetConnectionN(NetAccountId netAccountId);
95 * Gets an instance of the current connection that is managed by the system.
99 * @return A ManagedNetConnection instance containing the account information, @n
100 * else @c null if an error occurs
101 * @exception E_SUCCESS The method is successful.
102 * @exception E_OUT_OF_MEMORY The memory is insufficient.
103 * @exception E_SYSTEM An internal error has occurred.
104 * @remarks The specific error code can be accessed using the GetLastResult() method.
106 ManagedNetConnection* GetManagedNetConnectionN(void) const;
109 * Gets the preferred network.
113 * @return The preferred network, @n
114 * else @c NET_WIFI_FIRST if there is an error or if the preferred network is not set
115 * @remarks The specific error code can be accessed using the GetLastResult() method.
117 NetPreferenceType GetNetPreference(void) const;
120 * Sets the preferred network.
125 * @privilege %http://tizen.org/privilege/network.connection
126 * @feature %http://tizen.org/feature/network.wifi for the @c NET_WIFI_ONLY value and @n
127 * %http://tizen.org/feature/network.telephony for the @c NET_PS_ONLY value of @c netPreference
129 * @return An error code
130 * @param[in] netPreference The preferred network
131 * @exception E_SUCCESS The method is successful.
132 * @exception E_INVALID_OPERATION This operation is not allowed.
133 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
134 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
135 * @exception E_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
136 * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
138 * - If this method is not used, the default connection works in the Wi-Fi first mode.
139 * - Before calling this method, check whether the feature is supported by
140 * Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
142 result SetNetPreference(NetPreferenceType netPreference);
146 * Gets the connection information that is related to a network account.
150 * @return A NetConnectionInfo instance specifying the information on this network connection, @n
151 * else @c null if there is an error or if an active connection is not found
152 * @param[in] netAccountId The network account ID
153 * @exception E_SUCCESS The method is successful.
154 * @exception E_INVALID_ACCOUNT The specified network account ID is invalid.
155 * @exception E_OUT_OF_MEMORY The memory is insufficient.
156 * @exception E_SYSTEM An internal error has occurred.
157 * @remarks The specific error code can be accessed using the GetLastResult() method.
159 static NetConnectionInfo* GetNetConnectionInfoN(NetAccountId netAccountId);
162 * Gets a list of all the network connections information that is used by the system.
166 * @return A Tizen::Base::Collection::IList containing indexes to the active %NetConnectionInfo in the network, @n
167 * else @c null if there is an error or if there is no active connection in the system
168 * @exception E_SUCCESS The method is successful.
169 * @exception E_OUT_OF_MEMORY The memory is insufficient.
170 * @exception E_SYSTEM An internal error has occurred (baseband or system).
171 * @remarks The specific error code can be accessed using the GetLastResult() method.
173 static Tizen::Base::Collection::IList* GetAllNetConnectionInfoN(void);
177 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
179 * @param[in] rhs An instance of %NetConnectionManager
181 NetConnectionManager(const NetConnectionManager& rhs);
184 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
186 * @param[in] rhs An instance of %NetConnectionManager
188 NetConnectionManager& operator =(const NetConnectionManager& rhs);
191 _NetConnectionManagerImpl* __pNetConnectionManagerImpl;
193 friend class _NetConnectionManagerImpl;
194 }; // NetConnectionManager
198 #endif // _FNET_NET_CONNECTION_MANAGER_H_