Add initial web pages and code for presentation

This commit is contained in:
Michael Pivato
2019-01-14 12:26:16 +10:30
parent 137be4f25f
commit 60d710a6c6
3 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<header>
<script src="js/bootstrap.min.js"></script>
<script src="js/paho.javascript-1.0.3/paho-mqtt-min.js"></script>
<script src="js/msgpack.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/index.css" />
</header>
<body>
<div class="container">
<div class="row">
<div class="col-sm-4 tall-button">
<button id="readyButton" class="big-button">Ready?</button>
</div>
<div class="col-sm-4 tall-button">
<button id="yesButton" class="big-button" style="display: none">YES!</button>
</div>
<div class="col-sm-4 tall-button">
<button id="noButton" class="big-button" style="display: none">no :`(</button>
</div>
</div>
</div>
<script src="js/areyousatisfied.js"></script>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/index.css" />
</head>
<body>
<div class="container-fluid">
<h1>Michael's Demonstrations</h1>
<div class="row">
<!-- On a desktop these will be side-by-side, mobile is top-bottom. -->
<div class="col-sm-4 tall-button">
<a href="areyousatisfied.html"><button class="btn btn-primary big-button" style="color:white">Are you satisfied?</button></a>
</div>
<div class="col-sm-4 tall-button">
<a href="boring.html"><button class="btn btn-warning big-button" style="color:white">Ma Boring Solution</button></a>
</div>
<div class="col-sm-4 tall-button">
<a href="feta.html"><button class="btn btn-warning big-button" style="color:white">FETA</button></a>
</div>
</div>
</div>
</body>
</html>

View File

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