forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbluetooth_local_gatt_descriptor_bluez.h
61 lines (47 loc) · 2.27 KB
/
bluetooth_local_gatt_descriptor_bluez.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_
#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_local_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_local_gatt_descriptor.h"
#include "device/bluetooth/bluez/bluetooth_gatt_descriptor_bluez.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
namespace bluez {
class BluetoothLocalGattCharacteristicBlueZ;
// The BluetoothLocalGattDescriptorBlueZ class implements
// BluetoothRemoteGattDescriptor for remote and local GATT characteristic
// descriptors for platforms that use BlueZ.
class BluetoothLocalGattDescriptorBlueZ
: public BluetoothGattDescriptorBlueZ,
public device::BluetoothLocalGattDescriptor {
public:
BluetoothLocalGattDescriptorBlueZ(
const device::BluetoothUUID& uuid,
device::BluetoothGattCharacteristic::Permissions permissions,
BluetoothLocalGattCharacteristicBlueZ* characteristic);
~BluetoothLocalGattDescriptorBlueZ() override;
// device::BluetoothLocalGattDescriptor overrides.
device::BluetoothUUID GetUUID() const override;
device::BluetoothGattCharacteristic::Permissions GetPermissions()
const override;
device::BluetoothLocalGattCharacteristic* GetCharacteristic() const override;
private:
// Needs access to weak_ptr_factory_.
friend class device::BluetoothLocalGattDescriptor;
// UUID of this descriptor.
device::BluetoothUUID uuid_;
// Permissions of this descriptor.
device::BluetoothGattCharacteristic::Permissions permissions_;
// Characteristic that contains this descriptor.
BluetoothLocalGattCharacteristicBlueZ* characteristic_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<BluetoothLocalGattDescriptorBlueZ> weak_ptr_factory_{
this};
DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattDescriptorBlueZ);
};
} // namespace bluez
#endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_