Skip to content

Instantly share code, notes, and snippets.

@bwhite
Created April 18, 2014 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwhite/11063161 to your computer and use it in GitHub Desktop.
Save bwhite/11063161 to your computer and use it in GitHub Desktop.
[wearscript] Bluetooth Bonding
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
tree = new WS.Cards();
WS.displayCardTree();
WS.bluetoothList(function (x) {
WS.log(JSON.stringify(x));
});
WS.bluetoothDiscover(function (data) {
WS.log(data);
tree.add(data.name, data.address, undefined, function () {
WS.say('bonding');
WS.bluetoothBond(data.address, "1234");
});
WS.cardTree(tree);
});
}
window.onload = main;
</script>
</body>
</html>
{"name":"Bluetooth Bonding"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment