| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 module blink.mojom; | 5 module blink.mojom; |
| 6 | 6 |
| 7 // Errors that can occur during Web Bluetooth execution, which are transformed | 7 // Errors that can occur during Web Bluetooth execution, which are transformed |
| 8 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. | 8 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. |
| 9 // | 9 // |
| 10 // These errors all produce constant message strings. If a particular message | 10 // These errors all produce constant message strings. If a particular message |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 BLACKLISTED_WRITE, | 61 BLACKLISTED_WRITE, |
| 62 NOT_ALLOWED_TO_ACCESS_SERVICE, | 62 NOT_ALLOWED_TO_ACCESS_SERVICE, |
| 63 REQUEST_DEVICE_WITH_BLACKLISTED_UUID, | 63 REQUEST_DEVICE_WITH_BLACKLISTED_UUID, |
| 64 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, | 64 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, |
| 65 REQUEST_DEVICE_WITHOUT_FRAME, | 65 REQUEST_DEVICE_WITHOUT_FRAME, |
| 66 // SyntaxError: | 66 // SyntaxError: |
| 67 // TODO(ortuno): Remove once we no longer use IPC. | 67 // TODO(ortuno): Remove once we no longer use IPC. |
| 68 ENUM_MAX_VALUE = REQUEST_DEVICE_WITHOUT_FRAME, | 68 ENUM_MAX_VALUE = REQUEST_DEVICE_WITHOUT_FRAME, |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Indicates if the function will return a single or multiple |
| 72 // GATT objects. |
| 73 enum WebBluetoothGATTQueryQuantity { |
| 74 SINGLE, |
| 75 MULTIPLE |
| 76 }; |
| 77 |
| 78 struct WebBluetoothRemoteGATTCharacteristic { |
| 79 string instance_id; |
| 80 string uuid; |
| 81 uint32 properties; |
| 82 }; |
| 83 |
| 71 // TODO(ortuno): Define Bluetooth Service. | 84 // TODO(ortuno): Define Bluetooth Service. |
| 72 // https://crbug.com/508771 | 85 // https://crbug.com/508771 |
| 73 | 86 |
| 74 // Web Bluetooth Interface that Blink can use to perform | 87 // Web Bluetooth Interface that Blink can use to perform |
| 75 // Bluetooth GATT Operations on Bluetooth Devices. | 88 // Bluetooth GATT Operations on Bluetooth Devices. |
| 76 interface WebBluetoothService { | 89 interface WebBluetoothService { |
| 77 // Sets the client for this WebBluetoothService. The service will notify the | 90 // Sets the client for this WebBluetoothService. The service will notify the |
| 78 // client of device events e.g. when a Characteristic's value changes or when | 91 // client of device events e.g. when a Characteristic's value changes or when |
| 79 // a device disconnects. | 92 // a device disconnects. |
| 80 SetClient(associated WebBluetoothServiceClient client); | 93 SetClient(associated WebBluetoothServiceClient client); |
| 81 | 94 |
| 95 // Returns the Characteristics of a GATT Service with |service_instance_id|. |
| 96 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one |
| 97 // characteristic will be returned. |
| 98 RemoteServiceGetCharacteristics( |
| 99 string service_instance_id, |
| 100 WebBluetoothGATTQueryQuantity quantity, |
| 101 string? characteristics_uuid) => ( |
| 102 WebBluetoothError error, |
| 103 array<WebBluetoothRemoteGATTCharacteristic>? characteristics); |
| 104 |
| 82 // Reads the value for characteristic with | 105 // Reads the value for characteristic with |
| 83 // |characteristic_instance_id|. If the value is successfully read the | 106 // |characteristic_instance_id|. If the value is successfully read the |
| 84 // callback will be run with WebBluetoothError::SUCCESS and the | 107 // callback will be run with WebBluetoothError::SUCCESS and the |
| 85 // characteristic's value. If the value is not successfully read the | 108 // characteristic's value. If the value is not successfully read the |
| 86 // callback with be run with the corresponding error and nullptr for value. | 109 // callback with be run with the corresponding error and nullptr for value. |
| 87 RemoteCharacteristicReadValue( | 110 RemoteCharacteristicReadValue( |
| 88 string characteristic_instance_id) => ( | 111 string characteristic_instance_id) => ( |
| 89 WebBluetoothError error, | 112 WebBluetoothError error, |
| 90 array<uint8>? value); | 113 array<uint8>? value); |
| 91 | 114 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 108 string characteristic_instance_id) => (); | 131 string characteristic_instance_id) => (); |
| 109 }; | 132 }; |
| 110 | 133 |
| 111 // Classes should implement this interface and pass an associated pointer | 134 // Classes should implement this interface and pass an associated pointer |
| 112 // bound to them to the WebBluetoothService by using SetClient. Classes | 135 // bound to them to the WebBluetoothService by using SetClient. Classes |
| 113 // that do this will be notified of device events e.g. device disconnection. | 136 // that do this will be notified of device events e.g. device disconnection. |
| 114 interface WebBluetoothServiceClient { | 137 interface WebBluetoothServiceClient { |
| 115 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 138 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
| 116 array<uint8> value); | 139 array<uint8> value); |
| 117 }; | 140 }; |
| OLD | NEW |