forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbluetooth_gatt_connection_bluez.h
59 lines (44 loc) · 1.79 KB
/
bluetooth_gatt_connection_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
// 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_GATT_CONNECTION_BLUEZ_H_
#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_CONNECTION_BLUEZ_H_
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_gatt_connection.h"
#include "device/bluetooth/dbus/bluetooth_device_client.h"
namespace device {
class BluetoothAdapter;
} // namespace device
namespace bluez {
// BluetoothGattConnectionBlueZ implements BluetoothGattConnection for
// platforms that use BlueZ.
class BluetoothGattConnectionBlueZ
: public device::BluetoothGattConnection,
public bluez::BluetoothDeviceClient::Observer {
public:
explicit BluetoothGattConnectionBlueZ(
scoped_refptr<device::BluetoothAdapter> adapter,
const std::string& device_address,
const dbus::ObjectPath& object_path);
~BluetoothGattConnectionBlueZ() override;
// BluetoothGattConnection overrides.
bool IsConnected() override;
void Disconnect() override;
private:
// bluez::Bluetooth$1Client::Observer overrides.
void DeviceRemoved(const dbus::ObjectPath& object_path) override;
void DevicePropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
// True, if the connection is currently active.
bool connected_;
// D-Bus object path of the underlying device. This is used to filter observer
// events.
dbus::ObjectPath object_path_;
DISALLOW_COPY_AND_ASSIGN(BluetoothGattConnectionBlueZ);
};
} // namespace bluez
#endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_CONNECTION_BLUEZ_H_