-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
309 lines (229 loc) · 12.5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<html>
<head>
<script src="bose-ar-web-sdk.min.js"></script>
</head>
<style>
input {
width: 50px
}
</style>
<body>
<bose-ar-device></bose-ar-device>
<div id=dataContainer style="display: none ">
<h1>Bose Frames</h1>
<h2>Sensor Data</h2>
<form id=accelerometerContainer>
<h3>Accelerometer</h3>
<select size="6" style="overflow: hidden" oninput="boseARDeviceElement.setAttribute('accelerometer', this.value)">
<option selected value=0>disabled</option>
<option value=20>very fast (20ms)</option>
<option value=40>fast (40ms)</option>
<option value=80>normal (80ms)</option>
<option value=160>slow (160ms)</option>
<option value=320>very slow (320ms)</option>
</select>
<br>
<br>
<label for=accelerometerX>x</label>
<input id=accelerometerX readonly>
<label for=accelerometerY>y</label>
<input id=accelerometerY readonly size=2>
<label for=accelerometerZ>z</label>
<input id=accelerometerZ readonly size=2>
<br>
<br>
<label for=accelerometerTimestamp>timestamp</label>
<input id=accelerometerTimestamp readonly size=2>
</form>
<form id="Gyroscope">
<h3>Gyroscope</h3>
<select size="6" style="overflow: hidden" oninput="boseARDeviceElement.setAttribute('gyroscope', this.value)">
<option selected value=0>disabled</option>
<option value=20>very fast (20ms)</option>
<option value=40>fast (40ms)</option>
<option value=80>normal (80ms)</option>
<option value=160>slow (160ms)</option>
<option value=320>very slow (320ms)</option>
</select>
<br>
<br>
<label for=gyroscopeX>x</label>
<input id=gyroscopeX readonly size=2>
<label for=gyroscopeY>y</label>
<input id=gyroscopeY readonly size=2>
<label for=gyroscopeZ>z</label>
<input id=gyroscopeZ readonly size=2>
<br>
<br>
<label for=gyroscopeTimestamp>timestamp</label>
<input id=gyroscopeTimestamp size=2>
</form>
<form id="Rotation">
<h3>Rotation</h3>
<select size="6" style="overflow: hidden" oninput="boseARDeviceElement.setAttribute('rotation', this.value)">
<option selected value=0>disabled</option>
<option value=20>very fast (20ms)</option>
<option value=40>fast (40ms)</option>
<option value=80>normal (80ms)</option>
<option value=160>slow (160ms)</option>
<option value=320>very slow (320ms)</option>
</select>
<br>
<br>
<label for=rotationX>x</label>
<input id=rotationX readonly size=2>
<label for=rotationY>y</label>
<input id=rotationY readonly size=2>
<label for=rotationZ>z</label>
<input id=rotationZ readonly size=2>
<label for=rotationW>w</label>
<input id=rotationW readonly size=2>
<br>
<br>
<label for=rotationPitch>pitch</label>
<input id=rotationPitch readonly size=2>
<label for=rotationRoll>roll</label>
<input id=rotationRoll readonly size=2>
<label for=rotationYaw>yaw</label>
<input id=rotationYaw readonly size=2>
<br>
<br>
<label for=rotationTimestamp>timestamp</label>
<input id=rotationTimestamp readonly size=2>
</form>
<form id="Game Rotation">
<h3>Game Rotation</h3>
<select size="6" style="overflow: hidden" oninput="boseARDeviceElement.setAttribute('game-rotation', this.value)">
<option selected value=0>disabled</option>
<option value=20>very fast (20ms)</option>
<option value=40>fast (40ms)</option>
<option value=80>normal (80ms)</option>
<option value=160>slow (160ms)</option>
<option value=320>very slow (320ms)</option>
</select>
<br>
<br>
<label for=gameRotationX>x</label>
<input id=gameRotationX readonly size=2>
<label for=gameRotationY>y</label>
<input id=gameRotationY readonly size=2>
<label for=gameRotationZ>z</label>
<input id=gameRotationZ readonly size=2>
<label for=gameRotationW>w</label>
<input id=gameRotationW readonly size=2>
<br>
<br>
<label for=gameRotationPitch>pitch</label>
<input id=gameRotationPitch readonly size=2>
<label for=gameRotationRoll>roll</label>
<input id=gameRotationRoll readonly size=2>
<label for=gameRotationYaw>yaw</label>
<input id=gameRotationYaw readonly size=2>
<br>
<br>
<label for=gameRotationTimestamp>timestamp</label>
<input id=gameRotationTimestamp readonly size=2>
</form>
<hr>
<h2>Gesture Data</h2>
<form id="SingleTap">
<h3>Single Tap (Waiting for a firmware update from Bose)</h3>
<select disabled size="2" style="overflow: hidden" oninput="(this.value == 'enable')? boseARDeviceElement.setAttribute('single-tap', ''):boseARDeviceElement.removeAttribute('single-tap')">
<option selected value=disable>disable</option>
<option value=enable>enable</option>
</select>
<br>
<div id=singleTapNotifications style="width: 500px; border: solid">
</div>
</form>
<form id="DoubleTap">
<h3>Double Tap</h3>
<select size="2" style="overflow: hidden" oninput="(this.value == 'enable')? boseARDeviceElement.setAttribute('double-tap', ''):boseARDeviceElement.removeAttribute('double-tap')">
<option selected value=disable>disable</option>
<option value=enable>enable</option>
</select>
<br>
<div id=doubleTapNotifications style="width: 500px; border: solid">
</div>
</form>
<form id="HeadNod">
<h3>Head Nod</h3>
<select size="2" style="overflow: hidden" oninput="(this.value == 'enable')? boseARDeviceElement.setAttribute('head-nod', ''):boseARDeviceElement.removeAttribute('head-nod')">
<option selected value=disable>disable</option>
<option value=enable>enable</option>
</select>
<br>
<div id=headNodNotifications style="width: 500px; border: solid">
</div>
</form>
<form id="HeadShake">
<h3>Head Shake</h3>
<select size="2" style="overflow: hidden" oninput="(this.value == 'enable')? boseARDeviceElement.setAttribute('head-shake', ''):boseARDeviceElement.removeAttribute('head-shake')">
<option selected value=disable>disable</option>
<option value=enable>enable</option>
</select>
<br>
<div id=headShakeNotifications style="width: 500px; border: solid">
</div>
</form>
</div>
<script>
const boseARDeviceElement = document.querySelector("bose-ar-device");
boseARDeviceElement.addEventListener("connect", event => {
dataContainer.style.display = '';
});
boseARDeviceElement.addEventListener("accelerometer", event => {
accelerometerX.value = Number(boseARDeviceElement.getAttribute("accelerometerX")).toFixed(3);
accelerometerY.value = Number(boseARDeviceElement.getAttribute("accelerometerY")).toFixed(3);
accelerometerZ.value = Number(boseARDeviceElement.getAttribute("accelerometerZ")).toFixed(3);
accelerometerTimestamp.value = boseARDeviceElement.getAttribute("accelerometerTimestamp");
});
boseARDeviceElement.addEventListener("gyroscope", event => {
gyroscopeX.value = Number(boseARDeviceElement.getAttribute("gyroscopeX")).toFixed(3);
gyroscopeY.value = Number(boseARDeviceElement.getAttribute("gyroscopeY")).toFixed(3);
gyroscopeZ.value = Number(boseARDeviceElement.getAttribute("gyroscopeZ")).toFixed(3);
gyroscopeTimestamp.value = boseARDeviceElement.getAttribute("gyroscopeTimestamp");
});
boseARDeviceElement.addEventListener("rotation", event => {
rotationX.value = Number(boseARDeviceElement.getAttribute("rotationX")).toFixed(3);
rotationY.value = Number(boseARDeviceElement.getAttribute("rotationY")).toFixed(3);
rotationZ.value = Number(boseARDeviceElement.getAttribute("rotationZ")).toFixed(3);
rotationW.value = Number(boseARDeviceElement.getAttribute("rotationW")).toFixed(3);
rotationPitch.value = Number(boseARDeviceElement.getAttribute("rotationPitch")).toFixed(3);
rotationRoll.value = Number(boseARDeviceElement.getAttribute("rotationRoll")).toFixed(3);
rotationYaw.value = Number(boseARDeviceElement.getAttribute("rotationYaw")).toFixed(3);
rotationTimestamp.value = boseARDeviceElement.getAttribute("rotationTimestamp");
});
boseARDeviceElement.addEventListener("gameRotation", event => {
gameRotationX.value = Number(boseARDeviceElement.getAttribute("gameRotationX")).toFixed(3);
gameRotationY.value = Number(boseARDeviceElement.getAttribute("gameRotationY")).toFixed(3);
gameRotationZ.value = Number(boseARDeviceElement.getAttribute("gameRotationZ")).toFixed(3);
gameRotationW.value = Number(boseARDeviceElement.getAttribute("gameRotationW")).toFixed(3);
gameRotationPitch.value = Number(boseARDeviceElement.getAttribute("gameRotationPitch")).toFixed(3);
gameRotationRoll.value = Number(boseARDeviceElement.getAttribute("gameRotationRoll")).toFixed(3);
gameRotationYaw.value = Number(boseARDeviceElement.getAttribute("gameRotationYaw")).toFixed(3);
gameRotationTimestamp.value = boseARDeviceElement.getAttribute("gameRotationTimestamp");
});
boseARDeviceElement.addEventListener("singleTap", event => {
singleTapNotifications.innerText +=
"Gesture Type: " + "Single Tap" +
"\nTimestamp: " + boseARDeviceElement.getAttribute("singleTapTimestamp") + '\n\n';
});
boseARDeviceElement.addEventListener("doubleTap", event => {
doubleTapNotifications.innerText +=
"Gesture Type: " + "Double Tap" +
"\nTimestamp: " + boseARDeviceElement.getAttribute("doubleTapTimestamp") + '\n\n';
});
boseARDeviceElement.addEventListener("headNod", event => {
headNodNotifications.innerText +=
"Gesture Type: " + "Head Nod" +
"\nTimestamp: " + boseARDeviceElement.getAttribute("headNodTimestamp") + '\n\n';
});
boseARDeviceElement.addEventListener("headShake", event => {
headShakeNotifications.innerText +=
"Gesture Type: " + "Head Shake" +
"\nTimestamp: " + boseARDeviceElement.getAttribute("headShakeTimestamp") + '\n\n';
});
</script>
</body>
</html>