-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserial.html
107 lines (96 loc) · 3.21 KB
/
serial.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#0a0a0f" />
<title>Web Serial Console</title>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Chakra+Petch:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<!-- Custom styles -->
<link rel="stylesheet" href="css/serial.css" />
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MS2T2178R5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MS2T2178R5');
</script>
<body>
<div class="serial-container">
<div class="header">
<h1>Serial Console</h1>
<div class="status-bar">
<div class="status-indicator">
<div class="status-dot" id="connectionDot"></div>
<span id="connectionStatus">Disconnected</span>
</div>
<div class="status-indicator">
<span id="baudRate">Baud Rate: 115200</span>
</div>
</div>
</div>
<div class="console" id="console">
<div class="console-output" id="output"></div>
</div>
<div class="controls-container">
<div class="control-panel">
<button class="btn btn-primary" id="connectButton">Connect</button>
<button class="btn" id="clearButton">Clear Console</button>
<select class="btn" id="baudSelect">
<option value="9600">9600 baud</option>
<option value="115200" selected>115200 baud</option>
<option value="921600">921600 baud</option>
</select>
</div>
<div class="input-group">
<input
type="text"
class="serial-input"
id="serialInput"
placeholder="Type a command and press Enter..."
/>
<button class="btn" id="sendButton">Send</button>
</div>
</div>
</div>
<!-- Browser Support Dialog -->
<div class="dialog-overlay" id="browserDialog">
<div class="dialog">
<h2>Browser Not Supported</h2>
<p>
Web Serial API is only supported in Chromium-based browsers (Chrome,
Edge, Opera). Please use a supported browser to access this feature.
</p>
<button
class="btn btn-primary"
onclick="document.getElementById('browserDialog').style.display = 'none'"
>
Close
</button>
</div>
</div>
<!-- Permission Dialog -->
<div class="dialog-overlay" id="permissionDialog">
<div class="dialog">
<h2>Permission Required</h2>
<p>
Please select your device from the popup and click "Connect" to
establish a serial connection.
</p>
<button
class="btn btn-primary"
onclick="document.getElementById('permissionDialog').style.display = 'none'"
>
OK
</button>
</div>
</div>
<script src="js/serial.js"></script>
</body>
</html>