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_BLUETOOTH_DEVICE_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
14 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
15 #include "dbus/object_path.h" | 17 #include "dbus/object_path.h" |
16 #include "device/bluetooth/bluetooth_device.h" | 18 #include "device/bluetooth/bluetooth_device.h" |
17 #include "device/bluetooth/bluetooth_export.h" | 19 #include "device/bluetooth/bluetooth_export.h" |
(...skipping 14 matching lines...) Expand all Loading... |
32 // | 34 // |
33 // This class is not thread-safe, but is only called from the UI thread. | 35 // This class is not thread-safe, but is only called from the UI thread. |
34 // | 36 // |
35 // A socket thread is used to create sockets but posts all callbacks on the UI | 37 // A socket thread is used to create sockets but posts all callbacks on the UI |
36 // thread. | 38 // thread. |
37 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ | 39 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ |
38 : public device::BluetoothDevice, | 40 : public device::BluetoothDevice, |
39 public bluez::BluetoothGattServiceClient::Observer { | 41 public bluez::BluetoothGattServiceClient::Observer { |
40 public: | 42 public: |
41 // BluetoothDevice override | 43 // BluetoothDevice override |
42 uint32 GetBluetoothClass() const override; | 44 uint32_t GetBluetoothClass() const override; |
43 std::string GetAddress() const override; | 45 std::string GetAddress() const override; |
44 VendorIDSource GetVendorIDSource() const override; | 46 VendorIDSource GetVendorIDSource() const override; |
45 uint16 GetVendorID() const override; | 47 uint16_t GetVendorID() const override; |
46 uint16 GetProductID() const override; | 48 uint16_t GetProductID() const override; |
47 uint16 GetDeviceID() const override; | 49 uint16_t GetDeviceID() const override; |
48 bool IsPaired() const override; | 50 bool IsPaired() const override; |
49 bool IsConnected() const override; | 51 bool IsConnected() const override; |
50 bool IsGattConnected() const override; | 52 bool IsGattConnected() const override; |
51 bool IsConnectable() const override; | 53 bool IsConnectable() const override; |
52 bool IsConnecting() const override; | 54 bool IsConnecting() const override; |
53 UUIDList GetUUIDs() const override; | 55 UUIDList GetUUIDs() const override; |
54 int16 GetInquiryRSSI() const override; | 56 int16_t GetInquiryRSSI() const override; |
55 int16 GetInquiryTxPower() const override; | 57 int16_t GetInquiryTxPower() const override; |
56 bool ExpectingPinCode() const override; | 58 bool ExpectingPinCode() const override; |
57 bool ExpectingPasskey() const override; | 59 bool ExpectingPasskey() const override; |
58 bool ExpectingConfirmation() const override; | 60 bool ExpectingConfirmation() const override; |
59 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; | 61 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; |
60 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, | 62 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, |
61 const base::Closure& callback, | 63 const base::Closure& callback, |
62 const ConnectErrorCallback& error_callback) override; | 64 const ConnectErrorCallback& error_callback) override; |
63 void SetPinCode(const std::string& pincode) override; | 65 void SetPinCode(const std::string& pincode) override; |
64 void SetPasskey(uint32 passkey) override; | 66 void SetPasskey(uint32_t passkey) override; |
65 void ConfirmPairing() override; | 67 void ConfirmPairing() override; |
66 void RejectPairing() override; | 68 void RejectPairing() override; |
67 void CancelPairing() override; | 69 void CancelPairing() override; |
68 void Disconnect(const base::Closure& callback, | 70 void Disconnect(const base::Closure& callback, |
69 const ErrorCallback& error_callback) override; | 71 const ErrorCallback& error_callback) override; |
70 void Forget(const base::Closure& callback, | 72 void Forget(const base::Closure& callback, |
71 const ErrorCallback& error_callback) override; | 73 const ErrorCallback& error_callback) override; |
72 void ConnectToService( | 74 void ConnectToService( |
73 const device::BluetoothUUID& uuid, | 75 const device::BluetoothUUID& uuid, |
74 const ConnectToServiceCallback& callback, | 76 const ConnectToServiceCallback& callback, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 121 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
120 ~BluetoothDeviceBlueZ() override; | 122 ~BluetoothDeviceBlueZ() override; |
121 | 123 |
122 // bluez::BluetoothGattServiceClient::Observer overrides. | 124 // bluez::BluetoothGattServiceClient::Observer overrides. |
123 void GattServiceAdded(const dbus::ObjectPath& object_path) override; | 125 void GattServiceAdded(const dbus::ObjectPath& object_path) override; |
124 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; | 126 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; |
125 | 127 |
126 // Called by dbus:: on completion of the D-Bus method call to get the | 128 // Called by dbus:: on completion of the D-Bus method call to get the |
127 // connection attributes of the current connection to the device. | 129 // connection attributes of the current connection to the device. |
128 void OnGetConnInfo(const ConnectionInfoCallback& callback, | 130 void OnGetConnInfo(const ConnectionInfoCallback& callback, |
129 int16 rssi, | 131 int16_t rssi, |
130 int16 transmit_power, | 132 int16_t transmit_power, |
131 int16 max_transmit_power); | 133 int16_t max_transmit_power); |
132 void OnGetConnInfoError(const ConnectionInfoCallback& callback, | 134 void OnGetConnInfoError(const ConnectionInfoCallback& callback, |
133 const std::string& error_name, | 135 const std::string& error_name, |
134 const std::string& error_message); | 136 const std::string& error_message); |
135 | 137 |
136 // Internal method to initiate a connection to this device, and methods called | 138 // Internal method to initiate a connection to this device, and methods called |
137 // by dbus:: on completion of the D-Bus method call. | 139 // by dbus:: on completion of the D-Bus method call. |
138 void ConnectInternal(bool after_pairing, | 140 void ConnectInternal(bool after_pairing, |
139 const base::Closure& callback, | 141 const base::Closure& callback, |
140 const ConnectErrorCallback& error_callback); | 142 const ConnectErrorCallback& error_callback); |
141 void OnConnect(bool after_pairing, const base::Closure& callback); | 143 void OnConnect(bool after_pairing, const base::Closure& callback); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // Note: This should remain the last member so it'll be destroyed and | 211 // Note: This should remain the last member so it'll be destroyed and |
210 // invalidate its weak pointers before any other members are destroyed. | 212 // invalidate its weak pointers before any other members are destroyed. |
211 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; | 213 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; |
212 | 214 |
213 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); | 215 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); |
214 }; | 216 }; |
215 | 217 |
216 } // namespace bluez | 218 } // namespace bluez |
217 | 219 |
218 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_ | 220 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_ |
OLD | NEW |