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

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

Issue 1334763002: bluetooth: Subscribe to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-origin
Patch Set: Created 5 years, 3 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/common/bluetooth/bluetooth_device.h" 10 #include "content/common/bluetooth/bluetooth_device.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 void getCharacteristic( 63 void getCharacteristic(
64 const blink::WebString& service_instance_id, 64 const blink::WebString& service_instance_id,
65 const blink::WebString& characteristic_uuid, 65 const blink::WebString& characteristic_uuid,
66 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); 66 blink::WebBluetoothGetCharacteristicCallbacks* callbacks);
67 void readValue(const blink::WebString& characteristic_instance_id, 67 void readValue(const blink::WebString& characteristic_instance_id,
68 blink::WebBluetoothReadValueCallbacks* callbacks); 68 blink::WebBluetoothReadValueCallbacks* callbacks);
69 void writeValue(const blink::WebString& characteristic_instance_id, 69 void writeValue(const blink::WebString& characteristic_instance_id,
70 const std::vector<uint8_t>& value, 70 const std::vector<uint8_t>& value,
71 blink::WebBluetoothWriteValueCallbacks*); 71 blink::WebBluetoothWriteValueCallbacks*);
72 void startNotifications(const blink::WebString& characteristic_instance_id,
73 blink::WebBluetoothStartNotificationsCallbacks*);
74 void stopNotifications(const blink::WebString& characteristic_instance_id,
75 blink::WebBluetoothStopNotificationsCallbacks*);
72 76
73 // WorkerThread::Observer implementation. 77 // WorkerThread::Observer implementation.
74 void WillStopCurrentWorkerThread() override; 78 void WillStopCurrentWorkerThread() override;
75 79
76 private: 80 private:
77 // IPC Handlers, see definitions in bluetooth_messages.h. 81 // IPC Handlers, see definitions in bluetooth_messages.h.
78 void OnRequestDeviceSuccess(int thread_id, 82 void OnRequestDeviceSuccess(int thread_id,
79 int request_id, 83 int request_id,
80 const BluetoothDevice& device); 84 const BluetoothDevice& device);
81 void OnRequestDeviceError(int thread_id, 85 void OnRequestDeviceError(int thread_id,
(...skipping 23 matching lines...) Expand all
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 blink::WebBluetoothError error); 114 blink::WebBluetoothError error);
111 void OnWriteValueSuccess(int thread_id, int request_id); 115 void OnWriteValueSuccess(int thread_id, int request_id);
112 void OnWriteValueError(int thread_id, 116 void OnWriteValueError(int thread_id,
113 int request_id, 117 int request_id,
114 blink::WebBluetoothError error); 118 blink::WebBluetoothError error);
119 void OnStartNotificationsSuccess(int thread_id, int request_id);
120 void OnStartNotificationsError(int thread_id,
121 int request_id,
122 blink::WebBluetoothError error);
123 void OnStopNotificationsSuccess(int thread_id, int request_id);
115 124
116 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 125 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
117 126
118 // Tracks device requests sent to browser to match replies with callbacks. 127 // Tracks device requests sent to browser to match replies with callbacks.
119 // Owns callback objects. 128 // Owns callback objects.
120 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> 129 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer>
121 pending_requests_; 130 pending_requests_;
122 // Tracks requests to connect to a device. 131 // Tracks requests to connect to a device.
123 // Owns callback objects. 132 // Owns callback objects.
124 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer> 133 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer>
125 pending_connect_requests_; 134 pending_connect_requests_;
126 // Tracks requests to get a primary service from a device. 135 // Tracks requests to get a primary service from a device.
127 // Owns request objects. 136 // Owns request objects.
128 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> 137 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer>
129 pending_primary_service_requests_; 138 pending_primary_service_requests_;
130 // Tracks requests to get a characteristic from a service. 139 // Tracks requests to get a characteristic from a service.
131 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> 140 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer>
132 pending_characteristic_requests_; 141 pending_characteristic_requests_;
133 // Tracks requests to read from a characteristics. 142 // Tracks requests to read from a characteristics.
134 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> 143 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer>
135 pending_read_value_requests_; 144 pending_read_value_requests_;
136 IDMap<blink::WebBluetoothWriteValueCallbacks, IDMapOwnPointer> 145 IDMap<blink::WebBluetoothWriteValueCallbacks, IDMapOwnPointer>
137 pending_write_value_requests_; 146 pending_write_value_requests_;
147 // Tracks requests to start notifications from a characteristic.
148 IDMap<blink::WebBluetoothStartNotificationsCallbacks, IDMapOwnPointer>
149 pending_start_notifications_requests_;
150 // Tracks requests to stop notifications from a characteristic.
151 IDMap<blink::WebBluetoothStopNotificationsCallbacks, IDMapOwnPointer>
152 pending_stop_notifications_requests_;
138 153
139 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); 154 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher);
140 }; 155 };
141 156
142 } // namespace content 157 } // namespace content
143 158
144 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ 159 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698