Skip to content

Commit 5b86b83

Browse files
authored
Update index.html
1 parent 1cb5092 commit 5b86b83

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

setup/index.html

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ <h5 class="mb-0">EchoKit server</h5>
215215
toast.show();
216216
}
217217

218-
// 连接设备
219218
async function connectToDevice() {
220219
try {
221220
// 请求蓝牙设备
@@ -224,24 +223,20 @@ <h5 class="mb-0">EchoKit server</h5>
224223
optionalServices: [SERVICE_ID]
225224
});
226225

227-
// 连接到GATT服务器
228226
server = await device.gatt.connect();
229227
service = await server.getPrimaryService(SERVICE_ID);
230228

231-
// 更新UI状态
232229
isConnected = true;
233230
updateConnectionStatus();
234231

235-
// 显示控制面板
236232
controlPanel.style.display = 'block';
237233
connectButton.innerHTML = '<i class="bi bi-bluetooth"></i> Disconnect';
238234

239-
// 设备断开连接时的处理
240235
device.addEventListener('gattserverdisconnected', handleDisconnection);
241236

242237
showNotification('Success', 'Connected to the device');
243238
} catch (error) {
244-
console.error('连接失败:', error);
239+
console.error('Failed to connect: ', error);
245240
showNotification('Error', 'Device connection failed: ' + error.message, true);
246241
}
247242
}
@@ -276,7 +271,7 @@ <h5 class="mb-0">EchoKit server</h5>
276271
if (isConnected) {
277272
statusIndicator.classList.remove('status-disconnected');
278273
statusIndicator.classList.add('status-connected');
279-
connectionStatus.textContent = '已连接';
274+
connectionStatus.textContent = 'Connected';
280275
} else {
281276
statusIndicator.classList.remove('status-connected');
282277
statusIndicator.classList.add('status-disconnected');
@@ -325,7 +320,7 @@ <h5 class="mb-0">EchoKit server</h5>
325320
const encoder = new TextEncoder();
326321
const data = encoder.encode(inputValue);
327322
await characteristic.writeValue(data);
328-
showNotification('成功', '写入数据成功');
323+
showNotification('Success', 'Value is written to the device');
329324
} catch (error) {
330325
console.error('Failed to write: ', error);
331326
showNotification('Error', 'Cannot write into the device: ' + error.message, true);

0 commit comments

Comments
 (0)