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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // https://crbug.com/508771 | 72 // https://crbug.com/508771 |
73 | 73 |
74 // Web Bluetooth Interface that Blink can use to perform | 74 // Web Bluetooth Interface that Blink can use to perform |
75 // Bluetooth GATT Operations on Bluetooth Devices. | 75 // Bluetooth GATT Operations on Bluetooth Devices. |
76 interface WebBluetoothService { | 76 interface WebBluetoothService { |
77 // Sets the client for this WebBluetoothService. The service will notify the | 77 // 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 | 78 // client of device events e.g. when a Characteristic's value changes or when |
79 // a device disconnects. | 79 // a device disconnects. |
80 SetClient(associated WebBluetoothServiceClient client); | 80 SetClient(associated WebBluetoothServiceClient client); |
81 | 81 |
| 82 // Reads the value for characteristic with |
| 83 // |characteristic_instance_id|. If the value is successfully read the |
| 84 // callback will be run with WebBluetoothError::SUCCESS and the |
| 85 // characteristic's value. If the value is not successfully read the |
| 86 // callback with be run with the corresponding error and nullptr for value. |
| 87 RemoteCharacteristicReadValue( |
| 88 string characteristic_instance_id) => ( |
| 89 WebBluetoothError error, |
| 90 array<uint8>? value); |
| 91 |
82 // Writes a value to the characteristic with | 92 // Writes a value to the characteristic with |
83 // |characteristic_instance_id|. The callback is run with | 93 // |characteristic_instance_id|. The callback is run with |
84 // WebBluetoothError::SUCCESS if the value was successfully | 94 // WebBluetoothError::SUCCESS if the value was successfully |
85 // written. | 95 // written. |
86 RemoteCharacteristicWriteValue( | 96 RemoteCharacteristicWriteValue( |
87 string characteristic_instance_id, | 97 string characteristic_instance_id, |
88 array<uint8> value) => (WebBluetoothError error); | 98 array<uint8> value) => (WebBluetoothError error); |
89 | 99 |
90 // Starts notifications for the characteristic with | 100 // Starts notifications for the characteristic with |
91 // |characteristic_instance_id|. | 101 // |characteristic_instance_id|. |
92 RemoteCharacteristicStartNotifications( | 102 RemoteCharacteristicStartNotifications( |
93 string characteristic_instance_id) => (WebBluetoothError error); | 103 string characteristic_instance_id) => (WebBluetoothError error); |
94 | 104 |
95 // Stops notifications for the characteristic with | 105 // Stops notifications for the characteristic with |
96 // |characteristic_instance_id|. | 106 // |characteristic_instance_id|. |
97 RemoteCharacteristicStopNotifications( | 107 RemoteCharacteristicStopNotifications( |
98 string characteristic_instance_id) => (); | 108 string characteristic_instance_id) => (); |
99 }; | 109 }; |
100 | 110 |
101 // Classes should implement this interface and pass an associated pointer | 111 // Classes should implement this interface and pass an associated pointer |
102 // bound to them to the WebBluetoothService by using SetClient. Classes | 112 // bound to them to the WebBluetoothService by using SetClient. Classes |
103 // that do this will be notified of device events e.g. device disconnection. | 113 // that do this will be notified of device events e.g. device disconnection. |
104 interface WebBluetoothServiceClient { | 114 interface WebBluetoothServiceClient { |
105 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 115 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
106 array<uint8> value); | 116 array<uint8> value); |
107 }; | 117 }; |
OLD | NEW |