Fixed bug.
[platform/framework/native/net.git] / inc / FNetManagedNetConnection.h
1 //\r
2 // Open Service Platform\r
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
4 //\r
5 // Licensed under the Flora License, Version 1.0 (the License);\r
6 // you may not use this file except in compliance with the License.\r
7 // You may obtain a copy of the License at\r
8 //\r
9 //     http://floralicense.org/license/\r
10 //\r
11 // Unless required by applicable law or agreed to in writing, software\r
12 // distributed under the License is distributed on an AS IS BASIS,\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 // See the License for the specific language governing permissions and\r
15 // limitations under the License.\r
16 //\r
17 \r
18 /**\r
19  * @file        FNetManagedNetConnection.h \r
20  * @brief       This is the header file for the %ManagedNetConnection class.\r
21  *\r
22  * This header file contains the declarations of the %ManagedNetConnection class.\r
23  */\r
24 #ifndef _FNET_MANAGED_NET_CONNECTION_H_\r
25 #define _FNET_MANAGED_NET_CONNECTION_H_\r
26 \r
27 #include <FBase.h>\r
28 #include <FNetNetTypes.h>\r
29 #include <FNetNetConnectionInfo.h>\r
30 #include <FNetIManagedNetConnectionEventListener.h>\r
31 \r
32 namespace Tizen { namespace Net\r
33 {\r
34 class _ManagedNetConnectionImpl;\r
35 \r
36 /**\r
37  * @class       ManagedNetConnection \r
38  * @brief       This class provides methods for the network connection managed by the system.\r
39  *\r
40  * @since       2.0\r
41  *\r
42  *      The %ManagedNetConnection class provides functionalities for accessing the information about the default connection for data communication \r
43  *      managed by the system. Once the connection is established, the applications can use sockets and HTTP interfaces.\r
44  *\r
45  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/net/default_network_connection.htm">Default Network Connection</a>.\r
46  */\r
47 class _OSP_EXPORT_ ManagedNetConnection\r
48         : public Tizen::Base::Object\r
49 {\r
50 public:\r
51         /**\r
52          * This destructor overrides Tizen::Base::Object::~Object().\r
53          *\r
54          * @since       2.0\r
55          */\r
56         virtual ~ManagedNetConnection(void);\r
57 \r
58 public:\r
59         /**\r
60          * Sets a listener object to the current instance of %ManagedNetConnection.\r
61          *\r
62          * @since               2.0\r
63          *\r
64          * @param[in]   pListener                       An instance of IManagedNetConnectionEventListener @n\r
65          *                                                                      If this is @c null, it will reset the event listener.\r
66          * @return              An error code\r
67          * @exception   E_SUCCESS                       The method is successful.\r
68          * @exception   E_SYSTEM                        An internal error has occurred.\r
69          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, @n\r
70          *                                                                      because the caller thread is a worker thread.\r
71          */\r
72         result SetManagedNetConnectionEventListener(IManagedNetConnectionEventListener* pListener);\r
73 \r
74         /** \r
75          * Gets the network account on which the current instance is based, to establish a connection with a remote server or a gateway.\r
76          *\r
77          * @since               2.0\r
78          *\r
79          * @return              The NetAccountId of the current instance of %ManagedNetConnection, @n\r
80          *                              else @c INVALID_HANDLE if the network connection managed by the system is inactive\r
81          * @exception   E_SUCCESS                               The method is successful.\r
82          * @exception   E_INVALID_STATE                 The network connection is inactive.\r
83          * @remarks             The specific error code can be accessed using the GetLastResult() method.\r
84          */\r
85         NetAccountId GetNetAccountId(void) const;\r
86 \r
87         /**\r
88          * Gets the connection state of the current instance of %ManagedNetConnection.\r
89          *\r
90          * @since               2.0\r
91          *\r
92          * @return              An instance of NetConnectionState specifying the state of the network connection, @n\r
93          *                              else @c NET_CONNECTION_STATE_STOPPED if the network connection managed by the system is inactive\r
94          */\r
95         NetConnectionState  GetConnectionState(void) const;\r
96 \r
97         /**\r
98          * Gets the information about the current network connection.\r
99          *\r
100          * @since               2.0\r
101          *\r
102          * @return              A pointer to an instance of NetConnectionInfo specifying the information about this network connection\r
103          * @exception   E_SUCCESS                               The method is successful.\r
104          * @exception   E_INVALID_STATE                 The network connection is inactive.\r
105          * @remarks             This method requires a NetConnectionInfo instance reference.\r
106          *                              %NetConnectionInfo is only available when the network connection managed by the system is active. In other states, this returns null.\r
107          *                              The specific error code can be accessed using the GetLastResult() method.\r
108          * @warning     Do not delete the returned NetConnectionInfo instance. This instance is directly referencing the internal connectionInfo of \r
109          *                              %ManagedNetConnection.\r
110          */\r
111         const NetConnectionInfo* GetNetConnectionInfo(void) const;\r
112 \r
113 private:\r
114         /**\r
115          * This default constructor is intentionally declared as private so that only the platform can create an instance.\r
116          *\r
117          * @remarks             After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.\r
118          * @see                 Construct\r
119          */\r
120         ManagedNetConnection(void);\r
121 \r
122 private:\r
123         /** \r
124          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
125          *\r
126          * @param[in]   rhs                     An instance of %ManagedNetConnection\r
127          */     \r
128         ManagedNetConnection(const ManagedNetConnection& rhs);\r
129 \r
130         /** \r
131          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
132          *\r
133          * @param[in]   rhs             An instance of %ManagedNetConnection\r
134          */\r
135         ManagedNetConnection& operator =(const ManagedNetConnection& rhs);\r
136 \r
137 private:\r
138         _ManagedNetConnectionImpl* __pManagedNetConnectionImpl;\r
139 \r
140         friend class _ManagedNetConnectionImpl;\r
141 }; // ManagedNetConnection\r
142 \r
143 } } //Tizen::Net\r
144 \r
145 #endif // _FNET_MANAGED_NET_CONNECTION_H_\r