Skip to content

Instantly share code, notes, and snippets.

@scottgwald
Created March 24, 2014 18:48
Show Gist options
  • Save scottgwald/9746577 to your computer and use it in GitHub Desktop.
Save scottgwald/9746577 to your computer and use it in GitHub Desktop.
glassprov for kurt
<html>
<body>
<script>
var me;
function main() {
WS.serverConnect('ws://glassprov.media.mit.edu:8080/ws', function () {
// WS.say("Server connected yeah.");
console.log(WSRAW.getGlassID());
me = WSRAW.getGlassID();
console.log(me);
// setTimeout(function () {
if (me == "f8:8f:ca:25:06:bf") {
WS.say("It's me");
} else {
WS.say("It's not me!");
}
// }, 2000);
line_cb = function(chan, data) {
console.log("Got a lines object!");
console.log(JSON.stringify(data));
if (data.glassID == me) {
WS.wake();
WS.activityCreate();
WS.displayCardTree();
var tree = new WS.Cards();
tree.add(data.text, 'GlassProv');
WS.cardTree(tree);
//console.log("It's me! And the text is: " + data.text);
//WS.say(data.text);
} else {
console.log("It's not me. But the text is: " + data.text);
}
}
vid_cb = function(chan, data) {
console.log("Got a vids object!");
console.log(JSON.stringify(data));
if (data.glassID == me) {
WS.wake();
WS.activityCreate();
WS.displayCardTree();
var tree = new WS.Cards();
tree.add(data.url, 'GlassProv');
WS.cardTree(tree);
//console.log("It's me! And the text is: " + data.text);
//WS.say(data.text);
} else {
console.log("It's not me. But the text is: " + data.url);
}
}
WS.subscribe('lines:' + me, line_cb);
WS.subscribe('lines', line_cb);
WS.subscribe('videos:' + me, vid_cb );
});
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment