Split mode and transfer actions

This commit is contained in:
Rob Moran
2016-02-04 23:00:34 -06:00
parent 61386e3915
commit a8bad4f1ff

View File

@@ -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>