Fixed issue(DCM-1110)
[platform/framework/native/net.git] / src / FNet_PsSystemNetConnection.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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  * @file        FNet_PsSystemNetConnection.h
19  * @brief       This is the header file for the %_PsSystemNetConnection class.
20  *
21  * This header file contains the declarations of the %_PsSystemNetConnection class.
22  */
23
24 #ifndef _FNET_INTERNAL_PS_SYSTEM_NET_CONNECTION_H_
25 #define _FNET_INTERNAL_PS_SYSTEM_NET_CONNECTION_H_
26
27 #include "FNet_SystemNetConnection.h"
28 #include "FNet_NetUtility.h"
29
30 namespace Tizen { namespace Net {
31 /**
32  * @class       _PsSystemNetConnection
33  * @brief       This class provides methods for a PS system network connection.
34  *
35  * @since 2.1
36  *
37  * This class provides methods for a system network connection.
38  */
39
40 class _PsSystemNetConnection
41         : public _SystemNetConnection
42 {
43 public:
44         /**
45          * This is the default constructor for this class.
46          */
47                 _PsSystemNetConnection(void);
48
49         /**
50          * This is the destructor for this class.
51          */
52         virtual ~_PsSystemNetConnection(void);
53
54         /**
55          * Initializes this instance with the specified account.
56          *
57          * @since 2.1
58          *
59          * @return              An error code
60          * @param[in]   profileName                     The network profile's name
61          * @exception   E_SUCCESS                       The method was successful.
62          * @exception   E_INVALID_STATE         This instance is in an invalid state.
63          * @exception   E_INVALID_ACCOUNT       The specified network profile is invalid.
64          * @exception   E_SYSTEM                        An internal error occurred.
65          */
66         result Construct(const Tizen::Base::String& profileName);
67
68         /**
69          * Starts the network connection.
70          *
71          * @since 2.1
72          *
73          * @return                      An error code
74          * @exception   E_SUCCESS                               The method was successful.
75          * @exception   E_INVALID_STATE         This instance is in an invalid state.
76          * @exception   E_SYSTEM                                        An internal error occurred.
77          * @see                 Stop()
78          */
79         virtual result Start(_NetConnectionEvent& event);
80
81         /**
82          * Stops the network connection.
83          *
84          * @since 2.1
85          *
86          * @return                      An error code
87          * @exception   E_SUCCESS                               The method was successful.
88          * @exception   E_INVALID_STATE         This instance is in an invalid state.
89          * @exception   E_SYSTEM                                        An internal error occurred.
90          * @see                 Start()
91          */
92         virtual result Stop(_NetConnectionEvent& event, bool waitingEvent = true);
93
94         virtual void HandleStartResponse(result error, void* pData);
95         virtual void HandleStopResponse(void);
96         virtual void HandleStartEvent(void);
97         virtual void HandleStopEvent(result error);
98
99         virtual NetConnectionState QueryConnectionState(Tizen::Base::String& devName) const;
100
101         void* GetProfileHandle(void);
102
103 private:
104         /**
105          * This is the copy constructor for this class.
106          *
107          * @param[in]   rhs                     An instance of _PsSystemNetConnection
108          */
109         _PsSystemNetConnection(const _PsSystemNetConnection& rhs);
110
111         /**
112          * This is the assignment operator. Do @b not use directly.
113          *
114          * @param[in]   rhs                             An instance of _PsSystemNetConnection
115          */
116         _PsSystemNetConnection& operator =(const _PsSystemNetConnection& rhs);
117
118 private:
119         Tizen::Base::String __profileName;
120         std::unique_ptr<void, _ConnectionDeleter> __pConnectionHandle;
121         std::unique_ptr<void, _ProfileDeleter> __pProfileHandle;
122
123         friend class _SystemNetConnection;
124
125 }; // _PsSystemNetConnection
126
127 } }  // Tizen::Net
128 #endif // _FNET_INTERNAL_PS_SYSTEM_NET_CONNECTION_H_
129