remove link in brief tag
[platform/framework/native/net.git] / inc / FNetNetConnectionManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19  * @file                FNetNetConnectionManager.h
20  * @brief               This is the header file for the %NetConnectionManager class.
21  *
22  * This header file contains the declarations of the %NetConnectionManager class.
23  */
24 #ifndef _FNET_NET_CONNECTION_MANAGER_H_
25 #define _FNET_NET_CONNECTION_MANAGER_H_
26
27 #include <FBase.h>
28 #include <FNetNetTypes.h>
29 #include <FNetNetConnection.h>
30 #include <FNetManagedNetConnection.h>
31
32 namespace Tizen { namespace Net
33 {
34 class _NetConnectionManagerImpl;
35
36 /**
37  * @class       NetConnectionManager
38  * @brief       This class provides methods for managing the network connections.
39  *
40  * @since   2.0
41  *
42  *  The %NetConnectionManager class provides methods for creating and retrieving connections for data communication.
43  *
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>.
45  */
46 class _OSP_EXPORT_ NetConnectionManager
47         : public Tizen::Base::Object
48 {
49 public:
50         /**
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.
53          *
54          * @since       2.0
55          */
56         NetConnectionManager(void);
57
58         /**
59          * This destructor overrides Tizen::Base::Object::~Object().
60          *
61          * @since               2.0
62          */
63         virtual ~NetConnectionManager(void);
64
65         /**
66          * Initializes this instance of %NetConnectionManager.
67          *
68          * @since       2.0
69          *
70          * @return              An error code
71          * @exception   E_SUCCESS                       The method is successful.
72          * @exception   E_SYSTEM                        An internal error has occurred.
73          */
74         result Construct(void);
75
76 public:
77         /**
78          * Creates a new network connection.
79          *
80          * @since       2.0
81          *
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.
91          */
92         NetConnection* CreateNetConnectionN(NetAccountId netAccountId);
93
94         /**
95          * Gets an instance of the current connection that is managed by the system.
96          *
97          * @since       2.0
98          *
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.
105          */
106         ManagedNetConnection* GetManagedNetConnectionN(void) const;
107
108         /**
109          * Gets the preferred network.
110          *
111          * @since       2.0
112          *
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.
116          */
117         NetPreferenceType GetNetPreference(void) const;
118
119         /**
120          * Sets the preferred network.
121          *
122          * @since       2.0
123          *
124          * @privlevel   public
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
128          *
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>.
137          * @remarks
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&).
141          */
142         result SetNetPreference(NetPreferenceType netPreference);
143
144 public:
145         /**
146          * Gets the connection information that is related to a network account.
147          *
148          * @since       2.0
149          *
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.
158          */
159         static NetConnectionInfo* GetNetConnectionInfoN(NetAccountId netAccountId);
160
161         /**
162          * Gets a list of all the network connections information that is used by the system.
163          *
164          * @since       2.0
165          *
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.
172          */
173         static Tizen::Base::Collection::IList* GetAllNetConnectionInfoN(void);
174
175 private:
176         /**
177          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
178          *
179          * @param[in]   rhs             An instance of %NetConnectionManager
180          */
181         NetConnectionManager(const NetConnectionManager& rhs);
182
183         /**
184          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
185          *
186          * @param[in]   rhs                     An instance of %NetConnectionManager
187          */
188         NetConnectionManager& operator =(const NetConnectionManager& rhs);
189
190 private:
191         _NetConnectionManagerImpl* __pNetConnectionManagerImpl;
192
193         friend class _NetConnectionManagerImpl;
194 }; // NetConnectionManager
195
196 } } //Tizen::Net
197
198 #endif // _FNET_NET_CONNECTION_MANAGER_H_