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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter); | 50 void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter); |
| 51 | 51 |
| 52 // IPC Handlers, see definitions in bluetooth_messages.h. | 52 // IPC Handlers, see definitions in bluetooth_messages.h. |
| 53 void OnRequestDevice(int thread_id, int request_id); | 53 void OnRequestDevice(int thread_id, int request_id); |
| 54 void OnConnectGATT(int thread_id, int request_id, | 54 void OnConnectGATT(int thread_id, int request_id, |
| 55 const std::string& device_instance_id); | 55 const std::string& device_instance_id); |
| 56 void OnGetPrimaryService(int thread_id, | 56 void OnGetPrimaryService(int thread_id, |
| 57 int request_id, | 57 int request_id, |
| 58 const std::string& device_instance_id, | 58 const std::string& device_instance_id, |
| 59 const std::string& service_uuid); | 59 const std::string& service_uuid); |
| 60 void OnGetCharacteristic(int thread_id, | |
| 61 int request_id, | |
| 62 const std::string& service_instance_id, | |
| 63 const std::string& characteristic_uuid); | |
| 60 | 64 |
| 61 // Callbacks for BluetoothAdapter::StartDiscoverySession. | 65 // Callbacks for BluetoothAdapter::StartDiscoverySession. |
| 62 void OnDiscoverySessionStarted( | 66 void OnDiscoverySessionStarted( |
| 63 int thread_id, | 67 int thread_id, |
| 64 int request_id, | 68 int request_id, |
| 65 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); | 69 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); |
| 66 void OnDiscoverySessionStartedError(int thread_id, int request_id); | 70 void OnDiscoverySessionStartedError(int thread_id, int request_id); |
| 67 | 71 |
| 68 // Stop in progress discovery session. | 72 // Stop in progress discovery session. |
| 69 void StopDiscoverySession( | 73 void StopDiscoverySession( |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 88 device::BluetoothDevice::ConnectErrorCode error_code); | 92 device::BluetoothDevice::ConnectErrorCode error_code); |
| 89 | 93 |
| 90 // Callback for future BluetoothAdapter::ServicesDiscovered callback: | 94 // Callback for future BluetoothAdapter::ServicesDiscovered callback: |
| 91 // For now we just post a delayed task. | 95 // For now we just post a delayed task. |
| 92 // See: https://crbug.com/484504 | 96 // See: https://crbug.com/484504 |
| 93 void OnServicesDiscovered(int thread_id, | 97 void OnServicesDiscovered(int thread_id, |
| 94 int request_id, | 98 int request_id, |
| 95 const std::string& device_instance_id, | 99 const std::string& device_instance_id, |
| 96 const std::string& service_uuid); | 100 const std::string& service_uuid); |
| 97 | 101 |
| 102 // Maps to get the object's parent based on it's instanceID | |
|
Jeffrey Yasskin
2015/06/02 22:12:29
We could also make the renderer pass both a servic
ortuno
2015/06/03 20:27:22
Hmm not sure how passing both a service_id and a d
| |
| 103 // Map of service_instance_id to device_instance_id. | |
| 104 std::map<std::string, std::string> service_to_device_; | |
| 105 | |
| 98 // Defines how long to scan for and how long to discover services for. | 106 // Defines how long to scan for and how long to discover services for. |
| 99 int current_delay_time_; | 107 int current_delay_time_; |
| 100 | 108 |
| 101 // A BluetoothAdapter instance representing an adapter of the system. | 109 // A BluetoothAdapter instance representing an adapter of the system. |
| 102 scoped_refptr<device::BluetoothAdapter> adapter_; | 110 scoped_refptr<device::BluetoothAdapter> adapter_; |
| 103 | 111 |
| 104 // Must be last member, see base/memory/weak_ptr.h documentation | 112 // Must be last member, see base/memory/weak_ptr.h documentation |
| 105 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 113 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
| 106 | 114 |
| 107 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 115 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
| 108 }; | 116 }; |
| 109 | 117 |
| 110 } // namespace content | 118 } // namespace content |
| 111 | 119 |
| 112 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 120 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| OLD | NEW |