| 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/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return l10n_util::GetStringFUTF16( | 88 return l10n_util::GetStringFUTF16( |
| 89 IDS_BLUETOOTH_DEVICE_KEYBOARD_MOUSE_COMBO, address_utf16); | 89 IDS_BLUETOOTH_DEVICE_KEYBOARD_MOUSE_COMBO, address_utf16); |
| 90 default: | 90 default: |
| 91 return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_UNKNOWN, | 91 return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_UNKNOWN, |
| 92 address_utf16); | 92 address_utf16); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const { | 96 BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const { |
| 97 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm | 97 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm |
| 98 uint32 bluetooth_class = GetBluetoothClass(); | 98 uint32_t bluetooth_class = GetBluetoothClass(); |
| 99 switch ((bluetooth_class & 0x1f00) >> 8) { | 99 switch ((bluetooth_class & 0x1f00) >> 8) { |
| 100 case 0x01: | 100 case 0x01: |
| 101 // Computer major device class. | 101 // Computer major device class. |
| 102 return DEVICE_COMPUTER; | 102 return DEVICE_COMPUTER; |
| 103 case 0x02: | 103 case 0x02: |
| 104 // Phone major device class. | 104 // Phone major device class. |
| 105 switch ((bluetooth_class & 0xfc) >> 2) { | 105 switch ((bluetooth_class & 0xfc) >> 2) { |
| 106 case 0x01: | 106 case 0x01: |
| 107 case 0x02: | 107 case 0x02: |
| 108 case 0x03: | 108 case 0x03: |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); | 337 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, | 340 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, |
| 341 const base::Closure& callback, | 341 const base::Closure& callback, |
| 342 const ConnectErrorCallback& error_callback) { | 342 const ConnectErrorCallback& error_callback) { |
| 343 NOTREACHED(); | 343 NOTREACHED(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace device | 346 } // namespace device |
| OLD | NEW |