com.vaadin.polymer.platinum.PlatinumBluetoothDeviceElement Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from platinum-bluetooth project by The Polymer Authors
* that is licensed with http://polymer.github.io/LICENSE.txt license.
*/
package com.vaadin.polymer.platinum;
import com.vaadin.polymer.elemental.*;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
/**
* The <platinum-bluetooth-device>
element allows you to discover nearby
bluetooth devices thanks to the young Web Bluetooth API. It is
currently partially implemented behind the experimental flag
chrome://flags/#enable-web-bluetooth
. It is also now available in
Chrome 53 as an origin trial for Chrome OS, Android M, and Mac.
* <platinum-bluetooth-device>
is used as a parent element for
<platinum-bluetooth-service>
child elements.
* For instance, here’s how to request a nearby bluetooth device advertising
Battery service:
* <platinum-bluetooth-device services-filter='["battery_service"]'>
* </platinum-bluetooth-device>
*
* button.addEventListener('click', function() {
* document.querySelector('platinum-bluetooth-device').request()
* .then(function(device) { console.log(device.name); })
* .catch(function(error) { console.error(error); });
* });
*
* You can also request a nearby bluetooth device by setting a filter on
a name or name Prefix:
* <platinum-bluetooth-device name-filter='foobar'>
* </platinum-bluetooth-device>
*
* <platinum-bluetooth-device name-prefix-filter='foo'>
* </platinum-bluetooth-device>
*
* And you can combine some of the filters as well. Here’s how to request a
nearby bluetooth device advertising Battery service and whose name is
“foobar”:
* <platinum-bluetooth-device services-filter='["battery_service"]'
* name-filter='foobar'>
* </platinum-bluetooth-device>
*
* If you filter just by name, then you must use optional-services-filter
to get access to any services:
* <platinum-bluetooth-device name-filter='foobar'
* optional-services-filter='["battery_service"]'>
* </platinum-bluetooth-device>
*
* Disconnecting manually from a connected bluetooth device is pretty
straightforward:
* disconnectButton.addEventListener('click', function() {
* document.querySelector('platinum-bluetooth-device').disconnect();
* });
*
*/
@JsType(isNative=true)
public interface PlatinumBluetoothDeviceElement extends HTMLElement {
@JsOverlay public static final String TAG = "platinum-bluetooth-device";
@JsOverlay public static final String SRC = "platinum-bluetooth/platinum-bluetooth-elements.html";
/**
* Current Bluetooth device picked by user.
*
* JavaScript Info:
* @property device
* @type BluetoothDevice
*
*/
@JsProperty JavaScriptObject getDevice();
/**
* Current Bluetooth device picked by user.
*
* JavaScript Info:
* @property device
* @type BluetoothDevice
*
*/
@JsProperty void setDevice(JavaScriptObject value);
/**
* Optional Bluetooth GATT services filter. This implies that if you
filter just by name, you must use optionalServicesFilter
to get
access to any services. You may provide either the full Bluetooth
UUID as a string or a short 16- or 32-bit form as integers like
0x180d.
*
* JavaScript Info:
* @property optionalServicesFilter
* @type Array
*
*/
@JsProperty JsArray getOptionalServicesFilter();
/**
* Optional Bluetooth GATT services filter. This implies that if you
filter just by name, you must use optionalServicesFilter
to get
access to any services. You may provide either the full Bluetooth
UUID as a string or a short 16- or 32-bit form as integers like
0x180d.
*
* JavaScript Info:
* @property optionalServicesFilter
* @type Array
*
*/
@JsProperty void setOptionalServicesFilter(JsArray value);
/**
* Bluetooth GATT services filter. You may provide either the
full Bluetooth UUID as a string or a short 16- or 32-bit form as
integers like 0x180d.
*
* JavaScript Info:
* @property servicesFilter
* @type Array
*
*/
@JsProperty JsArray getServicesFilter();
/**
* Bluetooth GATT services filter. You may provide either the
full Bluetooth UUID as a string or a short 16- or 32-bit form as
integers like 0x180d.
*
* JavaScript Info:
* @property servicesFilter
* @type Array
*
*/
@JsProperty void setServicesFilter(JsArray value);
/**
* Indicates whether the Web Bluetooth API is supported by
this browser.
*
* JavaScript Info:
* @property supported
* @type Boolean
*
*/
@JsProperty boolean getSupported();
/**
* Indicates whether the Web Bluetooth API is supported by
this browser.
*
* JavaScript Info:
* @property supported
* @type Boolean
*
*/
@JsProperty void setSupported(boolean value);
/**
* Device name filter.
*
* JavaScript Info:
* @property nameFilter
* @type String
*
*/
@JsProperty String getNameFilter();
/**
* Device name filter.
*
* JavaScript Info:
* @property nameFilter
* @type String
*
*/
@JsProperty void setNameFilter(String value);
/**
* Device name prefix filter.
*
* JavaScript Info:
* @property namePrefixFilter
* @type String
*
*/
@JsProperty String getNamePrefixFilter();
/**
* Device name prefix filter.
*
* JavaScript Info:
* @property namePrefixFilter
* @type String
*
*/
@JsProperty void setNamePrefixFilter(String value);
/**
* Disconnect GATT Server connection from current bluetooth device.
*
* JavaScript Info:
* @method disconnect
*
*
*/
void disconnect();
/**
* Request a nearby bluetooth device and returns a Promise that will
resolve when user picked one Bluetooth device based on filters.
* It must be called on user gesture.
*
* JavaScript Info:
* @method request
*
* @return {JavaScriptObject}
*/
JavaScriptObject request();
/**
* Reset device to pick a new device.
*
* JavaScript Info:
* @method reset
*
*
*/
void reset();
}