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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 int request_id, | 70 int request_id, |
71 const std::string& device_instance_id, | 71 const std::string& device_instance_id, |
72 const std::string& service_uuid); | 72 const std::string& service_uuid); |
73 void OnGetCharacteristic(int thread_id, | 73 void OnGetCharacteristic(int thread_id, |
74 int request_id, | 74 int request_id, |
75 const std::string& service_instance_id, | 75 const std::string& service_instance_id, |
76 const std::string& characteristic_uuid); | 76 const std::string& characteristic_uuid); |
77 void OnReadValue(int thread_id, | 77 void OnReadValue(int thread_id, |
78 int request_id, | 78 int request_id, |
79 const std::string& characteristic_instance_id); | 79 const std::string& characteristic_instance_id); |
| 80 void OnWriteValue(int thread_id, |
| 81 int request_id, |
| 82 const std::string& characteristic_instance_id, |
| 83 const std::vector<uint8_t>& value); |
80 | 84 |
81 // Callbacks for BluetoothAdapter::StartDiscoverySession. | 85 // Callbacks for BluetoothAdapter::StartDiscoverySession. |
82 void OnDiscoverySessionStarted( | 86 void OnDiscoverySessionStarted( |
83 int thread_id, | 87 int thread_id, |
84 int request_id, | 88 int request_id, |
85 scoped_ptr<DiscoverySessionOptions> options, | 89 scoped_ptr<DiscoverySessionOptions> options, |
86 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); | 90 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); |
87 void OnDiscoverySessionStartedError(int thread_id, int request_id); | 91 void OnDiscoverySessionStartedError(int thread_id, int request_id); |
88 | 92 |
89 // Stop in progress discovery session. | 93 // Stop in progress discovery session. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 125 |
122 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic. | 126 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic. |
123 void OnCharacteristicValueRead(int thread_id, | 127 void OnCharacteristicValueRead(int thread_id, |
124 int request_id, | 128 int request_id, |
125 const std::vector<uint8>& value); | 129 const std::vector<uint8>& value); |
126 void OnCharacteristicReadValueError( | 130 void OnCharacteristicReadValueError( |
127 int thread_id, | 131 int thread_id, |
128 int request_id, | 132 int request_id, |
129 device::BluetoothGattService::GattErrorCode); | 133 device::BluetoothGattService::GattErrorCode); |
130 | 134 |
| 135 // Callbacks for BluetoothGattCharacteristic::WriteRemoteCharacteristic. |
| 136 void OnWriteValueSuccess(int thread_id, int request_id); |
| 137 void OnWriteValueFailed(int thread_id, |
| 138 int request_id, |
| 139 device::BluetoothGattService::GattErrorCode); |
| 140 |
131 // Maps to get the object's parent based on it's instanceID | 141 // Maps to get the object's parent based on it's instanceID |
132 // Map of service_instance_id to device_instance_id. | 142 // Map of service_instance_id to device_instance_id. |
133 std::map<std::string, std::string> service_to_device_; | 143 std::map<std::string, std::string> service_to_device_; |
134 // Map of characteristic_instance_id to service_instance_id. | 144 // Map of characteristic_instance_id to service_instance_id. |
135 std::map<std::string, std::string> characteristic_to_service_; | 145 std::map<std::string, std::string> characteristic_to_service_; |
136 | 146 |
137 // Defines how long to scan for and how long to discover services for. | 147 // Defines how long to scan for and how long to discover services for. |
138 int current_delay_time_; | 148 int current_delay_time_; |
139 | 149 |
140 // A BluetoothAdapter instance representing an adapter of the system. | 150 // A BluetoothAdapter instance representing an adapter of the system. |
141 scoped_refptr<device::BluetoothAdapter> adapter_; | 151 scoped_refptr<device::BluetoothAdapter> adapter_; |
142 | 152 |
143 // Must be last member, see base/memory/weak_ptr.h documentation | 153 // Must be last member, see base/memory/weak_ptr.h documentation |
144 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 154 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
145 | 155 |
146 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 156 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
147 }; | 157 }; |
148 | 158 |
149 } // namespace content | 159 } // namespace content |
150 | 160 |
151 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 161 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
OLD | NEW |