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
128 * @return An error code
129 * @param[in] netPreference The preferred network
130 * @exception E_SUCCESS The method is successful.
131 * @exception E_INVALID_OPERATION This operation is not allowed.
132 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
133 * @exception E_UNSUPPORTED_OPERATION The specified @c netPreference is not supported by this device. @b Since: @b 2.1
134 * @remarks If this method is not used, the default connection works in the Wi-Fi first mode.
136 result SetNetPreference(NetPreferenceType netPreference);
140 * Gets the connection information that is related to a network account.
144 * @return A NetConnectionInfo instance specifying the information on this network connection, @n
145 * else @c null if there is an error or if an active connection is not found
146 * @param[in] netAccountId The network account ID
147 * @exception E_SUCCESS The method is successful.
148 * @exception E_INVALID_ACCOUNT The specified network account ID is invalid.
149 * @exception E_OUT_OF_MEMORY The memory is insufficient.
150 * @exception E_SYSTEM An internal error has occurred.
151 * @remarks The specific error code can be accessed using the GetLastResult() method.
153 static NetConnectionInfo* GetNetConnectionInfoN(NetAccountId netAccountId);
156 * Gets a list of all the network connections information that is used by the system.
160 * @return An IList containing indexes to the active %NetConnectionInfo in the network, @n
161 * else @c null if there is an error or if there is no active connection in the system
162 * @exception E_SUCCESS The method is successful.
163 * @exception E_OUT_OF_MEMORY The memory is insufficient.
164 * @exception E_SYSTEM An internal error has occurred (baseband or system).
165 * @remarks The specific error code can be accessed using the GetLastResult() method.
167 static Tizen::Base::Collection::IList* GetAllNetConnectionInfoN(void);
171 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
173 * @param[in] rhs An instance of %NetConnectionManager
175 NetConnectionManager(const NetConnectionManager& rhs);
178 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
180 * @param[in] rhs An instance of %NetConnectionManager
182 NetConnectionManager& operator =(const NetConnectionManager& rhs);
185 _NetConnectionManagerImpl* __pNetConnectionManagerImpl;
187 friend class _NetConnectionManagerImpl;
188 }; // NetConnectionManager
192 #endif // _FNET_NET_CONNECTION_MANAGER_H_