update the header for Doxygen
[platform/framework/native/bluetooth.git] / src / FNetBt_BluetoothOppClientEvent.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_BluetoothOppClientEvent.cpp
18 // @brief   This is the implementation file for the _BluetoothOppClientEvent class.
19 //
20
21 #include <FBaseRtIEventListener.h>
22 #include <FBaseSysLog.h>
23 #include <FBaseRtIEventArg.h>
24 #include "FNetBt_BluetoothOppClientEvent.h"
25 #include "FNetBt_BluetoothOppClientEventArg.h"
26 #include "FNetBtIBluetoothOppClientEventListener.h"
27
28
29 using namespace Tizen::Base;
30
31 namespace Tizen { namespace Net { namespace Bluetooth
32 {
33
34 _BluetoothOppClientEvent::_BluetoothOppClientEvent(void)
35 {
36 }
37
38 _BluetoothOppClientEvent::~_BluetoothOppClientEvent(void)
39 {
40 }
41
42 result
43 _BluetoothOppClientEvent::Construct(void)
44 {
45         return _Event::Initialize();
46 }
47
48 void
49 _BluetoothOppClientEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
50 {
51         IBluetoothOppClientEventListener* pListener = dynamic_cast <IBluetoothOppClientEventListener*>(&listener);
52         SysTryReturnVoidResult(NID_NET_BT, pListener != null, E_INVALID_ARG, "[E_INVALID_ARG] The listener argument is invalid.");
53
54         const _BluetoothOppClientEventArg* pEventArg = dynamic_cast <const _BluetoothOppClientEventArg*>(&arg);
55         SysTryReturnVoidResult(NID_NET_BT, pEventArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The event argument is invalid type.");
56
57         _BluetoothOppClientEventType eventType = pEventArg->GetEventType();
58
59         switch (eventType)
60         {
61         case _BT_OPP_CLIENT_EVENT_PUSH_RESPONDED:
62                 SysLog(NID_NET_BT, "Firing Bluetooth OPP Client Event (Type: _BT_OPP_CLIENT_EVENT_PUSH_RESPONDED)");
63                 pListener->OnOppPushResponded(pEventArg->GetErrorResult());
64                 break;
65
66         case _BT_OPP_CLIENT_EVENT_TRANSFER_DONE:
67                 SysLog(NID_NET_BT, "Firing Bluetooth OPP Client Event (Type: _BT_OPP_CLIENT_EVENT_TRANSFER_DONE)");
68                 pListener->OnOppTransferDone(pEventArg->GetFilePath(), pEventArg->GetFileSize(), pEventArg->IsTransferCompleted());
69                 break;
70
71         case _BT_OPP_CLIENT_EVENT_TRANSFER_PROGRESS:
72                 SysLog(NID_NET_BT, "Firing Bluetooth OPP Client Event (Type: _BT_OPP_CLIENT_EVENT_TRANSFER_PROGRESS)");
73                 pListener->OnOppTransferInProgress(pEventArg->GetPercent());
74                 break;
75
76         default:
77                 break;
78         }
79 }
80
81 } } } // Tizen::Net::Bluetooth