| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 | 11 |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 14 #include "content/public/browser/bluetooth_chooser.h" | 16 #include "content/public/browser/bluetooth_chooser.h" |
| 15 #include "content/public/browser/browser_message_filter.h" | 17 #include "content/public/browser/browser_message_filter.h" |
| 16 #include "device/bluetooth/bluetooth_adapter.h" | 18 #include "device/bluetooth/bluetooth_adapter.h" |
| 17 #include "device/bluetooth/bluetooth_gatt_connection.h" | 19 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 18 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 20 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| 19 #include "device/bluetooth/bluetooth_gatt_service.h" | 21 #include "device/bluetooth/bluetooth_gatt_service.h" |
| 20 | 22 |
| 21 namespace device { | 23 namespace device { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 bool powered) override; | 80 bool powered) override; |
| 79 void DeviceAdded(device::BluetoothAdapter* adapter, | 81 void DeviceAdded(device::BluetoothAdapter* adapter, |
| 80 device::BluetoothDevice* device) override; | 82 device::BluetoothDevice* device) override; |
| 81 void DeviceRemoved(device::BluetoothAdapter* adapter, | 83 void DeviceRemoved(device::BluetoothAdapter* adapter, |
| 82 device::BluetoothDevice* device) override; | 84 device::BluetoothDevice* device) override; |
| 83 void GattServicesDiscovered(device::BluetoothAdapter* adapter, | 85 void GattServicesDiscovered(device::BluetoothAdapter* adapter, |
| 84 device::BluetoothDevice* device) override; | 86 device::BluetoothDevice* device) override; |
| 85 void GattCharacteristicValueChanged( | 87 void GattCharacteristicValueChanged( |
| 86 device::BluetoothAdapter* adapter, | 88 device::BluetoothAdapter* adapter, |
| 87 device::BluetoothGattCharacteristic* characteristic, | 89 device::BluetoothGattCharacteristic* characteristic, |
| 88 const std::vector<uint8>& value) override; | 90 const std::vector<uint8_t>& value) override; |
| 89 | 91 |
| 90 // Sends an IPC to the thread informing that a the characteristic's | 92 // Sends an IPC to the thread informing that a the characteristic's |
| 91 // value changed. | 93 // value changed. |
| 92 void NotifyActiveCharacteristic(int thread_id, | 94 void NotifyActiveCharacteristic(int thread_id, |
| 93 const std::string& characteristic_instance_id, | 95 const std::string& characteristic_instance_id, |
| 94 const std::vector<uint8>& value); | 96 const std::vector<uint8_t>& value); |
| 95 | 97 |
| 96 // IPC Handlers, see definitions in bluetooth_messages.h. | 98 // IPC Handlers, see definitions in bluetooth_messages.h. |
| 97 void OnRequestDevice( | 99 void OnRequestDevice( |
| 98 int thread_id, | 100 int thread_id, |
| 99 int request_id, | 101 int request_id, |
| 100 int frame_routing_id, | 102 int frame_routing_id, |
| 101 const std::vector<content::BluetoothScanFilter>& filters, | 103 const std::vector<content::BluetoothScanFilter>& filters, |
| 102 const std::vector<device::BluetoothUUID>& optional_services); | 104 const std::vector<device::BluetoothUUID>& optional_services); |
| 103 void OnConnectGATT(int thread_id, | 105 void OnConnectGATT(int thread_id, |
| 104 int request_id, | 106 int request_id, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Adds the service to the map of services' instance ids to devices' instance | 168 // Adds the service to the map of services' instance ids to devices' instance |
| 167 // ids and sends the service to the renderer. | 169 // ids and sends the service to the renderer. |
| 168 void AddToServicesMapAndSendGetPrimaryServiceSuccess( | 170 void AddToServicesMapAndSendGetPrimaryServiceSuccess( |
| 169 const device::BluetoothGattService& service, | 171 const device::BluetoothGattService& service, |
| 170 int thread_id, | 172 int thread_id, |
| 171 int request_id); | 173 int request_id); |
| 172 | 174 |
| 173 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic. | 175 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic. |
| 174 void OnCharacteristicValueRead(int thread_id, | 176 void OnCharacteristicValueRead(int thread_id, |
| 175 int request_id, | 177 int request_id, |
| 176 const std::vector<uint8>& value); | 178 const std::vector<uint8_t>& value); |
| 177 void OnCharacteristicReadValueError( | 179 void OnCharacteristicReadValueError( |
| 178 int thread_id, | 180 int thread_id, |
| 179 int request_id, | 181 int request_id, |
| 180 device::BluetoothGattService::GattErrorCode); | 182 device::BluetoothGattService::GattErrorCode); |
| 181 | 183 |
| 182 // Callbacks for BluetoothGattCharacteristic::WriteRemoteCharacteristic. | 184 // Callbacks for BluetoothGattCharacteristic::WriteRemoteCharacteristic. |
| 183 void OnWriteValueSuccess(int thread_id, int request_id); | 185 void OnWriteValueSuccess(int thread_id, int request_id); |
| 184 void OnWriteValueFailed(int thread_id, | 186 void OnWriteValueFailed(int thread_id, |
| 185 int request_id, | 187 int request_id, |
| 186 device::BluetoothGattService::GattErrorCode); | 188 device::BluetoothGattService::GattErrorCode); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // copies verify they are also used on the UI thread. | 295 // copies verify they are also used on the UI thread. |
| 294 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; | 296 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; |
| 295 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 297 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
| 296 | 298 |
| 297 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 299 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
| 298 }; | 300 }; |
| 299 | 301 |
| 300 } // namespace content | 302 } // namespace content |
| 301 | 303 |
| 302 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 304 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| OLD | NEW |