mirror of
https://github.com/thegecko/web-bluetooth-dfu.git
synced 2026-03-21 03:19:59 +08:00
Split mode and transfer actions
This commit is contained in:
13
index.html
13
index.html
@@ -4,8 +4,9 @@
|
||||
<title>web-bluetooth-dfu</title>
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="setMode()" style="font-size: 42px;">Set Mode and Transfer</button>
|
||||
<button onclick="findDFU()" style="font-size: 42px;">Transfer Only</button>
|
||||
<button onclick="setMode()" style="font-size: 42px;">Set Mode</button>
|
||||
<button onclick="findDFU()" style="font-size: 42px;">Transfer</button>
|
||||
<button onclick="both()" style="font-size: 42px;">Both</button>
|
||||
<div id="results"></div>
|
||||
|
||||
<script src="dist/dfu.js"></script>
|
||||
@@ -58,7 +59,6 @@
|
||||
function setMode() {
|
||||
dfu.findDevice({ services: [0x180D] })
|
||||
.then(device => dfu.writeMode(device))
|
||||
.then(device => transfer(device))
|
||||
.catch(log);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,13 @@
|
||||
.catch(log);
|
||||
}
|
||||
|
||||
function both() {
|
||||
dfu.findDevice({ services: [0x180D] })
|
||||
.then(device => dfu.writeMode(device))
|
||||
.then(device => transfer(device))
|
||||
.catch(log);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user