Chromium Code Reviews| 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; | |
|
stevenjb
2013/04/17 21:19:20
Add a TODO item to put this into a config file (si
| |
| 172 | |
| 173 return true; | |
| 174 } | |
| 161 | 175 |
| 162 bool BluetoothDevice::ProvidesServiceWithUUID( | 176 bool BluetoothDevice::ProvidesServiceWithUUID( |
| 163 const std::string& uuid) const { | 177 const std::string& uuid) const { |
| 164 std::string canonical_uuid = bluetooth_utils::CanonicalUuid(uuid); | 178 std::string canonical_uuid = bluetooth_utils::CanonicalUuid(uuid); |
| 165 BluetoothDevice::ServiceList services = GetServices(); | 179 BluetoothDevice::ServiceList services = GetServices(); |
| 166 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); | 180 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); |
| 167 iter != services.end(); | 181 iter != services.end(); |
| 168 ++iter) { | 182 ++iter) { |
| 169 if (bluetooth_utils::CanonicalUuid(*iter) == canonical_uuid) | 183 if (bluetooth_utils::CanonicalUuid(*iter) == canonical_uuid) |
| 170 return true; | 184 return true; |
| 171 } | 185 } |
| 172 return false; | 186 return false; |
| 173 } | 187 } |
| 174 | 188 |
| 175 } // namespace device | 189 } // namespace device |
| OLD | NEW |