Created
June 7, 2014 15:38
-
-
Save lgleasain/5d5c68548a5aa46999b9 to your computer and use it in GitHub Desktop.
Cat Tracking For Wearscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html style="width:100%; height:100%; overflow:hidden"> | |
<head> | |
<!-- You can include external scripts here like so... --> | |
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>--> | |
</head> | |
<style> | |
body {background-color: black;} | |
.h1 {color:white; font-size: 100px; font-family: 'Roboto', sans-serif; font-weight: 100;} | |
</style> | |
<body style="width:640px; height:360px; overflow:hidden; margin:0"> | |
<div id="notes"> | |
<div class='h1' id='h1'>Starting Finder</div> | |
</div> | |
<script> | |
function server() { | |
WS.log('Welcome to WearScript'); | |
WS.beacon(rangeCallback, enterCallback, exitCallback); | |
WS.bluetoothList(btCallback, true); //do a BTLE scan | |
} | |
function rangeCallback(uuid, rssi, major, minor, proximity) { | |
WS.log(uuid + " @ " + rssi); | |
document.getElementById('h1').innerHTML=''; | |
} | |
function enterCallback(uuid, major, minor) { | |
WS.log("entered region: " + uuid); | |
document.getElementById('h1').innerHTML=''; | |
} | |
function exitCallback(uuid, major, minor) { | |
WS.log("exited region: " + uuid); | |
document.getElementById('h1').innerHTML='Escaped Cat!'; | |
} | |
function btCallback(device) { | |
//WS.log("scanned " + device); | |
} | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
WS.serverConnect('{{WSUrl}}', server); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment