-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathwrite-descriptor.html
executable file
·50 lines (41 loc) · 1.69 KB
/
write-descriptor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
feature_name: Web Bluetooth / Write Descriptor
chrome_version: 58
check_min_version: true
feature_id: 5264933985976320
icon_url: icon.png
index: index.html
---
{% include_relative _includes/intro.html %}
<p>This sample illustrates the use of the Web Bluetooth API to write to the
descriptor "Characteristic User Description" on a nearby Bluetooth Low Energy
Device. You may want to try this demo with the BLE Peripheral Simulator App
from the <a target="_blank"
href="https://play.google.com/store/apps/details?id=io.github.webbluetoothcg.bletestperipheral">Google
Play Store</a> and check out the <a
href="write-descriptor-async-await.html">Write Descriptor (Async Await)</a> sample.</p>
<p>
<input id="service" type="text" list="services" autofocus placeholder="Bluetooth Service">
<input id="characteristic" type="text" list="characteristics" placeholder="Bluetooth Characteristic">
<button id="readButton">Get Characteristic User Description</button>
</p>
{% include_relative _includes/datalist-services.html %}
{% include_relative _includes/datalist-characteristics.html %}
<p>
<input id="description" type="text" placeholder="Characteristic User Description">
<button id="writeButton" disabled>Set Characteristic User Description</button>
</p>
{% include output_helper.html %}
{% include js_snippet.html filename='write-descriptor.js' %}
<script>
document.querySelector('#readButton').addEventListener('click', function() {
if (isWebBluetoothEnabled()) {
ChromeSamples.clearLog();
onReadButtonClick();
}
});
document.querySelector('#writeButton').addEventListener('click', function() {
onWriteButtonClick();
});
</script>
{% include_relative _includes/utils.html %}