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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Ensure that we throw a kGattServerNotConnected error if getDescriptor[s] is called while not connec… Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h
diff --git a/third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h b/third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h
index 13da332c1627ae53a12a5331fe94792a2f19ecd1..ed8228989bede31dba6d34c36814ac2876915d8b 100644
--- a/third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h
+++ b/third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h
@@ -15,9 +15,11 @@ namespace blink {
class WebBluetoothDevice;
class WebBluetoothRemoteGATTCharacteristic;
+class WebBluetoothRemoteGATTDescriptor;
struct WebBluetoothDeviceInit;
struct WebBluetoothRemoteGATTCharacteristicInit;
+struct WebBluetoothRemoteGATTDescriptorInit;
struct WebBluetoothRemoteGATTService;
struct WebRequestDeviceOptions;
@@ -41,6 +43,11 @@ using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<
const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>&,
int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
+// Success and failure callbacks for getDescriptor(s).
+using WebBluetoothGetDescriptorsCallbacks = WebCallbacks<
+ const WebVector<WebBluetoothRemoteGATTDescriptorInit*>&,
+ int32_t /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */>;
+
// Success and failure callbacks for readValue.
using WebBluetoothReadValueCallbacks = WebCallbacks<
const WebVector<uint8_t>&,
@@ -96,15 +103,32 @@ class WebBluetooth {
// BluetoothRemoteGATTCharacteristic methods:
// See
// https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattcharacteristic
- virtual void readValue(const WebString& characteristicInstanceID,
- WebBluetoothReadValueCallbacks*) {}
- virtual void writeValue(const WebString& characteristicInstanceID,
- const WebVector<uint8_t>& value,
- WebBluetoothWriteValueCallbacks*) {}
+ virtual void characteristicReadValue(
+ const WebString& characteristicInstanceID,
+ WebBluetoothReadValueCallbacks*) {}
+ virtual void characteristicWriteValue(
+ const WebString& characteristicInstanceID,
+ const WebVector<uint8_t>& value,
+ WebBluetoothWriteValueCallbacks*) {}
virtual void startNotifications(const WebString& characteristicInstanceID,
WebBluetoothNotificationsCallbacks*) {}
virtual void stopNotifications(const WebString& characteristicInstanceID,
WebBluetoothNotificationsCallbacks*) {}
+ virtual void getDescriptors(
+ const WebString& serviceInstanceID,
+ // Corresponds to WebBluetoothGATTQueryQuantity in web_bluetooth.mojom
+ int32_t quantity,
+ const WebString& descriptorsUUID,
+ WebBluetoothGetDescriptorsCallbacks*) = 0;
+
+ // BluetoothRemoteGATTDescriptor methods:
+ // See
+ // https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattdescriptor
+ virtual void descriptorReadValue(const WebString& descriptorInstanceID,
+ WebBluetoothReadValueCallbacks*) {}
+ virtual void descriptorWriteValue(const WebString& descriptorInstanceID,
+ const WebVector<uint8_t>& value,
+ WebBluetoothWriteValueCallbacks*) {}
// Called when addEventListener is called on a characteristic.
virtual void registerCharacteristicObject(
@@ -113,6 +137,12 @@ class WebBluetooth {
virtual void characteristicObjectRemoved(
const WebString& characteristicInstanceID,
WebBluetoothRemoteGATTCharacteristic*) {}
+
+ // Called when addEventListener is called on a descriptor.
+ virtual void registerDescriptorObject(const WebString& descriptorInstanceID,
+ WebBluetoothRemoteGATTDescriptor*) = 0;
+ virtual void descriptorObjectRemoved(const WebString& descriptorInstanceID,
+ WebBluetoothRemoteGATTDescriptor*) {}
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698