Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: device/bluetooth/bluetooth_local_gatt_service_bluez.cc

Issue 1872943002: Add support for local services/characteristics/descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
ortuno 2016/04/14 17:42:36 2016
rkc 2016/04/14 19:27:28 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/bluetooth_local_gatt_service_bluez.h"
6
7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h"
9 #include "device/bluetooth/bluetooth_adapter_bluez.h"
10 #include "device/bluetooth/bluetooth_device_bluez.h"
11 #include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h"
12 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
13 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
ortuno 2016/04/14 17:42:36 Clean up includes here as well.
rkc 2016/04/14 19:27:28 Done.
14
15 namespace bluez {
16
17 BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ(
18 BluetoothAdapterBlueZ* adapter,
19 const dbus::ObjectPath& object_path)
20 : BluetoothGattServiceBlueZ(adapter, object_path), weak_ptr_factory_(this) {
21 VLOG(1) << "Creating local GATT service with identifier: "
22 << object_path.value();
23 }
24
25 BluetoothLocalGattServiceBlueZ::~BluetoothLocalGattServiceBlueZ() {}
26
27 device::BluetoothUUID BluetoothLocalGattServiceBlueZ::GetUUID() const {
28 NOTIMPLEMENTED();
29 return device::BluetoothUUID();
30 }
31
32 bool BluetoothLocalGattServiceBlueZ::IsLocal() const {
33 return true;
34 }
35
36 bool BluetoothLocalGattServiceBlueZ::IsPrimary() const {
ortuno 2016/04/14 17:42:36 This should be true right? There is no way to cons
rkc 2016/04/14 19:27:28 This method doesn't apply to local characteristics
ortuno 2016/04/14 21:17:38 But this is not a characteristic :P Anyway I reali
rkc 2016/04/14 21:59:38 Acknowledged.
37 NOTIMPLEMENTED();
38 return false;
39 }
40
41 device::BluetoothDevice* BluetoothLocalGattServiceBlueZ::GetDevice() const {
42 return nullptr;
43 }
44
45 bool BluetoothLocalGattServiceBlueZ::AddCharacteristic(
ortuno 2016/04/14 17:42:36 I'm guessing these Add functions will be removed b
rkc 2016/04/14 19:27:28 Acknowledged.
46 device::BluetoothGattCharacteristic* characteristic) {
47 NOTIMPLEMENTED();
48 return false;
49 }
50
51 bool BluetoothLocalGattServiceBlueZ::AddIncludedService(
52 device::BluetoothGattService* service) {
53 NOTIMPLEMENTED();
54 return false;
55 }
56
57 void BluetoothLocalGattServiceBlueZ::Register(
ortuno 2016/04/14 17:42:36 I thought you were moving this to the adapter?
rkc 2016/04/14 19:27:28 Please see my other comments regarding this being
58 const base::Closure& callback,
59 const ErrorCallback& error_callback) {
60 DCHECK(bluez::BluezDBusManager::Get());
61 bluez::BluezDBusManager::Get()
62 ->GetBluetoothGattManagerClient()
63 ->RegisterService(
64 object_path(), BluetoothGattManagerClient::Options(), callback,
65 base::Bind(&BluetoothLocalGattServiceBlueZ::OnRegistrationError,
66 weak_ptr_factory_.GetWeakPtr(), error_callback));
67 }
68
69 void BluetoothLocalGattServiceBlueZ::Unregister(
70 const base::Closure& callback,
71 const ErrorCallback& error_callback) {
72 DCHECK(bluez::BluezDBusManager::Get());
73 bluez::BluezDBusManager::Get()
74 ->GetBluetoothGattManagerClient()
75 ->UnregisterService(
76 object_path(), callback,
77 base::Bind(&BluetoothLocalGattServiceBlueZ::OnRegistrationError,
78 weak_ptr_factory_.GetWeakPtr(), error_callback));
79 }
80
81 void BluetoothLocalGattServiceBlueZ::OnRegistrationError(
82 const ErrorCallback& error_callback,
83 const std::string& error_name,
84 const std::string& error_message) {
85 VLOG(1) << "[Un]Register Service failed: " << error_name
86 << ", message: " << error_message;
87 error_callback.Run(
88 BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name));
89 }
90
91 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698