OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/optional.h" |
16 #include "base/sequenced_task_runner.h" | 17 #include "base/sequenced_task_runner.h" |
17 #include "dbus/object_path.h" | 18 #include "dbus/object_path.h" |
18 #include "device/bluetooth/bluetooth_device.h" | 19 #include "device/bluetooth/bluetooth_device.h" |
19 #include "device/bluetooth/bluetooth_export.h" | 20 #include "device/bluetooth/bluetooth_export.h" |
20 #include "device/bluetooth/dbus/bluetooth_device_client.h" | 21 #include "device/bluetooth/dbus/bluetooth_device_client.h" |
21 #include "device/bluetooth/dbus/bluetooth_gatt_service_client.h" | 22 #include "device/bluetooth/dbus/bluetooth_gatt_service_client.h" |
22 | 23 |
23 namespace device { | 24 namespace device { |
24 class BluetoothSocketThread; | 25 class BluetoothSocketThread; |
25 } // namespace device | 26 } // namespace device |
(...skipping 21 matching lines...) Expand all Loading... |
47 uint16_t GetVendorID() const override; | 48 uint16_t GetVendorID() const override; |
48 uint16_t GetProductID() const override; | 49 uint16_t GetProductID() const override; |
49 uint16_t GetDeviceID() const override; | 50 uint16_t GetDeviceID() const override; |
50 uint16_t GetAppearance() const override; | 51 uint16_t GetAppearance() const override; |
51 bool IsPaired() const override; | 52 bool IsPaired() const override; |
52 bool IsConnected() const override; | 53 bool IsConnected() const override; |
53 bool IsGattConnected() const override; | 54 bool IsGattConnected() const override; |
54 bool IsConnectable() const override; | 55 bool IsConnectable() const override; |
55 bool IsConnecting() const override; | 56 bool IsConnecting() const override; |
56 UUIDList GetUUIDs() const override; | 57 UUIDList GetUUIDs() const override; |
57 int16_t GetInquiryRSSI() const override; | 58 base::Optional<int8_t> GetInquiryRSSI() const override; |
58 int16_t GetInquiryTxPower() const override; | 59 base::Optional<int8_t> GetInquiryTxPower() const override; |
59 bool ExpectingPinCode() const override; | 60 bool ExpectingPinCode() const override; |
60 bool ExpectingPasskey() const override; | 61 bool ExpectingPasskey() const override; |
61 bool ExpectingConfirmation() const override; | 62 bool ExpectingConfirmation() const override; |
62 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; | 63 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; |
63 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, | 64 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, |
64 const base::Closure& callback, | 65 const base::Closure& callback, |
65 const ConnectErrorCallback& error_callback) override; | 66 const ConnectErrorCallback& error_callback) override; |
66 void SetPinCode(const std::string& pincode) override; | 67 void SetPinCode(const std::string& pincode) override; |
67 void SetPasskey(uint32_t passkey) override; | 68 void SetPasskey(uint32_t passkey) override; |
68 void ConfirmPairing() override; | 69 void ConfirmPairing() override; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 123 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
123 ~BluetoothDeviceBlueZ() override; | 124 ~BluetoothDeviceBlueZ() override; |
124 | 125 |
125 // bluez::BluetoothGattServiceClient::Observer overrides. | 126 // bluez::BluetoothGattServiceClient::Observer overrides. |
126 void GattServiceAdded(const dbus::ObjectPath& object_path) override; | 127 void GattServiceAdded(const dbus::ObjectPath& object_path) override; |
127 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; | 128 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; |
128 | 129 |
129 // Called by dbus:: on completion of the D-Bus method call to get the | 130 // Called by dbus:: on completion of the D-Bus method call to get the |
130 // connection attributes of the current connection to the device. | 131 // connection attributes of the current connection to the device. |
131 void OnGetConnInfo(const ConnectionInfoCallback& callback, | 132 void OnGetConnInfo(const ConnectionInfoCallback& callback, |
132 int16_t rssi, | 133 const base::Optional<int16_t>& rssi, |
133 int16_t transmit_power, | 134 const base::Optional<int16_t>& transmit_power, |
134 int16_t max_transmit_power); | 135 const base::Optional<int16_t>& max_transmit_power); |
135 void OnGetConnInfoError(const ConnectionInfoCallback& callback, | 136 void OnGetConnInfoError(const ConnectionInfoCallback& callback, |
136 const std::string& error_name, | 137 const std::string& error_name, |
137 const std::string& error_message); | 138 const std::string& error_message); |
138 | 139 |
139 // Internal method to initiate a connection to this device, and methods called | 140 // Internal method to initiate a connection to this device, and methods called |
140 // by dbus:: on completion of the D-Bus method call. | 141 // by dbus:: on completion of the D-Bus method call. |
141 void ConnectInternal(bool after_pairing, | 142 void ConnectInternal(bool after_pairing, |
142 const base::Closure& callback, | 143 const base::Closure& callback, |
143 const ConnectErrorCallback& error_callback); | 144 const ConnectErrorCallback& error_callback); |
144 void OnConnect(bool after_pairing, const base::Closure& callback); | 145 void OnConnect(bool after_pairing, const base::Closure& callback); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Note: This should remain the last member so it'll be destroyed and | 213 // Note: This should remain the last member so it'll be destroyed and |
213 // invalidate its weak pointers before any other members are destroyed. | 214 // invalidate its weak pointers before any other members are destroyed. |
214 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; | 215 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; |
215 | 216 |
216 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); | 217 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); |
217 }; | 218 }; |
218 | 219 |
219 } // namespace bluez | 220 } // namespace bluez |
220 | 221 |
221 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 222 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
OLD | NEW |