[Doxygen] Add @feature key on the doxygen.
[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.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
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. For full construction, the Construct() method must be called right after calling this constructor.
52          *
53          * @since       2.0
54          *
55          * @remarks             After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
56          */
57         NetConnectionManager(void);
58
59         /**
60          * This destructor overrides Tizen::Base::Object::~Object().
61          *
62          * @since               2.0
63          */
64         virtual ~NetConnectionManager(void);
65
66         /**
67          * Initializes this instance of %NetConnectionManager.
68          *
69          * @since       2.0
70          *
71          * @return              An error code
72          * @exception   E_SUCCESS                       The method is successful.
73          * @exception   E_SYSTEM                        An internal error has occurred.
74          */
75         result Construct(void);
76
77 public:
78         /**
79          * Creates a new network connection.
80          *
81          * @since       2.0
82          *
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.
92          */
93         NetConnection* CreateNetConnectionN(NetAccountId netAccountId);
94
95         /**
96          * Gets an instance of the current connection that is managed by the system.
97          *
98          * @since       2.0
99          *
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.
106          */
107         ManagedNetConnection* GetManagedNetConnectionN(void) const;
108
109         /**
110          * Gets the preferred network.
111          *
112          * @since       2.0
113          *
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.
117          */
118         NetPreferenceType GetNetPreference(void) const;
119
120         /**
121          * Sets the preferred network.
122          *
123          * @since       2.0
124          *
125          * @privlevel   public
126          * @privilege   %http://tizen.org/privilege/network.connection
127          * @feature             %http://tizen.org/feature/network.wifi or %http://tizen.org/feature/network.telephony
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_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>.
136          * @remarks
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.
139          */
140         result SetNetPreference(NetPreferenceType netPreference);
141
142 public:
143         /**
144          * Gets the connection information that is related to a network account.
145          *
146          * @since       2.0
147          *
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.
156          */
157         static NetConnectionInfo* GetNetConnectionInfoN(NetAccountId netAccountId);
158
159         /**
160          * Gets a list of all the network connections information that is used by the system.
161          *
162          * @since       2.0
163          *
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.
170          */
171         static Tizen::Base::Collection::IList* GetAllNetConnectionInfoN(void);
172
173 private:
174         /**
175          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
176          *
177          * @param[in]   rhs             An instance of %NetConnectionManager
178          */
179         NetConnectionManager(const NetConnectionManager& rhs);
180
181         /**
182          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
183          *
184          * @param[in]   rhs                     An instance of %NetConnectionManager
185          */
186         NetConnectionManager& operator =(const NetConnectionManager& rhs);
187
188 private:
189         _NetConnectionManagerImpl* __pNetConnectionManagerImpl;
190
191         friend class _NetConnectionManagerImpl;
192 }; // NetConnectionManager
193
194 } } //Tizen::Net
195
196 #endif // _FNET_NET_CONNECTION_MANAGER_H_