update the header for Doxygen
[platform/framework/native/bluetooth.git] / src / FNetBt_BluetoothDeviceEventArg.cpp
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 // @file    FNetBt_BluetoothDeviceEventArg.cpp
18 // @brief   This is the implementation file for the _BluetoothDeviceEventArg class.
19 //
20
21 #include <FNetBtBluetoothDevice.h>
22 #include <FBaseSysLog.h>
23 #include "FNetBt_BluetoothDeviceEventArg.h"
24
25
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28
29 namespace Tizen { namespace Net { namespace Bluetooth
30 {
31
32 //
33 // This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_STARTED event.
34 //
35 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(result r)
36         : __evtType(_BT_DEVICE_EVENT_DISCOVERY_STARTED)
37         , __pRemoteDevice(null)
38         , __isCompleted(false)
39         , __serviceList(0)
40         , __result(r)
41 {
42 }
43
44 //
45 // This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_DONE event.
46 //
47 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(bool isCompleted)
48         : __evtType(_BT_DEVICE_EVENT_DISCOVERY_DONE)
49         , __pRemoteDevice(null)
50         , __isCompleted(isCompleted)
51         , __serviceList(0)
52         , __result(E_SUCCESS)
53 {
54 }
55
56 //
57 // This is a class constructor for _BT_DEVICE_EVENT_SVCLIST_RECEIVED event.
58 //
59 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(const BluetoothDevice& device, unsigned long serviceList, result r)
60         : __evtType(_BT_DEVICE_EVENT_SVCLIST_RECEIVED)
61         , __pRemoteDevice(null)
62         , __isCompleted(false)
63         , __serviceList(serviceList)
64         , __result(r)
65 {
66         __pRemoteDevice = new (std::nothrow) BluetoothDevice(device);
67         SysTryReturnVoidResult(NID_NET_BT, __pRemoteDevice != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
68 }
69
70 //
71 // This is a class constructor for _BT_DEVICE_EVENT_DEVICE_FOUND and _BT_DEVICE_EVENT_UNPAIRED event.
72 //
73 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(_BluetoothDeviceEventType type, const BluetoothDevice& device)
74         : __evtType(type)
75         , __pRemoteDevice(null)
76         , __isCompleted(false)
77         , __serviceList(0)
78         , __result(E_SUCCESS)
79 {
80         __pRemoteDevice = new (std::nothrow) BluetoothDevice(device);
81         SysTryReturnVoidResult(NID_NET_BT, __pRemoteDevice != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
82 }
83
84 //
85 // This is a class constructor for _BT_DEVICE_EVENT_PAIRED event.
86 //
87 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(const BluetoothDevice* pDevice, result r)
88         : __evtType(_BT_DEVICE_EVENT_PAIRED)
89         , __pRemoteDevice(null)
90         , __isCompleted(false)
91         , __serviceList(0)
92         , __result(r)
93 {
94         if (pDevice != null)
95         {
96                 __pRemoteDevice = new (std::nothrow) BluetoothDevice(*pDevice);
97                 SysTryReturnVoidResult(NID_NET_BT, __pRemoteDevice != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
98         }
99 }
100
101 _BluetoothDeviceEventArg::~_BluetoothDeviceEventArg(void)
102 {
103         delete __pRemoteDevice;
104 }
105
106 _BluetoothDeviceEventType
107 _BluetoothDeviceEventArg::GetEventType(void) const
108 {
109         return __evtType;
110 }
111
112 const BluetoothDevice*
113 _BluetoothDeviceEventArg::GetRemoteDevice(void) const
114 {
115         return __pRemoteDevice;
116 }
117
118 bool
119 _BluetoothDeviceEventArg::IsDiscoveryCompleted(void) const
120 {
121         return __isCompleted;
122 }
123
124 unsigned long
125 _BluetoothDeviceEventArg::GetServiceList(void) const
126 {
127         return __serviceList;
128 }
129
130 result
131 _BluetoothDeviceEventArg::GetErrorResult(void) const
132 {
133         return __result;
134 }
135
136 } } } // Tizen::Net::Bluetooth