2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 // @file FNetBt_BluetoothDeviceEventArg.cpp
18 // @brief This is the implementation file for the _BluetoothDeviceEventArg class.
21 #include <FNetBtBluetoothDevice.h>
22 #include <FBaseSysLog.h>
23 #include "FNetBt_BluetoothDeviceEventArg.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
29 namespace Tizen { namespace Net { namespace Bluetooth
33 // This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_STARTED event.
35 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(result r)
36 : __evtType(_BT_DEVICE_EVENT_DISCOVERY_STARTED)
37 , __pRemoteDevice(null)
38 , __isCompleted(false)
45 // This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_DONE event.
47 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(bool isCompleted)
48 : __evtType(_BT_DEVICE_EVENT_DISCOVERY_DONE)
49 , __pRemoteDevice(null)
50 , __isCompleted(isCompleted)
57 // This is a class constructor for _BT_DEVICE_EVENT_SVCLIST_RECEIVED event.
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)
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.");
71 // This is a class constructor for _BT_DEVICE_EVENT_DEVICE_FOUND and _BT_DEVICE_EVENT_UNPAIRED event.
73 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(_BluetoothDeviceEventType type, const BluetoothDevice& device)
75 , __pRemoteDevice(null)
76 , __isCompleted(false)
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.");
85 // This is a class constructor for _BT_DEVICE_EVENT_PAIRED event.
87 _BluetoothDeviceEventArg::_BluetoothDeviceEventArg(const BluetoothDevice* pDevice, result r)
88 : __evtType(_BT_DEVICE_EVENT_PAIRED)
89 , __pRemoteDevice(null)
90 , __isCompleted(false)
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.");
101 _BluetoothDeviceEventArg::~_BluetoothDeviceEventArg(void)
103 delete __pRemoteDevice;
106 _BluetoothDeviceEventType
107 _BluetoothDeviceEventArg::GetEventType(void) const
112 const BluetoothDevice*
113 _BluetoothDeviceEventArg::GetRemoteDevice(void) const
115 return __pRemoteDevice;
119 _BluetoothDeviceEventArg::IsDiscoveryCompleted(void) const
121 return __isCompleted;
125 _BluetoothDeviceEventArg::GetServiceList(void) const
127 return __serviceList;
131 _BluetoothDeviceEventArg::GetErrorResult(void) const
136 } } } // Tizen::Net::Bluetooth