forked from mirrors/gecko-dev
<!-- Please describe your changes on the following line: --> This implements the [getAvailability](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability) function from the spec. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e394334739635e58bc4d160e9d27bf7217945746 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 3b9459c19ab0724894afdf50c0966fc109adeae6
44 lines
1.4 KiB
Text
44 lines
1.4 KiB
Text
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
// https://webbluetoothcg.github.io/web-bluetooth/#bluetooth
|
|
|
|
dictionary BluetoothDataFilterInit {
|
|
// BufferSource dataPrefix;
|
|
sequence<octet> dataPrefix;
|
|
// BufferSource mask;
|
|
sequence<octet> mask;
|
|
};
|
|
|
|
dictionary BluetoothLEScanFilterInit {
|
|
sequence<BluetoothServiceUUID> services;
|
|
DOMString name;
|
|
DOMString namePrefix;
|
|
// Maps unsigned shorts to BluetoothDataFilters.
|
|
MozMap<BluetoothDataFilterInit> manufacturerData;
|
|
// Maps BluetoothServiceUUIDs to BluetoothDataFilters.
|
|
MozMap<BluetoothDataFilterInit> serviceData;
|
|
};
|
|
|
|
dictionary RequestDeviceOptions {
|
|
sequence<BluetoothLEScanFilterInit> filters;
|
|
sequence<BluetoothServiceUUID> optionalServices /*= []*/;
|
|
boolean acceptAllDevices = false;
|
|
};
|
|
|
|
[Pref="dom.bluetooth.enabled"]
|
|
interface Bluetooth : EventTarget {
|
|
[SecureContext]
|
|
Promise<boolean> getAvailability();
|
|
[SecureContext]
|
|
attribute EventHandler onavailabilitychanged;
|
|
// [SecureContext, SameObject]
|
|
// readonly attribute BluetoothDevice? referringDevice;
|
|
[SecureContext]
|
|
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
|
|
};
|
|
|
|
// Bluetooth implements BluetoothDeviceEventHandlers;
|
|
// Bluetooth implements CharacteristicEventHandlers;
|
|
// Bluetooth implements ServiceEventHandlers;
|