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

Side by Side Diff: device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h

Issue 1898643002: Refactor device::BluetoothGattXXX classes to split into remote/local. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor cleanup 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
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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_ 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "dbus/object_path.h" 13 #include "dbus/object_path.h"
14 #include "device/bluetooth/bluetooth_gatt_service_bluez.h" 14 #include "device/bluetooth/bluetooth_local_gatt_service.h"
15 #include "device/bluetooth/bluetooth_uuid.h" 15 #include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
16 16
17 namespace device { 17 namespace device {
18 18
19 class BluetoothAdapter; 19 class BluetoothAdapter;
20 class BluetoothDevice; 20 class BluetoothDevice;
21 class BluetoothGattCharacteristic; 21 class BluetoothRemoteGattCharacteristic;
22 22
23 } // namespace device 23 } // namespace device
24 24
25 namespace bluez { 25 namespace bluez {
26 26
27 class BluetoothAdapterBlueZ; 27 class BluetoothAdapterBlueZ;
28 class BluetoothDeviceBlueZ; 28 class BluetoothDeviceBlueZ;
29 29
30 // The BluetoothLocalGattServiceBlueZ class implements BluetootGattService 30 // The BluetoothLocalGattServiceBlueZ class implements BluetootGattService
31 // for local GATT services for platforms that use BlueZ. 31 // for local GATT services for platforms that use BlueZ.
32 class BluetoothLocalGattServiceBlueZ : public BluetoothGattServiceBlueZ { 32 class BluetoothLocalGattServiceBlueZ
33 : public BluetoothGattServiceBlueZ,
34 public device::BluetoothLocalGattService {
33 public: 35 public:
34 // device::BluetoothGattService overrides. 36 // device::BluetoothLocalGattService overrides.
35 device::BluetoothUUID GetUUID() const override;
36 bool IsLocal() const override;
37 bool IsPrimary() const override;
38 device::BluetoothDevice* GetDevice() const override;
39 bool AddCharacteristic(
40 device::BluetoothGattCharacteristic* characteristic) override;
41 bool AddIncludedService(device::BluetoothGattService* service) override;
42 void Register(const base::Closure& callback, 37 void Register(const base::Closure& callback,
43 const ErrorCallback& error_callback) override; 38 const ErrorCallback& error_callback) override;
44 void Unregister(const base::Closure& callback, 39 void Unregister(const base::Closure& callback,
45 const ErrorCallback& error_callback) override; 40 const ErrorCallback& error_callback) override;
46 41
47 private: 42 private:
48 friend class BluetoothDeviceBlueZ; 43 friend class BluetoothDeviceBlueZ;
49 44
50 BluetoothLocalGattServiceBlueZ(BluetoothAdapterBlueZ* adapter, 45 BluetoothLocalGattServiceBlueZ(BluetoothAdapterBlueZ* adapter,
51 const dbus::ObjectPath& object_path); 46 const dbus::ObjectPath& object_path);
52 ~BluetoothLocalGattServiceBlueZ() override; 47 ~BluetoothLocalGattServiceBlueZ() override;
53 48
54 // Called by dbus:: on unsuccessful completion of a request to register a 49 // Called by dbus:: on unsuccessful completion of a request to register a
55 // local service. 50 // local service.
56 void OnRegistrationError(const ErrorCallback& error_callback, 51 void OnRegistrationError(const ErrorCallback& error_callback,
57 const std::string& error_name, 52 const std::string& error_name,
58 const std::string& error_message); 53 const std::string& error_message);
59 54
60 // Note: This should remain the last member so it'll be destroyed and 55 // Note: This should remain the last member so it'll be destroyed and
61 // invalidate its weak pointers before any other members are destroyed. 56 // invalidate its weak pointers before any other members are destroyed.
62 base::WeakPtrFactory<BluetoothLocalGattServiceBlueZ> weak_ptr_factory_; 57 base::WeakPtrFactory<BluetoothLocalGattServiceBlueZ> weak_ptr_factory_;
63 58
64 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattServiceBlueZ); 59 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattServiceBlueZ);
65 }; 60 };
66 61
67 } // namespace bluez 62 } // namespace bluez
68 63
69 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_ 64 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698