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_classic_device_mac.h" | 5 #include "device/bluetooth/bluetooth_classic_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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 uint32 BluetoothClassicDeviceMac::GetBluetoothClass() const { | 69 uint32 BluetoothClassicDeviceMac::GetBluetoothClass() const { |
70 return [device_ classOfDevice]; | 70 return [device_ classOfDevice]; |
71 } | 71 } |
72 | 72 |
73 std::string BluetoothClassicDeviceMac::GetDeviceName() const { | 73 std::string BluetoothClassicDeviceMac::GetDeviceName() const { |
74 return base::SysNSStringToUTF8([device_ name]); | 74 return base::SysNSStringToUTF8([device_ name]); |
75 } | 75 } |
76 | 76 |
| 77 void BluetoothClassicDeviceMac::CreateGattConnectionImpl() { |
| 78 // Classic devices do not support GATT connection. |
| 79 DidFailToConnectGatt(ERROR_UNSUPPORTED_DEVICE); |
| 80 } |
| 81 |
| 82 void BluetoothClassicDeviceMac::DisconnectGatt() {} |
| 83 |
77 std::string BluetoothClassicDeviceMac::GetAddress() const { | 84 std::string BluetoothClassicDeviceMac::GetAddress() const { |
78 return GetDeviceAddress(device_); | 85 return GetDeviceAddress(device_); |
79 } | 86 } |
80 | 87 |
81 BluetoothDevice::VendorIDSource BluetoothClassicDeviceMac::GetVendorIDSource() | 88 BluetoothDevice::VendorIDSource BluetoothClassicDeviceMac::GetVendorIDSource() |
82 const { | 89 const { |
83 return VENDOR_ID_UNKNOWN; | 90 return VENDOR_ID_UNKNOWN; |
84 } | 91 } |
85 | 92 |
86 uint16 BluetoothClassicDeviceMac::GetVendorID() const { | 93 uint16 BluetoothClassicDeviceMac::GetVendorID() const { |
87 return 0; | 94 return 0; |
88 } | 95 } |
89 | 96 |
90 uint16 BluetoothClassicDeviceMac::GetProductID() const { | 97 uint16 BluetoothClassicDeviceMac::GetProductID() const { |
91 return 0; | 98 return 0; |
92 } | 99 } |
93 | 100 |
94 uint16 BluetoothClassicDeviceMac::GetDeviceID() const { | 101 uint16 BluetoothClassicDeviceMac::GetDeviceID() const { |
95 return 0; | 102 return 0; |
96 } | 103 } |
97 | 104 |
98 bool BluetoothClassicDeviceMac::IsPaired() const { | 105 bool BluetoothClassicDeviceMac::IsPaired() const { |
99 return [device_ isPaired]; | 106 return [device_ isPaired]; |
100 } | 107 } |
101 | 108 |
102 bool BluetoothClassicDeviceMac::IsConnected() const { | 109 bool BluetoothClassicDeviceMac::IsConnected() const { |
103 return [device_ isConnected]; | 110 return [device_ isConnected]; |
104 } | 111 } |
105 | 112 |
| 113 bool BluetoothClassicDeviceMac::IsGattConnected() const { |
| 114 return false; // Classic devices do not support GATT connection. |
| 115 } |
| 116 |
106 bool BluetoothClassicDeviceMac::IsConnectable() const { | 117 bool BluetoothClassicDeviceMac::IsConnectable() const { |
107 return false; | 118 return false; |
108 } | 119 } |
109 | 120 |
110 bool BluetoothClassicDeviceMac::IsConnecting() const { | 121 bool BluetoothClassicDeviceMac::IsConnecting() const { |
111 return false; | 122 return false; |
112 } | 123 } |
113 | 124 |
114 BluetoothDevice::UUIDList BluetoothClassicDeviceMac::GetUUIDs() const { | 125 BluetoothDevice::UUIDList BluetoothClassicDeviceMac::GetUUIDs() const { |
115 UUIDList uuids; | 126 UUIDList uuids; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 return power_level; | 271 return power_level; |
261 } | 272 } |
262 | 273 |
263 // static | 274 // static |
264 std::string BluetoothClassicDeviceMac::GetDeviceAddress( | 275 std::string BluetoothClassicDeviceMac::GetDeviceAddress( |
265 IOBluetoothDevice* device) { | 276 IOBluetoothDevice* device) { |
266 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString])); | 277 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString])); |
267 } | 278 } |
268 | 279 |
269 } // namespace device | 280 } // namespace device |
OLD | NEW |