| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_DEVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_DEVICE_H_ |
| 6 #define DEVICE_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_DEVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "device/bluetooth/bluetooth_adapter.h" | 14 #include "device/bluetooth/bluetooth_adapter.h" |
| 15 #include "device/bluetooth/bluetooth_device.h" | 15 #include "device/bluetooth/bluetooth_device.h" |
| 16 #include "device/bluetooth/bluetooth_gatt_connection.h" | 16 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 17 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 17 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 18 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 18 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 19 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 19 #include "device/bluetooth/public/interfaces/device.mojom.h" | 20 #include "device/bluetooth/public/interfaces/device.mojom.h" |
| 20 #include "mojo/public/cpp/bindings/strong_binding.h" | 21 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 21 | 22 |
| 22 namespace bluetooth { | 23 namespace bluetooth { |
| 23 | 24 |
| 24 // Implementation of Mojo Device located in | 25 // Implementation of Mojo Device located in |
| 25 // device/bluetooth/public/interfaces/device.mojom. | 26 // device/bluetooth/public/interfaces/device.mojom. |
| 26 // It handles requests to interact with Bluetooth Device. | 27 // It handles requests to interact with Bluetooth Device. |
| 27 // Uses the platform abstraction of device/bluetooth. | 28 // Uses the platform abstraction of device/bluetooth. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 device::BluetoothDevice* device) override; | 47 device::BluetoothDevice* device) override; |
| 47 void GattServicesDiscovered(device::BluetoothAdapter* adapter, | 48 void GattServicesDiscovered(device::BluetoothAdapter* adapter, |
| 48 device::BluetoothDevice* device) override; | 49 device::BluetoothDevice* device) override; |
| 49 | 50 |
| 50 // mojom::Device overrides: | 51 // mojom::Device overrides: |
| 51 void Disconnect() override; | 52 void Disconnect() override; |
| 52 void GetInfo(const GetInfoCallback& callback) override; | 53 void GetInfo(const GetInfoCallback& callback) override; |
| 53 void GetServices(const GetServicesCallback& callback) override; | 54 void GetServices(const GetServicesCallback& callback) override; |
| 54 void GetCharacteristics(const std::string& service_id, | 55 void GetCharacteristics(const std::string& service_id, |
| 55 const GetCharacteristicsCallback& callback) override; | 56 const GetCharacteristicsCallback& callback) override; |
| 57 void GetDescriptors(const std::string& service_id, |
| 58 const std::string& characteristic_id, |
| 59 const GetDescriptorsCallback& callback) override; |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 Device(scoped_refptr<device::BluetoothAdapter> adapter, | 62 Device(scoped_refptr<device::BluetoothAdapter> adapter, |
| 59 std::unique_ptr<device::BluetoothGattConnection> connection); | 63 std::unique_ptr<device::BluetoothGattConnection> connection); |
| 60 | 64 |
| 61 void GetServicesImpl(const GetServicesCallback& callback); | 65 void GetServicesImpl(const GetServicesCallback& callback); |
| 62 | 66 |
| 63 mojom::ServiceInfoPtr ConstructServiceInfoStruct( | 67 mojom::ServiceInfoPtr ConstructServiceInfoStruct( |
| 64 const device::BluetoothRemoteGattService& service); | 68 const device::BluetoothRemoteGattService& service); |
| 65 | 69 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 // The services request queue which holds callbacks that are waiting for | 80 // The services request queue which holds callbacks that are waiting for |
| 77 // services to be discovered for this device. | 81 // services to be discovered for this device. |
| 78 std::vector<base::Closure> pending_services_requests_; | 82 std::vector<base::Closure> pending_services_requests_; |
| 79 | 83 |
| 80 DISALLOW_COPY_AND_ASSIGN(Device); | 84 DISALLOW_COPY_AND_ASSIGN(Device); |
| 81 }; | 85 }; |
| 82 | 86 |
| 83 } // namespace bluetooth | 87 } // namespace bluetooth |
| 84 | 88 |
| 85 #endif // DEVICE_BLUETOOTH_DEVICE_H_ | 89 #endif // DEVICE_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |