| 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_chromeos.h" | 5 #include "device/bluetooth/bluetooth_device_chromeos.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 std::string BluetoothDeviceChromeOS::GetDeviceName() const { | 173 std::string BluetoothDeviceChromeOS::GetDeviceName() const { |
| 174 BluetoothDeviceClient::Properties* properties = | 174 BluetoothDeviceClient::Properties* properties = |
| 175 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> | 175 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
| 176 GetProperties(object_path_); | 176 GetProperties(object_path_); |
| 177 DCHECK(properties); | 177 DCHECK(properties); |
| 178 | 178 |
| 179 return properties->alias.value(); | 179 return properties->alias.value(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void BluetoothDeviceChromeOS::CreateGattConnectionImpl() { |
| 183 // ChromeOS implementation does not use the default CreateGattConnection |
| 184 // implementation. |
| 185 NOTIMPLEMENTED(); |
| 186 } |
| 187 |
| 188 void BluetoothDeviceChromeOS::DisconnectGatt() { |
| 189 // ChromeOS implementation does not use the default CreateGattConnection |
| 190 // implementation. |
| 191 NOTIMPLEMENTED(); |
| 192 } |
| 193 |
| 182 std::string BluetoothDeviceChromeOS::GetAddress() const { | 194 std::string BluetoothDeviceChromeOS::GetAddress() const { |
| 183 BluetoothDeviceClient::Properties* properties = | 195 BluetoothDeviceClient::Properties* properties = |
| 184 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> | 196 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
| 185 GetProperties(object_path_); | 197 GetProperties(object_path_); |
| 186 DCHECK(properties); | 198 DCHECK(properties); |
| 187 | 199 |
| 188 return CanonicalizeAddress(properties->address.value()); | 200 return CanonicalizeAddress(properties->address.value()); |
| 189 } | 201 } |
| 190 | 202 |
| 191 BluetoothDevice::VendorIDSource | 203 BluetoothDevice::VendorIDSource |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 239 |
| 228 bool BluetoothDeviceChromeOS::IsConnected() const { | 240 bool BluetoothDeviceChromeOS::IsConnected() const { |
| 229 BluetoothDeviceClient::Properties* properties = | 241 BluetoothDeviceClient::Properties* properties = |
| 230 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> | 242 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
| 231 GetProperties(object_path_); | 243 GetProperties(object_path_); |
| 232 DCHECK(properties); | 244 DCHECK(properties); |
| 233 | 245 |
| 234 return properties->connected.value(); | 246 return properties->connected.value(); |
| 235 } | 247 } |
| 236 | 248 |
| 249 bool BluetoothDeviceChromeOS::IsGattConnected() const { |
| 250 NOTIMPLEMENTED(); |
| 251 return false; |
| 252 } |
| 253 |
| 237 bool BluetoothDeviceChromeOS::IsConnectable() const { | 254 bool BluetoothDeviceChromeOS::IsConnectable() const { |
| 238 BluetoothInputClient::Properties* input_properties = | 255 BluetoothInputClient::Properties* input_properties = |
| 239 DBusThreadManager::Get()->GetBluetoothInputClient()-> | 256 DBusThreadManager::Get()->GetBluetoothInputClient()-> |
| 240 GetProperties(object_path_); | 257 GetProperties(object_path_); |
| 241 // GetProperties returns NULL when the device does not implement the given | 258 // GetProperties returns NULL when the device does not implement the given |
| 242 // interface. Non HID devices are normally connectable. | 259 // interface. Non HID devices are normally connectable. |
| 243 if (!input_properties) | 260 if (!input_properties) |
| 244 return true; | 261 return true; |
| 245 | 262 |
| 246 return input_properties->reconnect_mode.value() != "device"; | 263 return input_properties->reconnect_mode.value() != "device"; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 void BluetoothDeviceChromeOS::OnForgetError( | 730 void BluetoothDeviceChromeOS::OnForgetError( |
| 714 const ErrorCallback& error_callback, | 731 const ErrorCallback& error_callback, |
| 715 const std::string& error_name, | 732 const std::string& error_name, |
| 716 const std::string& error_message) { | 733 const std::string& error_message) { |
| 717 LOG(WARNING) << object_path_.value() << ": Failed to remove device: " | 734 LOG(WARNING) << object_path_.value() << ": Failed to remove device: " |
| 718 << error_name << ": " << error_message; | 735 << error_name << ": " << error_message; |
| 719 error_callback.Run(); | 736 error_callback.Run(); |
| 720 } | 737 } |
| 721 | 738 |
| 722 } // namespace chromeos | 739 } // namespace chromeos |
| OLD | NEW |