| 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_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const blink::WebString& characteristic_uuid, | 81 const blink::WebString& characteristic_uuid, |
| 82 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); | 82 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); |
| 83 void getCharacteristics( | 83 void getCharacteristics( |
| 84 int frame_routing_id, | 84 int frame_routing_id, |
| 85 const blink::WebString& service_instance_id, | 85 const blink::WebString& service_instance_id, |
| 86 const blink::WebString& characteristics_uuid, | 86 const blink::WebString& characteristics_uuid, |
| 87 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks); | 87 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks); |
| 88 void readValue(int frame_routing_id, | 88 void readValue(int frame_routing_id, |
| 89 const blink::WebString& characteristic_instance_id, | 89 const blink::WebString& characteristic_instance_id, |
| 90 blink::WebBluetoothReadValueCallbacks* callbacks); | 90 blink::WebBluetoothReadValueCallbacks* callbacks); |
| 91 void writeValue(int frame_routing_id, | |
| 92 const blink::WebString& characteristic_instance_id, | |
| 93 const blink::WebVector<uint8_t>& value, | |
| 94 blink::WebBluetoothWriteValueCallbacks*); | |
| 95 void startNotifications(int frame_routing_id, | 91 void startNotifications(int frame_routing_id, |
| 96 const blink::WebString& characteristic_instance_id, | 92 const blink::WebString& characteristic_instance_id, |
| 97 blink::WebBluetoothRemoteGATTCharacteristic* delegate, | 93 blink::WebBluetoothRemoteGATTCharacteristic* delegate, |
| 98 blink::WebBluetoothNotificationsCallbacks*); | 94 blink::WebBluetoothNotificationsCallbacks*); |
| 99 void stopNotifications(int frame_routing_id, | 95 void stopNotifications(int frame_routing_id, |
| 100 const blink::WebString& characteristic_instance_id, | 96 const blink::WebString& characteristic_instance_id, |
| 101 blink::WebBluetoothRemoteGATTCharacteristic* delegate, | 97 blink::WebBluetoothRemoteGATTCharacteristic* delegate, |
| 102 blink::WebBluetoothNotificationsCallbacks*); | 98 blink::WebBluetoothNotificationsCallbacks*); |
| 103 void characteristicObjectRemoved( | 99 void characteristicObjectRemoved( |
| 104 int frame_routing_id, | 100 int frame_routing_id, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 const std::vector<uint32_t>& characteristic_properties); | 205 const std::vector<uint32_t>& characteristic_properties); |
| 210 void OnGetCharacteristicsError(int thread_id, | 206 void OnGetCharacteristicsError(int thread_id, |
| 211 int request_id, | 207 int request_id, |
| 212 blink::WebBluetoothError error); | 208 blink::WebBluetoothError error); |
| 213 void OnReadValueSuccess(int thread_id, | 209 void OnReadValueSuccess(int thread_id, |
| 214 int request_id, | 210 int request_id, |
| 215 const std::vector<uint8_t>& value); | 211 const std::vector<uint8_t>& value); |
| 216 void OnReadValueError(int thread_id, | 212 void OnReadValueError(int thread_id, |
| 217 int request_id, | 213 int request_id, |
| 218 blink::WebBluetoothError error); | 214 blink::WebBluetoothError error); |
| 219 void OnWriteValueSuccess(int thread_id, int request_id); | |
| 220 void OnWriteValueError(int thread_id, | |
| 221 int request_id, | |
| 222 blink::WebBluetoothError error); | |
| 223 void OnStartNotificationsSuccess(int thread_id, int request_id); | 215 void OnStartNotificationsSuccess(int thread_id, int request_id); |
| 224 void OnStartNotificationsError(int thread_id, | 216 void OnStartNotificationsError(int thread_id, |
| 225 int request_id, | 217 int request_id, |
| 226 blink::WebBluetoothError error); | 218 blink::WebBluetoothError error); |
| 227 void OnStopNotificationsSuccess(int thread_id, int request_id); | 219 void OnStopNotificationsSuccess(int thread_id, int request_id); |
| 228 void OnCharacteristicValueChanged( | 220 void OnCharacteristicValueChanged( |
| 229 int thread_id, | 221 int thread_id, |
| 230 const std::string& characteristic_instance_id, | 222 const std::string& characteristic_instance_id, |
| 231 const std::vector<uint8_t> value); | 223 const std::vector<uint8_t> value); |
| 232 | 224 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 250 pending_primary_service_requests_; | 242 pending_primary_service_requests_; |
| 251 // Tracks requests to get a characteristic from a service. | 243 // Tracks requests to get a characteristic from a service. |
| 252 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> | 244 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> |
| 253 pending_characteristic_requests_; | 245 pending_characteristic_requests_; |
| 254 // Tracks requests to get characteristics from a service. | 246 // Tracks requests to get characteristics from a service. |
| 255 IDMap<BluetoothCharacteristicsRequest, IDMapOwnPointer> | 247 IDMap<BluetoothCharacteristicsRequest, IDMapOwnPointer> |
| 256 pending_characteristics_requests_; | 248 pending_characteristics_requests_; |
| 257 // Tracks requests to read from a characteristics. | 249 // Tracks requests to read from a characteristics. |
| 258 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> | 250 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> |
| 259 pending_read_value_requests_; | 251 pending_read_value_requests_; |
| 260 IDMap<BluetoothWriteValueRequest, IDMapOwnPointer> | |
| 261 pending_write_value_requests_; | |
| 262 IDMap<BluetoothNotificationsRequest, IDMapOwnPointer> | 252 IDMap<BluetoothNotificationsRequest, IDMapOwnPointer> |
| 263 pending_notifications_requests_; | 253 pending_notifications_requests_; |
| 264 | 254 |
| 265 // Map of characteristic_instance_id to a set of | 255 // Map of characteristic_instance_id to a set of |
| 266 // WebBluetoothRemoteGATTCharacteristic pointers. Keeps track of which | 256 // WebBluetoothRemoteGATTCharacteristic pointers. Keeps track of which |
| 267 // objects are subscribed to notifications. | 257 // objects are subscribed to notifications. |
| 268 std::map<std::string, std::set<blink::WebBluetoothRemoteGATTCharacteristic*>> | 258 std::map<std::string, std::set<blink::WebBluetoothRemoteGATTCharacteristic*>> |
| 269 active_notification_subscriptions_; | 259 active_notification_subscriptions_; |
| 270 | 260 |
| 271 // Map of characteristic_instance_ids to | 261 // Map of characteristic_instance_ids to |
| 272 // WebBluetoothRemoteGATTCharacteristics. | 262 // WebBluetoothRemoteGATTCharacteristics. |
| 273 // Keeps track of what characteristics have listeners. | 263 // Keeps track of what characteristics have listeners. |
| 274 // TODO(ortuno): We are assuming that there exists a single frame per | 264 // TODO(ortuno): We are assuming that there exists a single frame per |
| 275 // dispatcher, so there could be at most one characteristic object per | 265 // dispatcher, so there could be at most one characteristic object per |
| 276 // characteristic_instance_id. Change to a set when we support multiple | 266 // characteristic_instance_id. Change to a set when we support multiple |
| 277 // frames. | 267 // frames. |
| 278 // http://crbug.com/541388 | 268 // http://crbug.com/541388 |
| 279 std::map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> | 269 std::map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> |
| 280 active_characteristics_; | 270 active_characteristics_; |
| 281 | 271 |
| 282 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); | 272 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); |
| 283 }; | 273 }; |
| 284 | 274 |
| 285 } // namespace content | 275 } // namespace content |
| 286 | 276 |
| 287 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 277 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| OLD | NEW |