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

Side by Side Diff: third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Addressing code review comments from ortuno (still working on test changes) Created 4 years 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 WebBluetooth_h 5 #ifndef WebBluetooth_h
6 #define WebBluetooth_h 6 #define WebBluetooth_h
7 7
8 #include "public/platform/WebCallbacks.h" 8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebString.h" 9 #include "public/platform/WebString.h"
10 #include "public/platform/WebVector.h" 10 #include "public/platform/WebVector.h"
11 11
12 #include <memory> 12 #include <memory>
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class WebBluetoothDevice; 16 class WebBluetoothDevice;
17 class WebBluetoothRemoteGATTCharacteristic; 17 class WebBluetoothRemoteGATTCharacteristic;
18 class WebBluetoothRemoteGATTDescriptor;
18 19
19 struct WebBluetoothDeviceInit; 20 struct WebBluetoothDeviceInit;
20 struct WebBluetoothRemoteGATTCharacteristicInit; 21 struct WebBluetoothRemoteGATTCharacteristicInit;
22 struct WebBluetoothRemoteGATTDescriptorInit;
21 struct WebBluetoothRemoteGATTService; 23 struct WebBluetoothRemoteGATTService;
22 struct WebRequestDeviceOptions; 24 struct WebRequestDeviceOptions;
23 25
24 // Success and failure callbacks for requestDevice. 26 // Success and failure callbacks for requestDevice.
25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks< 27 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<
26 std::unique_ptr<WebBluetoothDeviceInit>, 28 std::unique_ptr<WebBluetoothDeviceInit>,
27 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; 29 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
28 30
29 // Success and failure callbacks for GattServer.connect(). 31 // Success and failure callbacks for GattServer.connect().
30 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks< 32 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<
31 void, 33 void,
32 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; 34 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
33 35
34 // Success and failure callbacks for getPrimaryService(s). 36 // Success and failure callbacks for getPrimaryService(s).
35 using WebBluetoothGetPrimaryServicesCallbacks = WebCallbacks< 37 using WebBluetoothGetPrimaryServicesCallbacks = WebCallbacks<
36 const WebVector<WebBluetoothRemoteGATTService*>&, 38 const WebVector<WebBluetoothRemoteGATTService*>&,
37 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; 39 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
38 40
39 // Success and failure callbacks for getCharacteristic(s). 41 // Success and failure callbacks for getCharacteristic(s).
40 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks< 42 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<
41 const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>&, 43 const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>&,
42 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; 44 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
43 45
46 // Success and failure callbacks for getDescriptor(s).
47 using WebBluetoothGetDescriptorsCallbacks = WebCallbacks<
48 const WebVector<WebBluetoothRemoteGATTDescriptorInit*>&,
49 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
50
44 // Success and failure callbacks for readValue. 51 // Success and failure callbacks for readValue.
45 using WebBluetoothReadValueCallbacks = WebCallbacks< 52 using WebBluetoothReadValueCallbacks = WebCallbacks<
46 const WebVector<uint8_t>&, 53 const WebVector<uint8_t>&,
47 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; 54 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
48 55
49 // Success and failure callbacks for writeValue. 56 // Success and failure callbacks for writeValue.
50 using WebBluetoothWriteValueCallbacks = WebCallbacks< 57 using WebBluetoothWriteValueCallbacks = WebCallbacks<
51 const WebVector<uint8_t>&, 58 const WebVector<uint8_t>&,
52 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>; 59 int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
53 60
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual void getCharacteristics( 96 virtual void getCharacteristics(
90 const WebString& serviceInstanceID, 97 const WebString& serviceInstanceID,
91 // Corresponds to WebBluetoothGATTQueryQuantity in web_bluetooth.mojom 98 // Corresponds to WebBluetoothGATTQueryQuantity in web_bluetooth.mojom
92 int32_t quantity, 99 int32_t quantity,
93 const WebString& characteristicsUUID, 100 const WebString& characteristicsUUID,
94 WebBluetoothGetCharacteristicsCallbacks*) = 0; 101 WebBluetoothGetCharacteristicsCallbacks*) = 0;
95 102
96 // BluetoothRemoteGATTCharacteristic methods: 103 // BluetoothRemoteGATTCharacteristic methods:
97 // See 104 // See
98 // https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattcharacteri stic 105 // https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattcharacteri stic
99 virtual void readValue(const WebString& characteristicInstanceID, 106 virtual void characteristicReadValue(
100 WebBluetoothReadValueCallbacks*) {} 107 const WebString& characteristicInstanceID,
101 virtual void writeValue(const WebString& characteristicInstanceID, 108 WebBluetoothReadValueCallbacks*) {}
102 const WebVector<uint8_t>& value, 109 virtual void characteristicWriteValue(
103 WebBluetoothWriteValueCallbacks*) {} 110 const WebString& characteristicInstanceID,
111 const WebVector<uint8_t>& value,
112 WebBluetoothWriteValueCallbacks*) {}
104 virtual void startNotifications(const WebString& characteristicInstanceID, 113 virtual void startNotifications(const WebString& characteristicInstanceID,
105 WebBluetoothNotificationsCallbacks*) {} 114 WebBluetoothNotificationsCallbacks*) {}
106 virtual void stopNotifications(const WebString& characteristicInstanceID, 115 virtual void stopNotifications(const WebString& characteristicInstanceID,
107 WebBluetoothNotificationsCallbacks*) {} 116 WebBluetoothNotificationsCallbacks*) {}
117 virtual void getDescriptors(
118 const WebString& serviceInstanceID,
119 // Corresponds to WebBluetoothGATTQueryQuantity in web_bluetooth.mojom
120 int32_t quantity,
121 const WebString& descriptorsUUID,
122 WebBluetoothGetDescriptorsCallbacks*) = 0;
123
124 // BluetoothRemoteGATTDescriptor methods:
125 // See
126 // https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattdescriptor
127 virtual void descriptorReadValue(const WebString& descriptorInstanceID,
128 WebBluetoothReadValueCallbacks*) {}
129 virtual void descriptorWriteValue(const WebString& descriptorInstanceID,
130 const WebVector<uint8_t>& value,
131 WebBluetoothWriteValueCallbacks*) {}
108 132
109 // Called when addEventListener is called on a characteristic. 133 // Called when addEventListener is called on a characteristic.
110 virtual void registerCharacteristicObject( 134 virtual void registerCharacteristicObject(
111 const WebString& characteristicInstanceID, 135 const WebString& characteristicInstanceID,
112 WebBluetoothRemoteGATTCharacteristic*) = 0; 136 WebBluetoothRemoteGATTCharacteristic*) = 0;
113 virtual void characteristicObjectRemoved( 137 virtual void characteristicObjectRemoved(
114 const WebString& characteristicInstanceID, 138 const WebString& characteristicInstanceID,
115 WebBluetoothRemoteGATTCharacteristic*) {} 139 WebBluetoothRemoteGATTCharacteristic*) {}
116 }; 140 };
117 141
118 } // namespace blink 142 } // namespace blink
119 143
120 #endif // WebBluetooth_h 144 #endif // WebBluetooth_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698