-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathlink-loss.html
executable file
·50 lines (42 loc) · 1.76 KB
/
link-loss.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 / Link Loss
chrome_version: 50
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 read and write the standardized <a
target="_blank"
href="https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.alert_level.xml">Alert Level</a> characteristic from a nearby Bluetooth
Device used to expose the current link loss alert level that determines how the
device alerts when the link is lost. You may want to try this demo with the nRF
Connect for Mobile App from the <a target="_blank"
href="https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp">Google
Play Store</a> and its pre-configured Link Loss service, and check out the <a
href="link-loss-async-await.html">Link Loss (Async Await)</a> sample.</p>
<button id="readButton">Get Bluetooth Device Alert Level</button>
<p>
<select id="alertLevelValue">
<option selected disabled hidden>Choose...</option>
<option value="0x00">0x00 (No Alert)</option>
<option value="0x01">0x01 (Mild Alert)</option>
<option value="0x02">0x02 (High Alert)</option>
</select>
<button id="writeButton" disabled>Set Alert Level</button>
</p>
{% include output_helper.html %}
{% include js_snippet.html filename='link-loss.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 %}