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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void getCharacteristic( | 76 void getCharacteristic( |
77 int frame_routing_id, | 77 int frame_routing_id, |
78 const blink::WebString& service_instance_id, | 78 const blink::WebString& service_instance_id, |
79 const blink::WebString& characteristic_uuid, | 79 const blink::WebString& characteristic_uuid, |
80 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); | 80 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); |
81 void getCharacteristics( | 81 void getCharacteristics( |
82 int frame_routing_id, | 82 int frame_routing_id, |
83 const blink::WebString& service_instance_id, | 83 const blink::WebString& service_instance_id, |
84 const blink::WebString& characteristics_uuid, | 84 const blink::WebString& characteristics_uuid, |
85 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks); | 85 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks); |
86 void readValue(int frame_routing_id, | |
87 const blink::WebString& characteristic_instance_id, | |
88 blink::WebBluetoothReadValueCallbacks* callbacks); | |
89 | 86 |
90 // WorkerThread::Observer implementation. | 87 // WorkerThread::Observer implementation. |
91 void WillStopCurrentWorkerThread() override; | 88 void WillStopCurrentWorkerThread() override; |
92 | 89 |
93 private: | 90 private: |
94 // IPC Handlers, see definitions in bluetooth_messages.h. | 91 // IPC Handlers, see definitions in bluetooth_messages.h. |
95 void OnRequestDeviceSuccess(int thread_id, | 92 void OnRequestDeviceSuccess(int thread_id, |
96 int request_id, | 93 int request_id, |
97 const BluetoothDevice& device); | 94 const BluetoothDevice& device); |
98 void OnRequestDeviceError(int thread_id, | 95 void OnRequestDeviceError(int thread_id, |
(...skipping 18 matching lines...) Expand all Loading... |
117 blink::WebBluetoothError error); | 114 blink::WebBluetoothError error); |
118 void OnGetCharacteristicsSuccess( | 115 void OnGetCharacteristicsSuccess( |
119 int thread_id, | 116 int thread_id, |
120 int request_id, | 117 int request_id, |
121 const std::vector<std::string>& characteristics_instance_ids, | 118 const std::vector<std::string>& characteristics_instance_ids, |
122 const std::vector<std::string>& characteristics_uuids, | 119 const std::vector<std::string>& characteristics_uuids, |
123 const std::vector<uint32_t>& characteristic_properties); | 120 const std::vector<uint32_t>& characteristic_properties); |
124 void OnGetCharacteristicsError(int thread_id, | 121 void OnGetCharacteristicsError(int thread_id, |
125 int request_id, | 122 int request_id, |
126 blink::WebBluetoothError error); | 123 blink::WebBluetoothError error); |
127 void OnReadValueSuccess(int thread_id, | |
128 int request_id, | |
129 const std::vector<uint8_t>& value); | |
130 void OnReadValueError(int thread_id, | |
131 int request_id, | |
132 blink::WebBluetoothError error); | |
133 | 124 |
134 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 125 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
135 | 126 |
136 // Tracks device requests sent to browser to match replies with callbacks. | 127 // Tracks device requests sent to browser to match replies with callbacks. |
137 // Owns callback objects. | 128 // Owns callback objects. |
138 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> | 129 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> |
139 pending_requests_; | 130 pending_requests_; |
140 // Tracks requests to connect to a device. | 131 // Tracks requests to connect to a device. |
141 // Owns callback objects. | 132 // Owns callback objects. |
142 IDMap<blink::WebBluetoothRemoteGATTServerConnectCallbacks, IDMapOwnPointer> | 133 IDMap<blink::WebBluetoothRemoteGATTServerConnectCallbacks, IDMapOwnPointer> |
143 pending_connect_requests_; | 134 pending_connect_requests_; |
144 // Tracks requests to get a primary service from a device. | 135 // Tracks requests to get a primary service from a device. |
145 // Owns request objects. | 136 // Owns request objects. |
146 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> | 137 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> |
147 pending_primary_service_requests_; | 138 pending_primary_service_requests_; |
148 // Tracks requests to get a characteristic from a service. | 139 // Tracks requests to get a characteristic from a service. |
149 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> | 140 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> |
150 pending_characteristic_requests_; | 141 pending_characteristic_requests_; |
151 // Tracks requests to get characteristics from a service. | 142 // Tracks requests to get characteristics from a service. |
152 IDMap<BluetoothCharacteristicsRequest, IDMapOwnPointer> | 143 IDMap<BluetoothCharacteristicsRequest, IDMapOwnPointer> |
153 pending_characteristics_requests_; | 144 pending_characteristics_requests_; |
154 // Tracks requests to read from a characteristics. | |
155 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> | |
156 pending_read_value_requests_; | |
157 | 145 |
158 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); | 146 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); |
159 }; | 147 }; |
160 | 148 |
161 } // namespace content | 149 } // namespace content |
162 | 150 |
163 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 151 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
OLD | NEW |