Chromium Code Reviews| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/common/bluetooth/bluetooth_error.h" | 10 #include "content/common/bluetooth/bluetooth_error.h" |
| 11 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
| 12 #include "device/bluetooth/bluetooth_adapter.h" | 12 #include "device/bluetooth/bluetooth_adapter.h" |
| 13 #include "device/bluetooth/bluetooth_gatt_connection.h" | 13 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 14 #include "device/bluetooth/bluetooth_gatt_service.h" | |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 // Dispatches and sends bluetooth related messages sent to/from a child | 18 // Dispatches and sends bluetooth related messages sent to/from a child |
| 18 // process BluetoothDispatcher from/to the main browser process. | 19 // process BluetoothDispatcher from/to the main browser process. |
| 19 // | 20 // |
| 20 // Intended to be instantiated by the RenderProcessHost and installed as | 21 // Intended to be instantiated by the RenderProcessHost and installed as |
| 21 // a filter on the channel. BrowserMessageFilter is refcounted and typically | 22 // a filter on the channel. BrowserMessageFilter is refcounted and typically |
| 22 // lives as long as it is installed on a channel. | 23 // lives as long as it is installed on a channel. |
| 23 // | 24 // |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 54 void OnConnectGATT(int thread_id, int request_id, | 55 void OnConnectGATT(int thread_id, int request_id, |
| 55 const std::string& device_instance_id); | 56 const std::string& device_instance_id); |
| 56 void OnGetPrimaryService(int thread_id, | 57 void OnGetPrimaryService(int thread_id, |
| 57 int request_id, | 58 int request_id, |
| 58 const std::string& device_instance_id, | 59 const std::string& device_instance_id, |
| 59 const std::string& service_uuid); | 60 const std::string& service_uuid); |
| 60 void OnGetCharacteristic(int thread_id, | 61 void OnGetCharacteristic(int thread_id, |
| 61 int request_id, | 62 int request_id, |
| 62 const std::string& service_instance_id, | 63 const std::string& service_instance_id, |
| 63 const std::string& characteristic_uuid); | 64 const std::string& characteristic_uuid); |
| 65 void OnReadValue(int thread_id, | |
| 66 int request_id, | |
| 67 const std::string& characteristic_instance_id); | |
| 64 | 68 |
| 65 // Callbacks for BluetoothAdapter::StartDiscoverySession. | 69 // Callbacks for BluetoothAdapter::StartDiscoverySession. |
| 66 void OnDiscoverySessionStarted( | 70 void OnDiscoverySessionStarted( |
| 67 int thread_id, | 71 int thread_id, |
| 68 int request_id, | 72 int request_id, |
| 69 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); | 73 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); |
| 70 void OnDiscoverySessionStartedError(int thread_id, int request_id); | 74 void OnDiscoverySessionStartedError(int thread_id, int request_id); |
| 71 | 75 |
| 72 // Stop in progress discovery session. | 76 // Stop in progress discovery session. |
| 73 void StopDiscoverySession( | 77 void StopDiscoverySession( |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 92 device::BluetoothDevice::ConnectErrorCode error_code); | 96 device::BluetoothDevice::ConnectErrorCode error_code); |
| 93 | 97 |
| 94 // Callback for future BluetoothAdapter::ServicesDiscovered callback: | 98 // Callback for future BluetoothAdapter::ServicesDiscovered callback: |
| 95 // For now we just post a delayed task. | 99 // For now we just post a delayed task. |
| 96 // See: https://crbug.com/484504 | 100 // See: https://crbug.com/484504 |
| 97 void OnServicesDiscovered(int thread_id, | 101 void OnServicesDiscovered(int thread_id, |
| 98 int request_id, | 102 int request_id, |
| 99 const std::string& device_instance_id, | 103 const std::string& device_instance_id, |
| 100 const std::string& service_uuid); | 104 const std::string& service_uuid); |
| 101 | 105 |
| 106 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic | |
|
Jeffrey Yasskin
2015/06/10 21:03:45
Please end comments with punctuation.
ortuno
2015/06/10 22:03:01
Done.
| |
| 107 void OnCharacteristicValueRead(int thread_id, | |
| 108 int request_id, | |
| 109 const std::vector<uint8>& value); | |
| 110 void OnCharacteristicReadValueError( | |
| 111 int thread_id, | |
| 112 int request_id, | |
| 113 device::BluetoothGattService::GattErrorCode); | |
| 114 | |
| 102 // Maps to get the object's parent based on it's instanceID | 115 // Maps to get the object's parent based on it's instanceID |
| 103 // Map of service_instance_id to device_instance_id. | 116 // Map of service_instance_id to device_instance_id. |
| 104 std::map<std::string, std::string> service_to_device_; | 117 std::map<std::string, std::string> service_to_device_; |
| 118 // Map of characteristic_instance_id to service_instance_id. | |
| 119 std::map<std::string, std::string> characteristic_to_service_; | |
| 105 | 120 |
| 106 // Defines how long to scan for and how long to discover services for. | 121 // Defines how long to scan for and how long to discover services for. |
| 107 int current_delay_time_; | 122 int current_delay_time_; |
| 108 | 123 |
| 109 // A BluetoothAdapter instance representing an adapter of the system. | 124 // A BluetoothAdapter instance representing an adapter of the system. |
| 110 scoped_refptr<device::BluetoothAdapter> adapter_; | 125 scoped_refptr<device::BluetoothAdapter> adapter_; |
| 111 | 126 |
| 112 // Must be last member, see base/memory/weak_ptr.h documentation | 127 // Must be last member, see base/memory/weak_ptr.h documentation |
| 113 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 128 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
| 114 | 129 |
| 115 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 130 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
| 116 }; | 131 }; |
| 117 | 132 |
| 118 } // namespace content | 133 } // namespace content |
| 119 | 134 |
| 120 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 135 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| OLD | NEW |