Fixed issue(DCM-1110)
[platform/framework/native/net.git] / src / FNetManagedNetConnection.cpp
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                FNetManagedNetConnection.cpp
20  * @brief               This is the implementation for the %ManagedNetConnection class.
21  */
22
23 #include <FNetManagedNetConnection.h>
24 #include <FNetNetConnectionManager.h>
25 #include <FBaseSysLog.h>
26 #include "FNet_ManagedNetConnectionImpl.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Runtime;
30
31 namespace Tizen { namespace Net
32 {
33
34 ManagedNetConnection::ManagedNetConnection()
35         : __pManagedNetConnectionImpl(null)
36 {
37         __pManagedNetConnectionImpl = new (std::nothrow) _ManagedNetConnectionImpl(this);
38         SysTryReturnVoidResult(NID_NET, __pManagedNetConnectionImpl != null, E_OUT_OF_MEMORY,
39                         "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
40 }
41
42 ManagedNetConnection::~ManagedNetConnection(void)
43 {
44         delete __pManagedNetConnectionImpl;
45         __pManagedNetConnectionImpl = null;
46 }
47
48 result
49 ManagedNetConnection::SetManagedNetConnectionEventListener(IManagedNetConnectionEventListener* pListener)
50 {
51         result r = E_SUCCESS;
52
53         r = __pManagedNetConnectionImpl->SetManagedNetConnectionEventListener(pListener);
54         SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
55
56         return r;
57 }
58
59 NetConnectionState
60 ManagedNetConnection::GetConnectionState(void) const
61 {
62         return __pManagedNetConnectionImpl->GetConnectionState();
63 }
64
65 NetAccountId
66 ManagedNetConnection::GetNetAccountId(void) const
67 {
68         return __pManagedNetConnectionImpl->GetNetAccountId();
69 }
70
71 const NetConnectionInfo*
72 ManagedNetConnection::GetNetConnectionInfo(void) const
73 {
74         return __pManagedNetConnectionImpl->GetNetConnectionInfo();
75 }
76
77 } } // Tizen::Net
78
79