summaryrefslogtreecommitdiff
path: root/src/FNetBt_BluetoothConnectionEvent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/FNetBt_BluetoothConnectionEvent.cpp')
-rw-r--r--src/FNetBt_BluetoothConnectionEvent.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/FNetBt_BluetoothConnectionEvent.cpp b/src/FNetBt_BluetoothConnectionEvent.cpp
new file mode 100644
index 0000000..1bf160c
--- /dev/null
+++ b/src/FNetBt_BluetoothConnectionEvent.cpp
@@ -0,0 +1,78 @@
+//
+// 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_BluetoothConnectionEvent.cpp
+// @brief This is the implementation file for the _BluetoothDeviceEvent class.
+//
+
+#include <FBaseRtIEventListener.h>
+#include <FBaseSysLog.h>
+#include <FBaseRtIEventArg.h>
+#include "FNetBt_BluetoothConnectionEvent.h"
+#include "FNetBt_BluetoothConnectionEventArg.h"
+#include "FNetBt_IBluetoothConnectionEventListener.h"
+
+
+using namespace Tizen::Base;
+
+namespace Tizen { namespace Net { namespace Bluetooth
+{
+
+_BluetoothConnectionEvent::_BluetoothConnectionEvent(void)
+ : __listenerCount(0)
+{
+}
+
+_BluetoothConnectionEvent::~_BluetoothConnectionEvent(void)
+{
+}
+
+result
+_BluetoothConnectionEvent::Construct(void)
+{
+ return _Event::Initialize();
+}
+
+void
+_BluetoothConnectionEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
+{
+ _IBluetoothConnectionEventListener* pEventListener = dynamic_cast <_IBluetoothConnectionEventListener*>(&listener);
+ SysTryReturnVoidResult(NID_NET_BT, pEventListener != null, E_INVALID_ARG,
+ "[E_INVALID_ARG] The listener argument is invalid.");
+
+ const _BluetoothConnectionEventArg* pEventArg = dynamic_cast <const _BluetoothConnectionEventArg*>(&arg);
+ SysTryReturnVoidResult(NID_NET_BT, pEventArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The event argument is invalid type.");
+
+ _BluetoothConnectionEventType eventType = pEventArg->GetEventType();
+
+ switch (eventType)
+ {
+ case _BT_CONNECTION_EVENT_CONNECTED:
+ SysLog(NID_NET_BT, "Firing Bluetooth Connection state changed Event (Type: _BT_CONNECTION_EVENT_CONNECTED)");
+ pEventListener->OnBluetoothDeviceConnected(*pEventArg->GetRemoteAddress());
+ break;
+
+ case _BT_CONNECTION_EVENT_DISCONNECTED:
+ SysLog(NID_NET_BT, "Firing Bluetooth Connection state changed Event (Type: _BT_CONNECTION_EVENT_DISCONNECTED)");
+ pEventListener->OnBluetoothDeviceDisconnected(*pEventArg->GetRemoteAddress());
+ break;
+
+ default:
+ break;
+ }
+}
+
+} } } // Tizen::Net::Bluetooth