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 struct WebBluetoothRemoteGATTCharacteristic { | |
72 string instance_id; | |
73 string? uuid; | |
74 uint32 properties; | |
75 }; | |
76 | |
71 // TODO(ortuno): Define Bluetooth Service. | 77 // TODO(ortuno): Define Bluetooth Service. |
72 // https://crbug.com/508771 | 78 // https://crbug.com/508771 |
73 | 79 |
74 // Web Bluetooth Interface that Blink can use to perform | 80 // Web Bluetooth Interface that Blink can use to perform |
75 // Bluetooth GATT Operations on Bluetooth Devices. | 81 // Bluetooth GATT Operations on Bluetooth Devices. |
76 interface WebBluetoothService { | 82 interface WebBluetoothService { |
77 // Sets the client for this WebBluetoothService. The service will notify the | 83 // 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 | 84 // client of device events e.g. when a Characteristic's value changes or when |
79 // a device disconnects. | 85 // a device disconnects. |
80 SetClient(associated WebBluetoothServiceClient client); | 86 SetClient(associated WebBluetoothServiceClient client); |
81 | 87 |
88 // Returns the Characteristics of a GATT Service with |service_instance_id|. | |
89 // If |single_characteristic| is true, only one characteristic will be | |
90 // returned. | |
91 RemoteServiceGetCharacteristics( | |
92 string service_instance_id, | |
93 bool single_characteristic, | |
Jeffrey Yasskin
2016/04/22 01:16:38
We should make this an enum so the call sites are
ortuno
2016/04/25 15:29:45
Done.
| |
94 string? characteristics_uuid) => ( | |
Jeffrey Yasskin
2016/04/22 01:16:38
We should get this type-checked. I'm sorry for not
ortuno
2016/04/25 15:29:45
No problem! I already noticed :) Yes, Mojo does ha
Jeffrey Yasskin
2016/04/25 17:26:11
Waiting sounds good.
ortuno
2016/04/25 20:37:41
I opened an issue so that we don't forget.
| |
95 WebBluetoothError error, | |
96 array<WebBluetoothRemoteGATTCharacteristic>? characteristics); | |
97 | |
82 // Reads the value for characteristic with | 98 // Reads the value for characteristic with |
83 // |characteristic_instance_id|. If the value is successfully read the | 99 // |characteristic_instance_id|. If the value is successfully read the |
84 // callback will be run with WebBluetoothError::SUCCESS and the | 100 // callback will be run with WebBluetoothError::SUCCESS and the |
85 // characteristic's value. If the value is not successfully read the | 101 // characteristic's value. If the value is not successfully read the |
86 // callback with be run with the corresponding error and nullptr for value. | 102 // callback with be run with the corresponding error and nullptr for value. |
87 RemoteCharacteristicReadValue( | 103 RemoteCharacteristicReadValue( |
88 string characteristic_instance_id) => ( | 104 string characteristic_instance_id) => ( |
89 WebBluetoothError error, | 105 WebBluetoothError error, |
90 array<uint8>? value); | 106 array<uint8>? value); |
91 | 107 |
(...skipping 16 matching lines...) Expand all Loading... | |
108 string characteristic_instance_id) => (); | 124 string characteristic_instance_id) => (); |
109 }; | 125 }; |
110 | 126 |
111 // Classes should implement this interface and pass an associated pointer | 127 // Classes should implement this interface and pass an associated pointer |
112 // bound to them to the WebBluetoothService by using SetClient. Classes | 128 // bound to them to the WebBluetoothService by using SetClient. Classes |
113 // that do this will be notified of device events e.g. device disconnection. | 129 // that do this will be notified of device events e.g. device disconnection. |
114 interface WebBluetoothServiceClient { | 130 interface WebBluetoothServiceClient { |
115 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 131 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
116 array<uint8> value); | 132 array<uint8> value); |
117 }; | 133 }; |
OLD | NEW |