Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: content/child/bluetooth/bluetooth_dispatcher.h

Issue 1217983004: bluetooth: browser-side implementation of writeValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-origin
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/id_map.h" 8 #include "base/id_map.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/child/worker_task_runner.h" 10 #include "content/child/worker_task_runner.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const blink::WebString& device_instance_id, 58 const blink::WebString& device_instance_id,
59 const blink::WebString& service_uuid, 59 const blink::WebString& service_uuid,
60 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks); 60 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks);
61 61
62 void getCharacteristic( 62 void getCharacteristic(
63 const blink::WebString& service_instance_id, 63 const blink::WebString& service_instance_id,
64 const blink::WebString& characteristic_uuid, 64 const blink::WebString& characteristic_uuid,
65 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); 65 blink::WebBluetoothGetCharacteristicCallbacks* callbacks);
66 void readValue(const blink::WebString& characteristic_instance_id, 66 void readValue(const blink::WebString& characteristic_instance_id,
67 blink::WebBluetoothReadValueCallbacks* callbacks); 67 blink::WebBluetoothReadValueCallbacks* callbacks);
68 void writeValue(const blink::WebString& characteristic_instance_id,
69 const unsigned char* bytes,
70 unsigned byteLength,
71 blink::WebBluetoothWriteValueCallbacks*);
68 72
69 // WorkerTaskRunner::Observer implementation. 73 // WorkerTaskRunner::Observer implementation.
70 void OnWorkerRunLoopStopped() override; 74 void OnWorkerRunLoopStopped() override;
71 75
72 private: 76 private:
73 // IPC Handlers, see definitions in bluetooth_messages.h. 77 // IPC Handlers, see definitions in bluetooth_messages.h.
74 void OnRequestDeviceSuccess(int thread_id, 78 void OnRequestDeviceSuccess(int thread_id,
75 int request_id, 79 int request_id,
76 const BluetoothDevice& device); 80 const BluetoothDevice& device);
77 void OnRequestDeviceError(int thread_id, 81 void OnRequestDeviceError(int thread_id,
(...skipping 24 matching lines...) Expand all
102 int request_id, 106 int request_id,
103 BluetoothError error_type, 107 BluetoothError error_type,
104 const std::string& error_message); 108 const std::string& error_message);
105 void OnReadValueSuccess(int thread_id, 109 void OnReadValueSuccess(int thread_id,
106 int request_id, 110 int request_id,
107 const std::vector<uint8_t>& value); 111 const std::vector<uint8_t>& value);
108 void OnReadValueError(int thread_id, 112 void OnReadValueError(int thread_id,
109 int request_id, 113 int request_id,
110 BluetoothError error_type, 114 BluetoothError error_type,
111 const std::string& error_message); 115 const std::string& error_message);
116 void OnWriteValueSuccess(int thread_id, int request_id);
117 void OnWriteValueError(int thread_id,
118 int request_id,
119 BluetoothError error_type,
120 const std::string& error_message);
112 121
113 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 122 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
114 123
115 // Tracks device requests sent to browser to match replies with callbacks. 124 // Tracks device requests sent to browser to match replies with callbacks.
116 // Owns callback objects. 125 // Owns callback objects.
117 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> 126 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer>
118 pending_requests_; 127 pending_requests_;
119 // Tracks requests to connect to a device. 128 // Tracks requests to connect to a device.
120 // Owns callback objects. 129 // Owns callback objects.
121 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer> 130 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer>
122 pending_connect_requests_; 131 pending_connect_requests_;
123 // Tracks requests to get a primary service from a device. 132 // Tracks requests to get a primary service from a device.
124 // Owns request objects. 133 // Owns request objects.
125 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> 134 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer>
126 pending_primary_service_requests_; 135 pending_primary_service_requests_;
127 // Tracks requests to get a characteristic from a service. 136 // Tracks requests to get a characteristic from a service.
128 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> 137 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer>
129 pending_characteristic_requests_; 138 pending_characteristic_requests_;
130 // Tracks requests to read from a characteristics. 139 // Tracks requests to read from a characteristics.
131 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> 140 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer>
132 pending_read_value_requests_; 141 pending_read_value_requests_;
142 IDMap<blink::WebBluetoothWriteValueCallbacks, IDMapOwnPointer>
143 pending_write_value_requests_;
133 144
134 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); 145 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher);
135 }; 146 };
136 147
137 } // namespace content 148 } // namespace content
138 149
139 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ 150 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698