Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: device/bluetooth/bluetooth_device.cc

Issue 735893002: Add GetConnectionInfo function for BluetoothDevice, replacing the existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile errors on other platforms Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_chromeos.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698