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_BluetoothOppServerEvent.cpp
18 // @brief This is the implementation file for the _BluetoothOppServerEvent class.
21 #include <FBaseRtIEventListener.h>
22 #include <FBaseSysLog.h>
23 #include <FBaseRtIEventArg.h>
24 #include "FNetBt_BluetoothOppServerEvent.h"
25 #include "FNetBt_BluetoothOppServerEventArg.h"
26 #include "FNetBtIBluetoothOppServerEventListener.h"
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Net { namespace Bluetooth
34 _BluetoothOppServerEvent::_BluetoothOppServerEvent(void)
38 _BluetoothOppServerEvent::~_BluetoothOppServerEvent(void)
43 _BluetoothOppServerEvent::Construct(void)
45 return _Event::Initialize();
49 _BluetoothOppServerEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
51 const BluetoothDevice* pDevice = null;
53 IBluetoothOppServerEventListener* pListener = dynamic_cast <IBluetoothOppServerEventListener*>(&listener);
54 SysTryReturnVoidResult(NID_NET_BT, pListener != null, E_INVALID_ARG, "[E_INVALID_ARG] The listener argument is invalid.");
56 const _BluetoothOppServerEventArg* pEventArg = dynamic_cast <const _BluetoothOppServerEventArg*>(&arg);
57 SysTryReturnVoidResult(NID_NET_BT, pEventArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The event argument is invalid type.");
59 _BluetoothOppServerEventType eventType = pEventArg->GetEventType();
63 case _BT_OPP_SERVER_EVENT_PUSH_REQUESTED:
64 pDevice = pEventArg->GetRequester();
67 SysLog(NID_NET_BT, "Firing Bluetooth OPP Server Event (Type: _BT_OPP_SERVER_EVENT_PUSH_REQUESTED)");
68 pListener->OnOppPushRequested(*pDevice);
72 case _BT_OPP_SERVER_EVENT_TRANSFER_DONE:
73 SysLog(NID_NET_BT, "Firing Bluetooth OPP Server Event (Type: _BT_OPP_SERVER_EVENT_TRANSFER_DONE)");
74 pListener->OnOppTransferDone(pEventArg->GetFileName(), pEventArg->GetFileSize(), pEventArg->IsTransferCompleted());
77 case _BT_OPP_SERVER_EVENT_TRANSFER_PROGRESS:
78 SysLog(NID_NET_BT, "Firing Bluetooth OPP Server Event (Type: _BT_OPP_SERVER_EVENT_TRANSFER_PROGRESS)");
79 pListener->OnOppTransferInProgress(pEventArg->GetPercent());
87 } } } // Tizen::Net::Bluetooth