| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/bluetooth/bluetooth_device.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "device/bluetooth/bluetooth_utils.h" | 10 #include "device/bluetooth/bluetooth_utils.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 case 0x03: | 151 case 0x03: |
| 152 // Combo device. | 152 // Combo device. |
| 153 return DEVICE_KEYBOARD_MOUSE_COMBO; | 153 return DEVICE_KEYBOARD_MOUSE_COMBO; |
| 154 } | 154 } |
| 155 break; | 155 break; |
| 156 } | 156 } |
| 157 | 157 |
| 158 return DEVICE_UNKNOWN; | 158 return DEVICE_UNKNOWN; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool BluetoothDevice::IsPairable() const { |
| 162 DeviceType type = GetDeviceType(); |
| 163 |
| 164 // Get the vendor part of the address: "00:11:22" for "00:11:22:33:44:55" |
| 165 std::string vendor = GetAddress().substr(0, 8); |
| 166 |
| 167 // Verbatim "Bluetooth Mouse", model 96674 |
| 168 if ((type == DEVICE_MOUSE && vendor == "00:12:A1") || |
| 169 // Microsoft "Microsoft Bluetooth Notebook Mouse 5000", model X807028-001 |
| 170 (type == DEVICE_MOUSE && vendor == "7C:ED:8D")) |
| 171 return false; |
| 172 // TODO: Move this database into a config file. |
| 173 |
| 174 return true; |
| 175 } |
| 161 | 176 |
| 162 bool BluetoothDevice::ProvidesServiceWithUUID( | 177 bool BluetoothDevice::ProvidesServiceWithUUID( |
| 163 const std::string& uuid) const { | 178 const std::string& uuid) const { |
| 164 std::string canonical_uuid = bluetooth_utils::CanonicalUuid(uuid); | 179 std::string canonical_uuid = bluetooth_utils::CanonicalUuid(uuid); |
| 165 BluetoothDevice::ServiceList services = GetServices(); | 180 BluetoothDevice::ServiceList services = GetServices(); |
| 166 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); | 181 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); |
| 167 iter != services.end(); | 182 iter != services.end(); |
| 168 ++iter) { | 183 ++iter) { |
| 169 if (bluetooth_utils::CanonicalUuid(*iter) == canonical_uuid) | 184 if (bluetooth_utils::CanonicalUuid(*iter) == canonical_uuid) |
| 170 return true; | 185 return true; |
| 171 } | 186 } |
| 172 return false; | 187 return false; |
| 173 } | 188 } |
| 174 | 189 |
| 175 } // namespace device | 190 } // namespace device |
| OLD | NEW |