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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h

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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
7
8 #include <stdint.h>
9
10 #include <string>
11 #include <vector>
12
13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h"
15 #include "dbus/object_path.h"
16 #include "device/bluetooth/bluetooth_gatt_descriptor.h"
17 #include "device/bluetooth/bluetooth_uuid.h"
18
19 namespace device {
20
21 class BluetoothGattCharacteristic;
22
23 } // namespace device
24
25 namespace bluez {
26
27 class BluetoothRemoteGattCharacteristicBlueZ;
28
29 // The BluetoothRemoteGattDescriptorBlueZ class implements
30 // BluetoothGattDescriptor for remote GATT characteristic descriptors for
31 // platforms that use BlueZ.
32 class BluetoothRemoteGattDescriptorBlueZ
33 : public device::BluetoothGattDescriptor {
34 public:
35 // device::BluetoothGattDescriptor overrides.
36 std::string GetIdentifier() const override;
37 device::BluetoothUUID GetUUID() const override;
38 bool IsLocal() const override;
39 const std::vector<uint8_t>& GetValue() const override;
40 device::BluetoothGattCharacteristic* GetCharacteristic() const override;
41 device::BluetoothGattCharacteristic::Permissions GetPermissions()
42 const override;
43 void ReadRemoteDescriptor(const ValueCallback& callback,
44 const ErrorCallback& error_callback) override;
45 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value,
46 const base::Closure& callback,
47 const ErrorCallback& error_callback) override;
48
49 // Object path of the underlying D-Bus characteristic.
50 const dbus::ObjectPath& object_path() const { return object_path_; }
51
52 private:
53 friend class BluetoothRemoteGattCharacteristicBlueZ;
54
55 BluetoothRemoteGattDescriptorBlueZ(
56 BluetoothRemoteGattCharacteristicBlueZ* characteristic,
57 const dbus::ObjectPath& object_path);
58 ~BluetoothRemoteGattDescriptorBlueZ() override;
59
60 // Called by dbus:: on unsuccessful completion of a request to read or write
61 // the descriptor value.
62 void OnError(const ErrorCallback& error_callback,
63 const std::string& error_name,
64 const std::string& error_message);
65
66 // Object path of the D-Bus descriptor object.
67 dbus::ObjectPath object_path_;
68
69 // The GATT characteristic this descriptor belongs to.
70 BluetoothRemoteGattCharacteristicBlueZ* characteristic_;
71
72 // Note: This should remain the last member so it'll be destroyed and
73 // invalidate its weak pointers before any other members are destroyed.
74 base::WeakPtrFactory<BluetoothRemoteGattDescriptorBlueZ> weak_ptr_factory_;
75
76 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorBlueZ);
77 };
78
79 } // namespace bluez
80
81 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698