-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
71 lines (55 loc) · 2.19 KB
/
index.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<title>Demo FTMS Treadmill Web Console</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="main.css">
<script type="text/javascript" src="js/ftms-rower.js"></script>
</head>
<body>
<h1>FTMS BLE Rower Display</h1>
<h2>Connect</h2>
<p><button id="bleConnectionButton">Connect FTMS BLE Rower</button></p>
<div class="cards">
<div class="card">
<div class="name">Pace</div>
<div class="unit" id="avg-pace">10:67</div>
<div class="value" id="pace">23:45</div>
</div>
<div class="card">
<div class="name">Stroke rate</div>
<div class="unit" id="tot-strokes">107</div>
<div class="value" id="stroke-rate">23.5</div>
</div>
<div class="card">
<div class="name">Power</div>
<div class="unit" id="avg-power">135</div>
<div class="value" id="power">23.45</div>
</div>
<div class="card">
<div class="name">Distance</div>
<div class="unit">m</div>
<div class="value" id="tot-distance">2340</div>
</div>
</div>
</body>
<script>
function handleNotifications(event) {
let data = parseRowerData(event.target.value);
document.querySelector('#pace').textContent = data['Instantaneous Pace'];
document.querySelector('#avg-pace').textContent = data['Average Pace'];
document.querySelector('#tot-strokes').textContent = data['Stroke Count'];
document.querySelector('#stroke-rate').textContent = data['Stroke Rate'];
document.querySelector('#avg-power').textContent = data['Average Power'];
document.querySelector('#power').textContent = data['Instantaneous Power'];
document.querySelector('#tot-distance').textContent = data['Total Distance'];
}
function what() {
connect().then(characteristic =>
characteristic.addEventListener('characteristicvaluechanged', handleNotifications)
)
}
document.querySelector('#bleConnectionButton').addEventListener('click', what);
</script>
</html>