All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.polymer.platinum.widget.PlatinumBluetoothService Maven / Gradle / Ivy

The newest version!
/*
 * 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.widget;

import com.vaadin.polymer.platinum.*;

import com.vaadin.polymer.*;
import com.vaadin.polymer.elemental.*;
import com.vaadin.polymer.PolymerWidget;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.core.client.JavaScriptObject;

/**
 * 

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) { });
 * });
 * 
*/ public class PlatinumBluetoothService extends PolymerWidget { /** * Default Constructor. */ public PlatinumBluetoothService() { this(""); } /** * Constructor used by UIBinder to create widgets with content. */ public PlatinumBluetoothService(String html) { super(PlatinumBluetoothServiceElement.TAG, PlatinumBluetoothServiceElement.SRC, html); } /** * Gets a handle to the Polymer object's underlying DOM element. */ public PlatinumBluetoothServiceElement getPolymerElement() { return (PlatinumBluetoothServiceElement) getElement(); } /** *

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 * */ public String getService() { return getPolymerElement().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 * */ public void setService(String value) { getPolymerElement().setService(value); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy