|
4 | 4 | <meta charset="UTF-8"> |
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | 6 | <title>T5M4R HUD</title> |
| 7 | + <script src="get-devices.js"></script> |
7 | 8 | </head> |
8 | 9 | <body> |
9 | 10 | <h1>T5M4R HUP App</h1> |
10 | | - <p>This document provides an overview of the T5M4R model, its architecture |
11 | | - and usage guidelines.</p> |
| 11 | + <p>Chrome advanced <a href="chrome://flags/#enable-web-bluetooth-new-permissions-backend">new permissions backend for Web Bluetooth</a> and <a href="chrome://flags/#enable-experimental-web-platform-features">Experimental Web Platform flag</a> are ENABLED.</p> |
12 | 12 | <h2>Model Overview</h2> |
| 13 | + |
| 14 | +<p> |
| 15 | + <button id="requestBluetoothDevice">Request Bluetooth Device</button> |
| 16 | +</p> |
| 17 | +<p> |
| 18 | + <select id="devicesSelect"></select> |
| 19 | + <button id="forgetBluetoothDevice">Forget Bluetooth Device</button> |
| 20 | +</p> |
| 21 | + |
| 22 | +<script> |
| 23 | + var ChromeSamples = { |
| 24 | + log: function() { |
| 25 | + var line = Array.prototype.slice.call(arguments).map(function(argument) { |
| 26 | + return typeof argument === 'string' ? argument : JSON.stringify(argument); |
| 27 | + }).join(' '); |
| 28 | + |
| 29 | + document.querySelector('#log').textContent += line + '\n'; |
| 30 | + }, |
| 31 | + |
| 32 | + clearLog: function() { |
| 33 | + document.querySelector('#log').textContent = ''; |
| 34 | + }, |
| 35 | + |
| 36 | + setStatus: function(status) { |
| 37 | + document.querySelector('#status').textContent = status; |
| 38 | + }, |
| 39 | + |
| 40 | + setContent: function(newContent) { |
| 41 | + var content = document.querySelector('#content'); |
| 42 | + while(content.hasChildNodes()) { |
| 43 | + content.removeChild(content.lastChild); |
| 44 | + } |
| 45 | + content.appendChild(newContent); |
| 46 | + } |
| 47 | + }; |
| 48 | +</script> |
| 49 | + |
| 50 | +<h3>Live Output</h3> |
| 51 | +<div id="output" class="output"> |
| 52 | + <div id="content">Output area</div> |
| 53 | + <div id="status"></div> |
| 54 | + <pre id="log"></pre> |
| 55 | +</div> |
| 56 | + |
| 57 | +<script> |
| 58 | + log = ChromeSamples.log; |
| 59 | + |
| 60 | + function isWebBluetoothEnabled() { |
| 61 | + if (navigator.bluetooth) { |
| 62 | + return true; |
| 63 | + } else { |
| 64 | + ChromeSamples.setStatus('Web Bluetooth API is not available.\n' + |
| 65 | + 'Please make sure the "Experimental Web Platform features" flag is enabled.'); |
| 66 | + return false; |
| 67 | + } |
| 68 | + } |
| 69 | +</script> |
| 70 | + |
| 71 | +<script> |
| 72 | + if (isWebBluetoothEnabled()) { |
| 73 | + document.querySelector('#requestBluetoothDevice').addEventListener('click', function() { |
| 74 | + onRequestBluetoothDeviceButtonClick(); |
| 75 | + }); |
| 76 | + document.querySelector('#forgetBluetoothDevice').addEventListener('click', function() { |
| 77 | + onForgetBluetoothDeviceButtonClick(); |
| 78 | + }); |
| 79 | + } |
| 80 | +</script> |
13 | 81 | </body> |
0 commit comments