From 60d710a6c69e26171a1b6adfde465ee979e91006 Mon Sep 17 00:00:00 2001 From: Michael Pivato Date: Mon, 14 Jan 2019 12:26:16 +1030 Subject: [PATCH] Add initial web pages and code for presentation --- Web/areyousatisfied.html | 27 +++++++++++++++++++++++++++ Web/index.html | 27 +++++++++++++++++++++++++++ Web/js/areyousatisfied.js | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/Web/areyousatisfied.html b/Web/areyousatisfied.html index e69de29..a934ed5 100644 --- a/Web/areyousatisfied.html +++ b/Web/areyousatisfied.html @@ -0,0 +1,27 @@ + + + +
+ + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/Web/index.html b/Web/index.html index e69de29..ca032dd 100644 --- a/Web/index.html +++ b/Web/index.html @@ -0,0 +1,27 @@ + + + + + + + + + + +
+

Michael's Demonstrations

+ +
+ + \ No newline at end of file diff --git a/Web/js/areyousatisfied.js b/Web/js/areyousatisfied.js index e69de29..2916eed 100644 --- a/Web/js/areyousatisfied.js +++ b/Web/js/areyousatisfied.js @@ -0,0 +1,35 @@ +//var msgpack = require("msgpack-lite"); + +// Assuming paho mqtt library is included. +host = "172.16.13.128"; +client = new Paho.MQTT.Client(host, port=1884, "2343"); + +client.onMessageArrived = onMessage; +client.onConnectionLost = onConnectionLost; +client.connect({onSuccess: onConnect}); + +function onConnect(){ + alert("Client Connected"); + client.subscribe("Demo"); + var buffer = msgpack.encode({"message": "Hello"}); + message = new Paho.MQTT.Message(buffer); + message.destinationName = "Demo"; + + // // Can use publish or send here. + client.publish(message); +} + +function onConnectionLost(responseObject){ + if(responseObject.errorCode !== 0){ + console.log("onConnectionLost:" + responseObject.errorMessage); + } +} + +function onMessage(message){ + messageb = message.payloadBytes; + + if(message.payloadBytes = 1){ + // Sent checking ready command. + + } +} \ No newline at end of file