com.vaadin.polymer.platinum.PlatinumBluetoothServiceElement 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-service>
element is used in conjuction with
the <platinum-bluetooth-characteristic>
element to read and write
characteristics on 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-service>
needs to be a child of a
<platinum-bluetooth-device>
element.
* For instance, here’s how to read battery level from a nearby bluetooth
device advertising Battery service:
* <platinum-bluetooth-device services-filter='["battery_service"]'>
* <platinum-bluetooth-service service='battery_service'>
* <platinum-bluetooth-characteristic characteristic='battery_level'>
* </platinum-bluetooth-characteristic>
* </platinum-bluetooth-service>
* </platinum-bluetooth-device>
*
* var bluetoothDevice = document.querySelector('platinum-bluetooth-device');
* var batteryLevel = document.querySelector('platinum-bluetooth-characteristic');
*
* button.addEventListener('click', function() {
* bluetoothDevice.request().then(function() {
* return batteryLevel.read().then(function(value) {
* console.log('Battery Level is ' + value.getUint8(0) + '%');
* });
* })
* .catch(function(error) { });
* });
*
*/
@JsType(isNative=true)
public interface PlatinumBluetoothServiceElement extends HTMLElement {
@JsOverlay public static final String TAG = "platinum-bluetooth-service";
@JsOverlay public static final String SRC = "platinum-bluetooth/platinum-bluetooth-elements.html";
/**
* Required Bluetooth GATT primary service. 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 service
* @type String
*
*/
@JsProperty String getService();
/**
* Required Bluetooth GATT primary service. 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 service
* @type String
*
*/
@JsProperty void setService(String value);
}