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 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. For full construction, the Construct() method must be called right after calling this constructor.
55 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
57 NetConnectionManager(void);
60 * This destructor overrides Tizen::Base::Object::~Object().
64 virtual ~NetConnectionManager(void);
67 * Initializes this instance of %NetConnectionManager.
71 * @return An error code
72 * @exception E_SUCCESS The method is successful.
73 * @exception E_SYSTEM An internal error has occurred.
75 result Construct(void);
79 * Creates a new network connection.
83 * @return A NetConnection instance containing the account information, @n
84 * else @c null if an error occurs
85 * @param[in] netAccountId The index of the network account to which this %NetConnection is bound
86 * @exception E_SUCCESS The method is successful.
87 * @exception E_INVALID_ACCOUNT The specified network account ID is invalid.
88 * @exception E_MAX_EXCEEDED Unable to setup a new connection due to too many existing connections.
89 * @exception E_OUT_OF_MEMORY The memory is insufficient.
90 * @exception E_SYSTEM An internal error has occurred.
91 * @remarks The specific error code can be accessed using the GetLastResult() method.
93 NetConnection* CreateNetConnectionN(NetAccountId netAccountId);
96 * Gets an instance of the current connection that is managed by the system.
100 * @return A ManagedNetConnection instance containing the account information, @n
101 * else @c null if an error occurs
102 * @exception E_SUCCESS The method is successful.
103 * @exception E_OUT_OF_MEMORY The memory is insufficient.
104 * @exception E_SYSTEM An internal error has occurred.
105 * @remarks The specific error code can be accessed using the GetLastResult() method.
107 ManagedNetConnection* GetManagedNetConnectionN(void) const;
110 * Gets the preferred network.
114 * @return The preferred network, @n
115 * else @c NET_WIFI_FIRST if there is an error or if the preferred network is not set
116 * @remarks The specific error code can be accessed using the GetLastResult() method.
118 NetPreferenceType GetNetPreference(void) const;
121 * Sets the preferred network.
126 * @privilege %http://tizen.org/privilege/network.connection
127 * @feature %http://tizen.org/feature/network.wifi or %http://tizen.org/feature/network.telephony
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_UNSUPPORTED_OPERATION The target device does not support the required feature. @b Since: @b 2.1
135 * For more information, see <a href=../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm>Application Filtering</a>.
137 * - If this method is not used, the default connection works in the Wi-Fi first mode.
138 * - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
140 result SetNetPreference(NetPreferenceType netPreference);
144 * Gets the connection information that is related to a network account.
148 * @return A NetConnectionInfo instance specifying the information on this network connection, @n
149 * else @c null if there is an error or if an active connection is not found
150 * @param[in] netAccountId The network account ID
151 * @exception E_SUCCESS The method is successful.
152 * @exception E_INVALID_ACCOUNT The specified network account ID is invalid.
153 * @exception E_OUT_OF_MEMORY The memory is insufficient.
154 * @exception E_SYSTEM An internal error has occurred.
155 * @remarks The specific error code can be accessed using the GetLastResult() method.
157 static NetConnectionInfo* GetNetConnectionInfoN(NetAccountId netAccountId);
160 * Gets a list of all the network connections information that is used by the system.
164 * @return A Tizen::Base::Collection::IList containing indexes to the active %NetConnectionInfo in the network, @n
165 * else @c null if there is an error or if there is no active connection in the system
166 * @exception E_SUCCESS The method is successful.
167 * @exception E_OUT_OF_MEMORY The memory is insufficient.
168 * @exception E_SYSTEM An internal error has occurred (baseband or system).
169 * @remarks The specific error code can be accessed using the GetLastResult() method.
171 static Tizen::Base::Collection::IList* GetAllNetConnectionInfoN(void);
175 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
177 * @param[in] rhs An instance of %NetConnectionManager
179 NetConnectionManager(const NetConnectionManager& rhs);
182 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
184 * @param[in] rhs An instance of %NetConnectionManager
186 NetConnectionManager& operator =(const NetConnectionManager& rhs);
189 _NetConnectionManagerImpl* __pNetConnectionManagerImpl;
191 friend class _NetConnectionManagerImpl;
192 }; // NetConnectionManager
196 #endif // _FNET_NET_CONNECTION_MANAGER_H_