| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_mac.h" | 5 #include "device/bluetooth/bluetooth_device_mac.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 BluetoothDeviceMac::BluetoothDeviceMac(IOBluetoothDevice* device) | 59 BluetoothDeviceMac::BluetoothDeviceMac(IOBluetoothDevice* device) |
| 60 : device_([device retain]) { | 60 : device_([device retain]) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 BluetoothDeviceMac::~BluetoothDeviceMac() { | 63 BluetoothDeviceMac::~BluetoothDeviceMac() { |
| 64 } | 64 } |
| 65 | 65 |
| 66 void BluetoothDeviceMac::AddObserver( | |
| 67 device::BluetoothDevice::Observer* observer) { | |
| 68 DCHECK(observer); | |
| 69 observers_.AddObserver(observer); | |
| 70 } | |
| 71 | |
| 72 void BluetoothDeviceMac::RemoveObserver( | |
| 73 device::BluetoothDevice::Observer* observer) { | |
| 74 DCHECK(observer); | |
| 75 observers_.RemoveObserver(observer); | |
| 76 } | |
| 77 | |
| 78 uint32 BluetoothDeviceMac::GetBluetoothClass() const { | 66 uint32 BluetoothDeviceMac::GetBluetoothClass() const { |
| 79 return [device_ classOfDevice]; | 67 return [device_ classOfDevice]; |
| 80 } | 68 } |
| 81 | 69 |
| 82 std::string BluetoothDeviceMac::GetDeviceName() const { | 70 std::string BluetoothDeviceMac::GetDeviceName() const { |
| 83 return base::SysNSStringToUTF8([device_ name]); | 71 return base::SysNSStringToUTF8([device_ name]); |
| 84 } | 72 } |
| 85 | 73 |
| 86 std::string BluetoothDeviceMac::GetAddress() const { | 74 std::string BluetoothDeviceMac::GetAddress() const { |
| 87 return GetDeviceAddress(device_); | 75 return GetDeviceAddress(device_); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 245 |
| 258 return power_level; | 246 return power_level; |
| 259 } | 247 } |
| 260 | 248 |
| 261 // static | 249 // static |
| 262 std::string BluetoothDeviceMac::GetDeviceAddress(IOBluetoothDevice* device) { | 250 std::string BluetoothDeviceMac::GetDeviceAddress(IOBluetoothDevice* device) { |
| 263 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString])); | 251 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString])); |
| 264 } | 252 } |
| 265 | 253 |
| 266 } // namespace device | 254 } // namespace device |
| OLD | NEW |