summaryrefslogtreecommitdiff
path: root/src/FNetBtBluetoothDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/FNetBtBluetoothDevice.cpp')
-rwxr-xr-xsrc/FNetBtBluetoothDevice.cpp469
1 files changed, 469 insertions, 0 deletions
diff --git a/src/FNetBtBluetoothDevice.cpp b/src/FNetBtBluetoothDevice.cpp
new file mode 100755
index 0000000..3221c7b
--- /dev/null
+++ b/src/FNetBtBluetoothDevice.cpp
@@ -0,0 +1,469 @@
+//
+// 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 FNetBtBluetoothDevice.cpp
+// @brief This is the implementation file for the BluetoothDevice class.
+//
+
+#include <FNetBtBluetoothTypes.h>
+#include <FNetBtBluetoothDevice.h>
+#include <FAppAppControl.h>
+#include <FBaseColIList.h>
+#include <FBaseLong.h>
+#include <FBaseShort.h>
+#include <FBaseSysLog.h>
+#include "FNetBt_BluetoothDeviceImpl.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
+
+namespace Tizen { namespace Net { namespace Bluetooth
+{
+
+// The serial port profile UUID. (00001101-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_SPP[] = {0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The LAN access profile UUID. (00001102-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_LAP[] = {0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The dial-up networking profile UUID. (00001103-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_DUN[] = {0x00, 0x00, 0x11, 0x03, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The synchronization profile UUID. (00001104-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_SYNC[] = {0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The object push profile UUID. (00001105-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_OPP[] = {0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The file transfer profile UUID. (00001106-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_FTP[] = {0x00, 0x00, 0x11, 0x06, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The synchronization profile UUID. (00001107-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_SYNC_COMMAND[] = {0x00, 0x00, 0x11, 0x07, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The headset profile UUID. (00001108-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HSP[] = {0x00, 0x00, 0x11, 0x08, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The cordless telephony profile UUID. (00001109-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_CTP[] = {0x00, 0x00, 0x11, 0x09, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The advanced audio distribution profile - source UUID. (0000110A-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_A2DP_SOURCE[] = {0x00, 0x00, 0x11, 0x0A, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The advanced audio distribution profile - sink UUID. (0000110B-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_A2DP_SINK[] = {0x00, 0x00, 0x11, 0x0B, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The audio/video remote control profile - target UUID. (0000110C-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_AVRCP_TARGET[] = {0x00, 0x00, 0x11, 0x0C, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The advanced audio distribution profile UUID. (0000110D-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_A2DP[] = {0x00, 0x00, 0x11, 0x0D, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The audio/video remote control profile UUID. (0000110E-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_AVRCP[] = {0x00, 0x00, 0x11, 0x0E, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The audio/video remote control profile - controller UUID. (0000110F-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_AVRCP_CONTROLLER[] = {0x00, 0x00, 0x11, 0x0F, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The intercom profile UUID. (00001110-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_ICP[] = {0x00, 0x00, 0x11, 0x10, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The fax profile UUID. (00001111-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_FAX[] = {0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The headset profile - audio gateway UUID. (00001112-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HSP_AG[] = {0x00, 0x00, 0x11, 0x12, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The personal area networking profile - user UUID. (00001115-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_PAN_PANU[] = {0x00, 0x00, 0x11, 0x15, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The personal area networking profile - network access point UUID. (00001116-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_PAN_NAP[] = {0x00, 0x00, 0x11, 0x16, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The personal area networking profile - group ad-hoc networks UUID. (00001117-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_PAN_GN[] = {0x00, 0x00, 0x11, 0x17, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic printing profile - direct printing UUID. (00001118-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BPP_DIRECT_PRINTING[] = {0x00, 0x00, 0x11, 0x18, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic printing profile - reference printing UUID. (00001119-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BPP_REFERENCE_PRINTING[] = {0x00, 0x00, 0x11, 0x19, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic imaging profile UUID. (0000111A-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BIP[] = {0x00, 0x00, 0x11, 0x1A, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic imaging profile - imaging responder UUID. (0000111B-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BIP_RESPONDER[] = {0x00, 0x00, 0x11, 0x1B, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic imaging profile - imaging automatic archive UUID. (0000111C-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BIP_AUTOMATIC_ARCHIVE[] = {0x00, 0x00, 0x11, 0x1C, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic imaging profile - imaging referenced objects UUID. (0000111D-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BIP_REFERENCED_OBJECTS[] = {0x00, 0x00, 0x11, 0x1D, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The hands-free profile UUID. (0000111E-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HFP[] = {0x00, 0x00, 0x11, 0x1E, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The hands-free profile - audio gateway UUID. (0000111F-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HFP_AG[] = {0x00, 0x00, 0x11, 0x1F, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic printing profile - direct printing referenced objects UUID. (00001120-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BPP_DIRECT_PRINTING_RO[] = {0x00, 0x00, 0x11, 0x20, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic printing profile - reflected UI UUID. (00001121-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BPP_REFLECTED_UI[] = {0x00, 0x00, 0x11, 0x21, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic printing profile - basic printing UUID. (00001122-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BPP_BASIC_PRINTING[] = {0x00, 0x00, 0x11, 0x22, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The basic printing profile - printing status UUID. (00001123-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_BPP_PRINTING_STATUS[] = {0x00, 0x00, 0x11, 0x23, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The human interface device profile UUID. (00001124-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HID[] = {0x00, 0x00, 0x11, 0x24, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The hardcopy cable replacement profile UUID. (00001125-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HCRP[] = {0x00, 0x00, 0x11, 0x25, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The hardcopy cable replacement profile - print UUID. (00001126-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HCRP_PRINT[] = {0x00, 0x00, 0x11, 0x26, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The hardcopy cable replacement profile - scan UUID. (00001127-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HCRP_SCAN[] = {0x00, 0x00, 0x11, 0x27, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The SIM access profile UUID. (0000112D-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_SAP[] = {0x00, 0x00, 0x11, 0x2D, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The phone book access - client equipment UUID. (0000112E-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_PBAP_PCE[] = {0x00, 0x00, 0x11, 0x2E, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The phone book access - server equipment UUID. (0000112F-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_PBAP_PSE[] = {0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The phone book access UUID. (00001130-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_PBAP[] = {0x00, 0x00, 0x11, 0x30, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The headset profile - headset UUID. (00001131-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HSP_HS[] = {0x00, 0x00, 0x11, 0x31, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The message access profile - message access server UUID. (00001132-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_MAP_ACCESS_SERVER[] = {0x00, 0x00, 0x11, 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The message access profile - message notification server UUID. (00001133-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_MAP_NOTIFICATION_SERVER[] = {0x00, 0x00, 0x11, 0x33, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The message access profile - message access profile UUID. (00001134-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_MAP_ACCESS_PROFILE[] = {0x00, 0x00, 0x11, 0x34, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The device identification profile - PNP information UUID. (00001200-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_DID_PNP_INFORMATION[] = {0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The generic networking UUID. (00001201-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_GENERIC_NETWORKING[] = {0x00, 0x00, 0x12, 0x01, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The generic file transfer UUID. (00001202-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_GENERIC_FILE_TRANSFER[] = {0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The generic audio UUID. (00001203-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_GENERIC_AUDIO[] = {0x00, 0x00, 0x12, 0x03, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The generic telephony UUID. (00001204-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_GENERIC_TELEPHONY[] = {0x00, 0x00, 0x12, 0x04, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The video distribution profile - source UUID. (00001303-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_VDP_SOURCE[] = {0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The video distribution profile - sink UUID. (00001304-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_VDP_SINK[] = {0x00, 0x00, 0x13, 0x04, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The video distribution profile - distribution UUID. (00001305-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_VDP_DISTRIBUTION[] = {0x00, 0x00, 0x13, 0x05, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The health device profile UUID. (00001400-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HDP[] = {0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The health device profile - source UUID. (00001401-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HDP_SOURCE[] = {0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+// The health device profile - sink UUID. (00001402-0000-1000-8000-00805F9B34FB)
+const byte BT_SVC_UUID_HDP_SINK[] = {0x00, 0x00, 0x14, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
+
+
+BluetoothDevice::BluetoothDevice(void)
+ : __pImpl(null)
+{
+ __pImpl = new (std::nothrow) _BluetoothDeviceImpl();
+ SysTryReturnVoidResult(NID_NET_BT, __pImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+}
+
+BluetoothDevice::BluetoothDevice(const Tizen::Base::ByteBuffer& address, const Base::String& deviceName, BluetoothMajorDeviceClassType majorClassType, BluetoothMinorDeviceClassType minorClassType, unsigned long serviceClassList, unsigned long serviceList)
+ : __pImpl(null)
+{
+ __pImpl = new (std::nothrow) _BluetoothDeviceImpl(address, deviceName, majorClassType, minorClassType, serviceClassList, serviceList);
+ SysTryReturnVoidResult(NID_NET_BT, __pImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+}
+
+BluetoothDevice::BluetoothDevice(const BluetoothDevice& value)
+ : __pImpl(null)
+{
+ __pImpl = new (std::nothrow) _BluetoothDeviceImpl(*value.__pImpl);
+ SysTryReturnVoidResult(NID_NET_BT, __pImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+}
+
+BluetoothDevice::~BluetoothDevice(void)
+{
+ delete __pImpl;
+}
+
+BluetoothDevice&
+BluetoothDevice::operator =(const BluetoothDevice& rhs)
+{
+ if (this != &rhs)
+ {
+ *__pImpl = *rhs.__pImpl;
+ }
+
+ return *this;
+}
+
+const Tizen::Base::ByteBuffer*
+BluetoothDevice::GetAddress(void) const
+{
+ return __pImpl->GetAddress();
+}
+
+result
+BluetoothDevice::SetAddress(const Tizen::Base::ByteBuffer& address)
+{
+ return __pImpl->SetAddress(address);
+}
+
+String
+BluetoothDevice::GetName(void) const
+{
+ return __pImpl->GetName();
+}
+
+bool
+BluetoothDevice::IsPaired(void) const
+{
+ return __pImpl->IsPaired();
+}
+
+int
+BluetoothDevice::GetRssi(void) const
+{
+ return __pImpl->GetRssi();
+}
+
+BluetoothMajorDeviceClassType
+BluetoothDevice::GetMajorDeviceClassType(void) const
+{
+ return __pImpl->GetMajorDeviceClassType();
+}
+
+BluetoothMinorDeviceClassType
+BluetoothDevice::GetMinorDeviceClassType(void) const
+{
+ return __pImpl->GetMinorDeviceClassType();
+}
+
+unsigned long
+BluetoothDevice::GetServiceClassList(void) const
+{
+ return __pImpl->GetServiceClassList();
+}
+
+unsigned long
+BluetoothDevice::GetServiceList(void) const
+{
+ return __pImpl->GetServiceList();
+}
+
+const Tizen::Base::Collection::IList*
+BluetoothDevice::GetServiceUuidList(void) const
+{
+ return __pImpl->GetServiceUuidList();
+}
+
+bool
+BluetoothDevice::Equals(const Tizen::Base::Object& obj) const
+{
+ const BluetoothDevice* pOther = dynamic_cast <const BluetoothDevice*>(&obj);
+
+ if (pOther == null)
+ {
+ return false;
+ }
+
+ if (pOther == this)
+ {
+ return true;
+ }
+
+ return(__pImpl->Equals(*(pOther->__pImpl)));
+}
+
+int
+BluetoothDevice::GetHashCode(void) const
+{
+ return __pImpl->GetHashCode();
+}
+
+BluetoothDevice*
+BluetoothDevice::GetInstanceFromAppControlResultN(const Tizen::Base::Collection::IList& appControlResult)
+{
+ BluetoothDevice* pNewBtDevice = null;
+ String* pResultStrPtr = null;
+ String keywordStr;
+ String dataStr;
+ ByteBuffer btAddrBytes;
+ String deviceName;
+ long majClassType = 0;
+ long minClassType = 0;
+ long svcClassType = 0;
+ long svcType = 0;
+
+ ClearLastResult();
+
+ if (appControlResult.GetCount() != 7)
+ {
+ goto CATCH;
+ }
+
+ pResultStrPtr = (String*) appControlResult.GetAt(0);
+ if (pResultStrPtr->Equals(String(Tizen::App::APPCONTROL_RESULT_SUCCEEDED)) == false)
+ {
+ goto CATCH;
+ }
+
+ // Gets the address from index 1 as a String. E.g. 00-1E-2B-72-08-DB
+ pResultStrPtr = (String*) appControlResult.GetAt(1);
+ if ((pResultStrPtr->SubString(0, 9, keywordStr) != E_SUCCESS) ||
+ (keywordStr.Equals(String("addr_val:")) == false) ||
+ (pResultStrPtr->SubString(9, dataStr) != E_SUCCESS))
+ {
+ goto CATCH;
+ }
+
+ // Convert the type of the address to ByteBuffer
+ btAddrBytes.Construct(6);
+ if (_BluetoothDeviceImpl::GetAddressByteBuffer(dataStr, L"-", btAddrBytes) != E_SUCCESS)
+ {
+ goto CATCH;
+ }
+
+ keywordStr.Clear();
+ dataStr.Clear();
+
+ // Gets the name from index 2
+ pResultStrPtr = (String*) appControlResult.GetAt(2);
+ if ((pResultStrPtr->SubString(0, 9, keywordStr) != E_SUCCESS) ||
+ (keywordStr.Equals(String("dev_name:")) == false) ||
+ (pResultStrPtr->SubString(9, deviceName) != E_SUCCESS))
+ {
+ goto CATCH;
+ }
+
+ keywordStr.Clear();
+
+ // Gets the major device class from index 3
+ pResultStrPtr = (String*) appControlResult.GetAt(3);
+ if ((pResultStrPtr->SubString(0, 13, keywordStr) != E_SUCCESS) ||
+ (keywordStr.Equals(String("maj_cls_type:")) == false) ||
+ (pResultStrPtr->SubString(13, dataStr) != E_SUCCESS))
+ {
+ goto CATCH;
+ }
+
+ if (Long::Decode(dataStr, majClassType) != E_SUCCESS)
+ {
+ goto CATCH;
+ }
+
+ keywordStr.Clear();
+ dataStr.Clear();
+
+ // Gets the minor device class from index 4
+ pResultStrPtr = (String*) appControlResult.GetAt(4);
+ if ((pResultStrPtr->SubString(0, 13, keywordStr) != E_SUCCESS) ||
+ (keywordStr.Equals(String("min_cls_type:")) == false) ||
+ (pResultStrPtr->SubString(13, dataStr) != E_SUCCESS))
+ {
+ goto CATCH;
+ }
+
+ if (Long::Decode(dataStr, minClassType) != E_SUCCESS)
+ {
+ goto CATCH;
+ }
+
+ keywordStr.Clear();
+ dataStr.Clear();
+
+ // Gets the service classes as a bit-mask from index 5
+ pResultStrPtr = (String*) appControlResult.GetAt(5);
+ if ((pResultStrPtr->SubString(0, 13, keywordStr) != E_SUCCESS) ||
+ (keywordStr.Equals(String("svc_cls_type:")) == false) ||
+ (pResultStrPtr->SubString(13, dataStr) != E_SUCCESS))
+ {
+ goto CATCH;
+ }
+
+ if (Long::Decode(dataStr, svcClassType) != E_SUCCESS)
+ {
+ goto CATCH;
+ }
+
+ keywordStr.Clear();
+ dataStr.Clear();
+
+ // Gets the service types as a bit-mask from index 6
+ pResultStrPtr = (String*) appControlResult.GetAt(6);
+ if ((pResultStrPtr->SubString(0, 9, keywordStr) != E_SUCCESS) ||
+ (keywordStr.Equals(String("svc_type:")) == false) ||
+ (pResultStrPtr->SubString(9, dataStr) != E_SUCCESS))
+ {
+ goto CATCH;
+ }
+
+ if (Long::Decode(dataStr, svcType) != E_SUCCESS)
+ {
+ goto CATCH;
+ }
+
+ // Create an instance of BluetoothDevice.
+ pNewBtDevice =
+ new (std::nothrow) BluetoothDevice(btAddrBytes, deviceName, (BluetoothMajorDeviceClassType) majClassType,
+ (BluetoothMinorDeviceClassType) minClassType, svcClassType,
+ svcType);
+ if (pNewBtDevice == null)
+ {
+ SysLogException(NID_NET_BT, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] exception occurred on creating BluetoothDevice.");
+ SetLastResult(E_OUT_OF_MEMORY);
+ }
+
+ return pNewBtDevice;
+
+CATCH:
+
+ SysLogException(NID_NET_BT, E_INVALID_ARG, "[E_INVALID_ARG] exception occurred on parsing input data.");
+ SetLastResult(E_INVALID_ARG);
+
+ return null;
+}
+
+} } } // Tizen::Net::Bluetooth