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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "device/bluetooth/bluetooth_gatt_service.h" | 11 #include "device/bluetooth/bluetooth_gatt_service.h" |
12 #include "grit/device_bluetooth_strings.h" | 12 #include "grit/device_bluetooth_strings.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 namespace device { | 15 namespace device { |
16 | 16 |
17 BluetoothDevice::BluetoothDevice() { | 17 BluetoothDevice::BluetoothDevice() { |
18 } | 18 } |
19 | 19 |
20 BluetoothDevice::~BluetoothDevice() { | 20 BluetoothDevice::~BluetoothDevice() { |
21 STLDeleteValues(&gatt_services_); | 21 STLDeleteValues(&gatt_services_); |
22 } | 22 } |
23 | 23 |
| 24 BluetoothDevice::ConnectionInfo::ConnectionInfo() |
| 25 : rssi(kUnknownPower), |
| 26 transmit_power(kUnknownPower), |
| 27 max_transmit_power(kUnknownPower) {} |
| 28 |
| 29 BluetoothDevice::ConnectionInfo::ConnectionInfo( |
| 30 int rssi, int transmit_power, int max_transmit_power) |
| 31 : rssi(rssi), |
| 32 transmit_power(transmit_power), |
| 33 max_transmit_power(max_transmit_power) {} |
| 34 |
| 35 BluetoothDevice::ConnectionInfo::~ConnectionInfo() {} |
| 36 |
24 base::string16 BluetoothDevice::GetName() const { | 37 base::string16 BluetoothDevice::GetName() const { |
25 std::string name = GetDeviceName(); | 38 std::string name = GetDeviceName(); |
26 if (!name.empty()) { | 39 if (!name.empty()) { |
27 return base::UTF8ToUTF16(name); | 40 return base::UTF8ToUTF16(name); |
28 } else { | 41 } else { |
29 return GetAddressWithLocalizedDeviceTypeName(); | 42 return GetAddressWithLocalizedDeviceTypeName(); |
30 } | 43 } |
31 } | 44 } |
32 | 45 |
33 base::string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const { | 46 base::string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return std::string(); | 244 return std::string(); |
232 | 245 |
233 canonicalized[i] = base::ToUpperASCII(canonicalized[i]); | 246 canonicalized[i] = base::ToUpperASCII(canonicalized[i]); |
234 } | 247 } |
235 } | 248 } |
236 | 249 |
237 return canonicalized; | 250 return canonicalized; |
238 } | 251 } |
239 | 252 |
240 } // namespace device | 253 } // namespace device |
OLD | NEW |