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" |
11 #include "grit/device_bluetooth_strings.h" | 11 #include "grit/device_bluetooth_strings.h" |
12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
13 | 13 |
14 namespace device { | 14 namespace device { |
15 | 15 |
16 // static | 16 // static |
17 bool BluetoothDevice::IsUUIDValid(const std::string& uuid) { | 17 bool BluetoothDevice::IsUUIDValid(const std::string& uuid) { |
18 return !bluetooth_utils::CanonicalUuid(uuid).empty(); | 18 return !bluetooth_utils::CanonicalUuid(uuid).empty(); |
19 } | 19 } |
20 | 20 |
21 BluetoothDevice::BluetoothDevice() | 21 BluetoothDevice::BluetoothDevice(const std::string& name, |
22 : bluetooth_class_(0), | 22 const std::string& address, |
23 uint32 bluetooth_class, | |
24 bool connected, | |
25 bool bonded) | |
26 : bluetooth_class_(bluetooth_class), | |
27 name_(name), | |
28 address_(address), | |
23 visible_(false), | 29 visible_(false), |
24 bonded_(false), | 30 bonded_(bonded), |
25 connected_(false), | 31 connected_(connected), |
26 connectable_(true), | 32 connectable_(true), |
27 connecting_(false) { | 33 connecting_(false) { |
keybuk
2013/03/21 18:03:34
What's the reason for adding these methods to the
youngki
2013/03/21 18:43:28
I think the member variables to BluetoothDevice sh
keybuk
2013/03/21 18:46:25
My concern is that these don't need to be member v
youngki
2013/03/21 20:07:20
Currently BluetoothDevice::address() is returning
keybuk
2013/03/25 16:49:47
It should probably just return std::string; and ye
youngki
2013/03/25 17:52:03
So according to the new design doc it's likely we
| |
28 } | 34 } |
29 | 35 |
30 BluetoothDevice::~BluetoothDevice() { | 36 BluetoothDevice::~BluetoothDevice() { |
31 } | 37 } |
32 | 38 |
33 const std::string& BluetoothDevice::address() const { | 39 const std::string& BluetoothDevice::address() const { |
34 return address_; | 40 return address_; |
35 } | 41 } |
36 | 42 |
37 string16 BluetoothDevice::GetName() const { | 43 string16 BluetoothDevice::GetName() const { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 const BluetoothDevice::ServiceList& services = GetServices(); | 197 const BluetoothDevice::ServiceList& services = GetServices(); |
192 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); | 198 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); |
193 iter != services.end(); | 199 iter != services.end(); |
194 ++iter) { | 200 ++iter) { |
195 if (bluetooth_utils::CanonicalUuid(*iter) == canonical_uuid) | 201 if (bluetooth_utils::CanonicalUuid(*iter) == canonical_uuid) |
196 return true; | 202 return true; |
197 } | 203 } |
198 return false; | 204 return false; |
199 } | 205 } |
200 | 206 |
207 void BluetoothDevice::SetVisible(bool visible) { | |
208 visible_ = visible; | |
209 } | |
210 | |
201 } // namespace device | 211 } // namespace device |
OLD | NEW |