// // Open Service Platform // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // @file FNetBt_BluetoothSppAcceptorEvent.cpp // @brief This is the implementation file for the _BluetoothSppAcceptorEvent class. // #include #include #include #include #include "FNetBt_BluetoothSppAcceptorEvent.h" #include "FNetBt_BluetoothSppAcceptorEventArg.h" #include "FNetBtIBluetoothSppAcceptorEventListener.h" using namespace Tizen::Base; namespace Tizen { namespace Net { namespace Bluetooth { _BluetoothSppAcceptorEvent::_BluetoothSppAcceptorEvent(void) { } _BluetoothSppAcceptorEvent::~_BluetoothSppAcceptorEvent(void) { } result _BluetoothSppAcceptorEvent::Construct(void) { return _Event::Initialize(); } void _BluetoothSppAcceptorEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg) { const BluetoothDevice* pDevice = null; ByteBuffer* pData = null; IBluetoothSppAcceptorEventListener* pListener = dynamic_cast (&listener); SysTryReturnVoidResult(NID_NET_BT, pListener != null, E_INVALID_ARG, "[E_INVALID_ARG] The listener argument is invalid."); const _BluetoothSppAcceptorEventArg* pEventArg = dynamic_cast (&arg); SysTryReturnVoidResult(NID_NET_BT, pEventArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The event argument is invalid type."); _BluetoothSppAcceptorEventType eventType = pEventArg->GetEventType(); switch (eventType) { case _BT_SPP_ACCEPTOR_EVENT_CONN_REQUESTED: pDevice = pEventArg->GetRequester(); if (pDevice != null) { SysLog(NID_NET_BT, "Firing Bluetooth SPP Acceptor Event (Type: _BT_SPP_ACCEPTOR_EVENT_CONN_REQUESTED)"); pListener->OnSppConnectionRequested(*pDevice); } break; case _BT_SPP_ACCEPTOR_EVENT_DISCONNECTED: SysLog(NID_NET_BT, "Firing Bluetooth SPP Acceptor Event (Type: _BT_SPP_ACCEPTOR_EVENT_DISCONNECTED)"); pListener->OnSppDisconnected(pEventArg->GetErrorResult()); break; case _BT_SPP_ACCEPTOR_EVENT_DATA_RECEIVED: pData = pEventArg->GetReceivedData(); if (pData != null) { SysLog(NID_NET_BT, "Firing Bluetooth SPP Acceptor Event (Type: _BT_SPP_ACCEPTOR_EVENT_DATA_RECEIVED)"); pListener->OnSppDataReceived(*pData); } break; default: break; } } } } } // Tizen::Net::Bluetooth