| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/bluez/bluetooth_local_gatt_service_bluez.h" |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/callback.h" | 8 #include "base/callback.h" |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "device/bluetooth/bluetooth_adapter_bluez.h" | 10 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" |
| 9 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | |
| 10 #include "device/bluetooth/bluetooth_local_gatt_service_bluez.h" | |
| 11 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h" | 11 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h" |
| 12 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 12 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 13 | 13 |
| 14 namespace bluez { | 14 namespace bluez { |
| 15 | 15 |
| 16 BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ( | 16 BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ( |
| 17 BluetoothAdapterBlueZ* adapter, | 17 BluetoothAdapterBlueZ* adapter, |
| 18 const dbus::ObjectPath& object_path) | 18 const dbus::ObjectPath& object_path) |
| 19 : BluetoothGattServiceBlueZ(adapter, object_path), weak_ptr_factory_(this) { | 19 : BluetoothGattServiceBlueZ(adapter, object_path), weak_ptr_factory_(this) { |
| 20 VLOG(1) << "Creating local GATT service with identifier: " | 20 VLOG(1) << "Creating local GATT service with identifier: " |
| 21 << object_path.value(); | 21 << object_path.value(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 BluetoothLocalGattServiceBlueZ::~BluetoothLocalGattServiceBlueZ() {} | 24 BluetoothLocalGattServiceBlueZ::~BluetoothLocalGattServiceBlueZ() {} |
| 25 | 25 |
| 26 device::BluetoothUUID BluetoothLocalGattServiceBlueZ::GetUUID() const { | |
| 27 NOTIMPLEMENTED(); | |
| 28 return device::BluetoothUUID(); | |
| 29 } | |
| 30 | |
| 31 bool BluetoothLocalGattServiceBlueZ::IsLocal() const { | |
| 32 return true; | |
| 33 } | |
| 34 | |
| 35 bool BluetoothLocalGattServiceBlueZ::IsPrimary() const { | |
| 36 NOTIMPLEMENTED(); | |
| 37 return false; | |
| 38 } | |
| 39 | |
| 40 device::BluetoothDevice* BluetoothLocalGattServiceBlueZ::GetDevice() const { | |
| 41 return nullptr; | |
| 42 } | |
| 43 | |
| 44 bool BluetoothLocalGattServiceBlueZ::AddCharacteristic( | |
| 45 device::BluetoothGattCharacteristic* characteristic) { | |
| 46 NOTIMPLEMENTED(); | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 bool BluetoothLocalGattServiceBlueZ::AddIncludedService( | |
| 51 device::BluetoothGattService* service) { | |
| 52 NOTIMPLEMENTED(); | |
| 53 return false; | |
| 54 } | |
| 55 | |
| 56 void BluetoothLocalGattServiceBlueZ::Register( | 26 void BluetoothLocalGattServiceBlueZ::Register( |
| 57 const base::Closure& callback, | 27 const base::Closure& callback, |
| 58 const ErrorCallback& error_callback) { | 28 const ErrorCallback& error_callback) { |
| 59 DCHECK(bluez::BluezDBusManager::Get()); | 29 DCHECK(bluez::BluezDBusManager::Get()); |
| 60 bluez::BluezDBusManager::Get() | 30 bluez::BluezDBusManager::Get() |
| 61 ->GetBluetoothGattManagerClient() | 31 ->GetBluetoothGattManagerClient() |
| 62 ->RegisterService( | 32 ->RegisterService( |
| 63 object_path(), BluetoothGattManagerClient::Options(), callback, | 33 object_path(), BluetoothGattManagerClient::Options(), callback, |
| 64 base::Bind(&BluetoothLocalGattServiceBlueZ::OnRegistrationError, | 34 base::Bind(&BluetoothLocalGattServiceBlueZ::OnRegistrationError, |
| 65 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 35 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 const ErrorCallback& error_callback, | 51 const ErrorCallback& error_callback, |
| 82 const std::string& error_name, | 52 const std::string& error_name, |
| 83 const std::string& error_message) { | 53 const std::string& error_message) { |
| 84 VLOG(1) << "[Un]Register Service failed: " << error_name | 54 VLOG(1) << "[Un]Register Service failed: " << error_name |
| 85 << ", message: " << error_message; | 55 << ", message: " << error_message; |
| 86 error_callback.Run( | 56 error_callback.Run( |
| 87 BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name)); | 57 BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name)); |
| 88 } | 58 } |
| 89 | 59 |
| 90 } // namespace bluez | 60 } // namespace bluez |
| OLD | NEW |