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

Unified Diff: third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)
Patch Set: address more comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom
diff --git a/third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom b/third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom
index 1668575334a6240bdacc73b4c9d94b7cd3ddd738..292dcdf41a0faa322e0e59a569e41300f54d6fde 100644
--- a/third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom
+++ b/third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom
@@ -158,11 +158,6 @@ struct WebBluetoothRemoteGATTDescriptor {
// Web Bluetooth Interface that Blink can use to perform
// Bluetooth GATT Operations on Bluetooth Devices.
interface WebBluetoothService {
- // Sets the client for this WebBluetoothService. The service will notify the
- // client of device events e.g. when a Characteristic's value changes or when
- // a device disconnects.
- SetClient(associated WebBluetoothServiceClient client);
-
RequestDevice(WebBluetoothRequestDeviceOptions options)
=> (WebBluetoothResult result, WebBluetoothDevice? device);
@@ -170,7 +165,11 @@ interface WebBluetoothService {
// if a connection to the device didn't exist already. If a GATT connection
// existed already then this function increases the ref count to keep that
// connection alive.
- RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothResult result);
+ // Returns the result of the connection request and a client request if the
+ // connection was successful and there was no previous WebBluetoothServerClient.
+ RemoteServerConnect(WebBluetoothDeviceId device_id) => (
+ WebBluetoothResult result,
+ associated WebBluetoothServerClient&? client_request);
// If a GATT connection exists for Device identified by |device_id| then
// decreases the ref count for that connection.
@@ -221,8 +220,13 @@ interface WebBluetoothService {
// Starts notifications for the characteristic identified by
// |characteristic_instance_id|.
+ // Returns the result of the start notifications request and a client
+ // request if the gatt operation was successful and there was no previous
+ // WebBluetoothCharacteristicClient.
RemoteCharacteristicStartNotifications(
- string characteristic_instance_id) => (WebBluetoothResult result);
+ string characteristic_instance_id) => (
+ WebBluetoothResult result,
+ associated WebBluetoothCharacteristicClient&? client_request);
// Stops notifications for the characteristic identified by
// |characteristic_instance_id|.
@@ -261,15 +265,15 @@ interface WebBluetoothService {
array<uint8> value) => (WebBluetoothResult result);
};
-// Classes should implement this interface and pass an associated pointer
-// bound to them to the WebBluetoothService by using SetClient. Classes
-// that do this will be notified of device events e.g. device disconnection.
-interface WebBluetoothServiceClient {
- // The characteristic identified by |characteristic_instance_id| has received
- // a notification of value change.
- RemoteCharacteristicValueChanged(string characteristic_instance_id,
- array<uint8> value);
+// Classes that implement this interface will be notified of characteristic
+// events.
+interface WebBluetoothCharacteristicClient {
+ // Called when we receive a notification for the characteristic.
+ RemoteCharacteristicValueChanged(array<uint8> value);
+};
- // The device identified by |device_id| has been disconnected.
- GattServerDisconnected(WebBluetoothDeviceId device_id);
+// Classes that implement this interface will be notified of device events.
+interface WebBluetoothServerClient {
+ // Called when a device disconnects.
+ GATTServerDisconnected();
};

Powered by Google App Engine
This is Rietveld 408576698