2 // Tizen Web Device API
3 // Copyright (c) 2012 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.
18 #include <PlatformException.h>
20 #include "BluetoothClassDeviceMajor.h"
27 BluetoothClassDeviceMajor::BluetoothClassDeviceMajor()
29 mMajorStringMap.insert(std::pair<std::string, unsigned long>("MISC", 0x00));
30 mMajorStringMap.insert(std::pair<std::string, unsigned long>("COMPUTER", 0x01));
31 mMajorStringMap.insert(std::pair<std::string, unsigned long>("PHONE", 0x02));
32 mMajorStringMap.insert(std::pair<std::string, unsigned long>("NETWORK", 0x03));
33 mMajorStringMap.insert(std::pair<std::string, unsigned long>("AUDIO_VIDEO", 0x04));
34 mMajorStringMap.insert(std::pair<std::string, unsigned long>("PERIPHERAL", 0x05));
35 mMajorStringMap.insert(std::pair<std::string, unsigned long>("IMAGING", 0x06));
36 mMajorStringMap.insert(std::pair<std::string, unsigned long>("WEARABLE", 0x07));
37 mMajorStringMap.insert(std::pair<std::string, unsigned long>("TOY", 0x08));
38 mMajorStringMap.insert(std::pair<std::string, unsigned long>("HEALTH", 0x09));
39 mMajorStringMap.insert(std::pair<std::string, unsigned long>("UNCATEGORIZED", 0x1F));
41 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_MISC, 0x00));
42 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_COMPUTER, 0x01));
43 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_PHONE, 0x02));
44 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT, 0x03));
45 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_AUDIO_VIDEO, 0x04));
46 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_PERIPHERAL, 0x05));
47 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_IMAGING, 0x06));
48 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_WEARABLE, 0x07));
49 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_TOY, 0x08));
50 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_HEALTH, 0x09));
51 mMajorEnumMap.insert(std::pair<bt_major_device_class_e, unsigned long>(BT_MAJOR_DEVICE_CLASS_UNCATEGORIZED, 0x1F));
54 BluetoothClassDeviceMajor::~BluetoothClassDeviceMajor()
58 BluetoothClassDeviceMajor* BluetoothClassDeviceMajor::getInstance()
60 static BluetoothClassDeviceMajor instance;
64 unsigned long BluetoothClassDeviceMajor::getMajorValue(std::string major)
66 return mMajorStringMap.find(major)->second;
69 unsigned long BluetoothClassDeviceMajor::getMajorValue(bt_major_device_class_e major)
71 return mMajorEnumMap.find(major)->second;