”2016-08-26”

This commit is contained in:
Martin Donnelly 2016-08-26 16:45:03 +01:00
parent 86f9e3cc83
commit 2dc5403e04
14 changed files with 1154 additions and 38 deletions

View File

@ -14,14 +14,14 @@ var bodyparser = require('body-parser');
var errorhandler = require('errorhandler');
var log4js = require('log4js');
var logger = log4js.getLogger();
var authentication = require('basic-authentication');
var WebSocketServer = require('websocket').server;
var EventEmitter = require('events');
var busEmitter = new EventEmitter();
// var apn = require('apn');
// Var apn = require('apn');
require('sugar-date');
@ -42,6 +42,13 @@ logger.warn('isProduction:', isProduction);
var app = express();
/*App.use(authentication(({
hash: 'sha1', // type of hash
file: 'htpasswd', // path of file
suppress: true // suppress throwing Error if wrong user
})));*/
app.set('port', process.env.PORT || 4545);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
@ -79,8 +86,19 @@ function originIsAllowed(origin) {
// Put logic here to detect whether the specified origin is allowed.
return true;
}
app.get('/graph', authentication(({
hash: 'sha1', // Type of hash
file: 'htpasswd', // Path of file
suppress: true // Suppress throwing Error if wrong user
})), function(req, res) {
res.render('test',{delimiter: '^'});
});
// glue routes
app.get('/meeting', function(req, res) {
res.render('meeting',{delimiter: '^'});
});
// Glue routes
mdotApi(app);
mdotApiV2(app);
trackApi(app);
@ -98,6 +116,10 @@ if (isProduction) {
var port = (process.env.VCAP_APP_PORT || 3010);
var host = (process.env.VCAP_APP_HOST || 'localhost');
app.get('*', function(req, res) {
res.status(404).render('404',{delimiter: '^'});
});
app.listen(port, function() {
logger.info('Express listening on ',host, port);

View File

@ -46,10 +46,10 @@
/*
Get a branch from the date tree and see if the reduced set of records has a matching timestamp..
*/
let count = 0;
const tsDate = new Date(ts);
const tsMS = tsDate.getTime();
const branch = this.dateTree[tsDate.getFullYear().toString()][tsDate.getMonth().toString()][tsDate.getDate().toString()];
var count = 0;
var tsDate = new Date(ts);
var tsMS = tsDate.getTime();
var branch = this.dateTree[tsDate.getFullYear().toString()][tsDate.getMonth().toString()][tsDate.getDate().toString()];
if (typeof branch === 'undefined') {
return count;
@ -69,9 +69,9 @@
*/
var _tree = {};
_(occupancy).each(function(item) {
const newItem = item;
let day, month,year;
const _date = new Date(item.start);
var newItem = item;
var day, month,year;
var _date = new Date(item.start);
newItem.startMS = new Date(item.start).getTime();
newItem.endMS = new Date(item.end).getTime();
@ -125,7 +125,7 @@
}
_(events.data).each(function(i) {
let _occupancy = 0;
var _occupancy = 0;
if (!skipOccupancy) {
_occupancy = this.findOccupancy(i.timestamp, events.occupancy);
@ -153,8 +153,8 @@
var _obj = {};
var _data = window.atob(data).split('');
var bytes = _data.map(i => i.charCodeAt());
//var bytes = _data.map(i => i.charCodeAt());
/*
_obj.light = parseInt('0x' + ('0' + bytes[0]).substr(-2) + ('0' + bytes[1]).substr(
-2));
_obj.co2 = parseInt(_data[2] + _data[3] + _data[4] + _data[5] + _data[6],
@ -165,7 +165,7 @@
10) / 10);
_obj.noise = parseInt('0x' + ('0' + bytes[17]).substr(-2) + ('0' + bytes[18]).substr(
-2));
_obj.binData = bytes;
_obj.binData = bytes;*/
return _obj;
}, dateTime: function($date) {
var dateTime = new Date.create($date);

View File

@ -0,0 +1,2 @@
martind2000:ae7dfe3f3ba4d1132f8c7d7e5a2d05676127458a8842b9c28cea7662ad45393c
censis:32e3248f334f9045106a86f561a4c9741c1e4f51

View File

@ -35,7 +35,6 @@ module.exports = function(app) {
dbMdot.doGet(data)
.then((d) => {
logger.debug('returning:',d.occupancy);
res.json({events:d});
})
.catch((e) => {

View File

@ -29,7 +29,7 @@ function insertEntry(obj) {
newObj.rtype = 1;
logger.debug('Inserting into couch...');
// logger.info(util.inspect(newObj));
// Logger.info(util.inspect(newObj));
dbCouch.insert(newObj, function(err, body, header) {
if (err) {
logger.error('Error inserting into couch');
@ -42,7 +42,7 @@ function insertEntry(obj) {
var doInsertEntry = (obj) => {
// Logger.info('sendSocket: ' + JSON.stringify(obj));
// insertEntry(obj);
// insertEntry(obj);
dbSave.addNewEvent(obj)
.then(function(d) {
@ -75,9 +75,9 @@ var mqttClient = function() {
var address = '.messaging.internetofthings.ibmcloud.com';
var appKey = '9txJEf3Cjy7hkSOvkv';
var prefix = 'iot-2/type/mDot/id/';
//var deviceId = ['CENSIS-LoRa-1','CENSIS-LoRa-2','CENSIS-LoRa-3','CENSIS-LoRa-4','HIE-mobile-1','HIE-mobile-2','HIE-smart-campus-1','HIE-smart-campus-2','HIE-smart-campus-3','HIE-smart-campus-4','HIE-smart-campus-5','HIE-smart-campus-6','HIE-smart-campus-7','HIE-mDot-1'];
//Var deviceId = ['CENSIS-LoRa-1','CENSIS-LoRa-2','CENSIS-LoRa-3','CENSIS-LoRa-4','HIE-mobile-1','HIE-mobile-2','HIE-smart-campus-1','HIE-smart-campus-2','HIE-smart-campus-3','HIE-smart-campus-4','HIE-smart-campus-5','HIE-smart-campus-6','HIE-smart-campus-7','HIE-mDot-1'];
var deviceId = ['CENSIS-LoRa-1','CENSIS-LoRa-2','CENSIS-LoRa-3','CENSIS-LoRa-4','HIE-mobile-1----','HIE-mobile-2----','HIE-smart-campus-1','HIE-smart-campus-2','HIE-smart-campus-3','HIE-smart-campus-4','HIE-smart-campus-5','HIE-smart-campus-6','HIE-smart-campus-7','HIE-mDot-1'];
var deviceId = ['CENSIS-LoRa-1','CENSIS-LoRa-2','CENSIS-LoRa-3','CENSIS-LoRa-4','HIE-mobile-1----','HIE-mobile-2----','HIE-smart-campus-1','HIE-smart-campus-2','HIE-smart-campus-3','HIE-smart-campus-4','HIE-smart-campus-5','HIE-smart-campus-6','HIE-smart-campus-7','HIE-mDot-1'];
//Var subscribeTopic = prefix + deviceId + '/evt/+/fmt/json';
@ -86,10 +86,12 @@ var mqttClient = function() {
this.connected = false;
var options = {
keepalive: 3600,
keepalive: 10,
clientId: 'a:' + orgId + ':' + Date.now(),
username: userName,
password: new Buffer(appKey)
password: new Buffer(appKey),
reconnectPeriod: 1000,
connectTimeout: 30 * 1000
};
@ -115,31 +117,44 @@ var mqttClient = function() {
var json = JSON.parse(message.toString());
json.topic = topic;
// logger.debug(JSON.stringify(json));
// Logger.debug(JSON.stringify(json));
busEmitter.emit('saveData', json);
}.bind(this));
this.client.on('connected', function() {
logger.debug('mqttConnect - doConnection - Connected');
});
this.client.on('close', function(e) {
logger.error('mqttConnect - close');
logger.error(e);
});
this.client.on('offline', function(e) {
logger.error('mqttConnect - offline');
logger.error(e);
});
this.client.on('error', function(e) {
logger.error('mqttConnect - error');
logger.error(e);
});
this.client.on('reconnect', function(e) {
logger.error('mqttConnect - reconnect');
logger.error(e);
});
this.isConnected = function() {
return this.connected;
};
this.client.on('connected', function() {
logger.debug('mqttConnect - doConnection - Connected');
});
this.client.on('disconnect', function(e) {
logger.error('mqttConnect - doConnection - disconnect');
logger.error(e);
});
this.client.on('error', function(e) {
logger.error('mqttConnect - doConnection - disconnect');
logger.error(e);
});
busEmitter.on('saveData', doInsertEntry);

View File

@ -1,8 +1,9 @@
applications:
- path: .
memory: 256M
framework: node
instances: 1
domain: mybluemix.net
name: mdotmqtt
host: mdotmqtt
name: mdotserver
host: mdotserver
disk_quota: 1024M

View File

@ -0,0 +1,125 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/amstock.js"></script>
<link rel="stylesheet"
href="https://www.amcharts.com/lib/3/plugins/export/export.css"
type="text/css" media="all"/>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<script src="js/staticdata.js"></script>
</head>
<body>
<div id="chartdiv" style="width: 100%; height: 700px;"></div>
<script>
var chart = new AmCharts.AmStockChart();
chart.pathToImages = "lib/images/";
chart.dataDateFormat = 'YYYY-MM-DDTHH:NN:SS.QQQ';
var categoryAxesSettings = new AmCharts.CategoryAxesSettings();
categoryAxesSettings.minPeriod = '5mm';
categoryAxesSettings.parseDates = true;
categoryAxesSettings.axisColor = 'rgba(255,255,255,0.8)';
categoryAxesSettings.minorGridEnabled = true;
categoryAxesSettings.gridColor = '#556374';
categoryAxesSettings.maxSeries = 0;
chart.categoryAxesSettings = categoryAxesSettings;
var dataSetLux = new AmCharts.DataSet();
dataSetLux.title = "Lux";
dataSetLux.fieldMappings = [
{
fromField: "lux", toField: "value"
}, {
fromField: "co2", toField: "co2"
}, {
fromField: "humid", toField: "humid"
}, {
fromField: "temp", toField: "temp"
}
];
dataSetLux.dataProvider = chartData;
dataSetLux.categoryField = "date";
// set data sets to the chart
chart.dataSets = [dataSetLux];
var stockPanel1 = new AmCharts.StockPanel();
stockPanel1.showCategoryAxis = false;
stockPanel1.title = "Sensor Readings";
stockPanel1.percentHeight = 60;
// LUX
var valueAxisLux = new AmCharts.ValueAxis();
stockPanel1.addValueAxis(valueAxisLux);
var valueAxis2 = new AmCharts.ValueAxis();
valueAxis2.position = "right";
stockPanel1.addValueAxis(valueAxis2);
var valueAxis3 = new AmCharts.ValueAxis();
valueAxis3.offset = '-50';
stockPanel1.addValueAxis(valueAxis3);
var valueAxis4 = new AmCharts.ValueAxis();
valueAxis4.position = "right";
stockPanel1.addValueAxis(valueAxis4);
var graphLux = new AmCharts.StockGraph();
graphLux.title = "Light";
graphLux.valueField = "value";
graphLux.lineThickness = 1;
graphLux.lineColor = "#00cc00";
graphLux.useDataSetColors = false;
graphLux.stackable = false;
stockPanel1.addStockGraph(graphLux);
// CO2
var graph2 = new AmCharts.StockGraph();
graph2.title = "Co2";
graph2.valueField = "co2";
// graph2.type = "column";
graph2.showBalloon = false;
graph2.valueAxis = valueAxis2;
stockPanel1.addStockGraph(graph2);
var graph3 = new AmCharts.StockGraph();
graph3.title = "Humidity";
graph3.valueField = "humid";
graph3.lineThickness = 1;
graph3.lineColor = "#ffcc00";
graph3.useDataSetColors = false;
graph3.stackable = false;
graph3.valueAxis = valueAxis3;
stockPanel1.addStockGraph(graph3);
var graph4 = new AmCharts.StockGraph();
graph4.title = "Temp";
graph4.valueField = "temp";
graph4.lineColor = "#00ffcc";
// graph2.type = "column";
graph4.showBalloon = false;
graph4.valueAxis = valueAxis4;
stockPanel1.addStockGraph(graph4);
stockPanel1.stockLegend = new AmCharts.StockLegend();
chart.panels = [stockPanel1];
chart.write('chartdiv');
</script>
</body>
</html>

View File

@ -0,0 +1,318 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Console</title>
<!-- build:fonts -->
<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700"
type="text/css">
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Condensed'
rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<!-- endbuild -->
<!-- build:css -->
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<link href="css/app.css" rel="stylesheet" type="text/css"/>
<!-- endbuild -->
<link rel="apple-touch-icon" sizes="57x57"
href="/fav/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60"
href="/fav/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72"
href="/fav/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76"
href="/fav/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114"
href="/fav/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120"
href="/fav/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144"
href="/fav/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152"
href="/fav/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180"
href="/fav/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/fav/android-chrome-192x192.png"
sizes="192x192">
<link rel="icon" type="image/png" href="/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/fav/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/fav/manifest.json">
<link rel="mask-icon" href="/fav/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/fav/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="/fav/mstile-144x144.png">
<meta name="msapplication-config" content="/fav/browserconfig.xml">
<meta name="theme-color" content="#00aeef">
</head>
<body class="mui--no-user-select">
<div id="iosTaskbar" style="height:25px;display:none;"></div>
<div class="mui-container">
<div class="mui-panel" style="display: ;">
<div class="mui-row mui--text-center">
<img src="gfx/censis_logo_white.png">
</div>
</div>
<div class="mui-panel" id="noSocket" style="display: none;">
<div class="mui-row">
<div
class="mui--text-body2 mui--text-center noConnection">Lost connection to server. Waiting for connection
</div>
<div id='longWait' class="spinner" style="display: none;">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</div>
</div>
<div class="mui-panel" id="noDevice" style="display: none;">
<div class="mui-row">
<div
class="mui--text-body2 mui--text-center noConnection">We are having problems connecting to one or more of the devices. Please restart them and wait for them to reconnect.
</div>
</div>
</div>
<div class="mui-panel" id="clock">
<div class="mui-row">
<div class="mui-col-xs-4 ">
<div id="time" class="mui--text-center time">12:34</div>
</div>
<div class="mui-col-xs-4 item_content">
<div id="date" class="mui--text-center date">14 April<br>2016</div>
</div>
<div class="mui-col-xs-4 item_content">
<div id="weather" class="mui--text-center date">
<div id="weatherIcon">
<canvas id="icon1" width="210" height="210"
style="max-width: 70px; max-height:70px"></canvas>
</div>
<div class="mui--text-center" id="weatherText"></div>
</div>
</div>
</div>
</div>
<div class="mui-panel" id="extender" style="display: none;">
<div class="mui-row">
<div class="mui-col-xs-12 mui--text-center">
<div class="mui--text-title ">
Extend meeting
</div>
</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-12 mui--text-center">
<button id="extend05" class="mui-btn mui-btn--fab">5</button>
<button id="extend10" class="mui-btn mui-btn--fab">10</button>
<button id="extend15" class="mui-btn mui-btn--fab">15</button>
<button id="extend30" class="mui-btn mui-btn--fab">30</button>
</div>
</div>
</div>
<div class="mui-panel" id="calendar" style="display: none;">
<div class="mui-row">
<div class="mui-col-xs-4 mui--text-center"><span
class="material-icons md-100">&#xE616;</span></div>
<div class="mui-col-xs-8 item_content">
<div class="mui-row ">
<div class="mui--text-title "><a class='title'
href="#">Meeting room</a>
</div>
</div>
<div class="mui-row">
<div id="caltext"></div>
<div id="extendInfo" class="mui--text-subhead mui--text-accent"></div>
</div>
</div>
</div>
</div>
<div id="front-light" class="md-display">
<div class="mui-panel">
<div class="mui-row">
<div class="mui-col-xs-4 mui--text-center"><span
class="material-icons md-100">&#xE90F;</span></div>
<div class="mui-col-xs-4 item_content">
<div class="mui-row mui--text-center">
<div class="mui--text-title mui--text-center"><a class='title'
href="#">Front light</a>
</div>
</div>
<div class="mui-row mui--text-center">
<button id="frontLightOn" class="mui-btn mui-btn--primary lightOn">On
</button>
<button id="frontLightOff" class="mui-btn mui-btn--danger lightOff"
style="display: none;">Off
</button>
</div>
</div>
<div class="mui-col-xs-4 mui--text-center" id="auxFront"
style="display:none;">
<div>
<button class="mui-btn mui-btn--small mui-btn--accent lightUp"
id="frontUp">BRIGHTER
</button>
</div>
<div>
<button class="mui-btn mui-btn--small mui-btn--accent lightDown"
id="frontDown">DARKER
</button>
</div>
</div>
</div>
</div>
</div>
<!--<div class="mui-panel" id="middle-light">
<div class="mui-row">
<div class="mui-col-xs-4 mui&#45;&#45;text-center"><i class="material-icons md-100">&#xE90F;</i></div>
<div class="mui-col-xs-4 item_content">
<div class="mui-row">
<div class="mui&#45;&#45;text-title mui&#45;&#45;text-center"><a class='title'
href="#">Middle light</a>
</div>
</div>
<div class="mui-row mui&#45;&#45;text-center">
<button id="middleLightOn"
class="mui-btn mui-btn&#45;&#45;primary">On
</button>
<button id="middleLightOff" class="mui-btn mui-btn&#45;&#45;danger"
style="display: none;">Off
</button>
</div>
</div>
</div>
</div>-->
<div class="mui-panel" id="back-light">
<div class="mui-row">
<div class="mui-col-xs-4 mui--text-center"><i
class="material-icons md-100">&#xE90F;</i></div>
<div class="mui-col-xs-4 item_content">
<div class="mui-row">
<div class="mui--text-title mui--text-center"><a class='title'
href="#">Back light</a>
</div>
</div>
<div class="mui-row mui--text-center">
<button id="backLightOn" class="mui-btn mui-btn--primary lightOn">On
</button>
<button id="backLightOff" class="mui-btn mui-btn--danger lightOff"
style="display: none;">Off
</button>
</div>
</div>
<div class="mui-col-xs-4 mui--text-center" id="auxBack"
style="display: none;">
<div>
<button class="mui-btn mui-btn--small mui-btn--accent lightUp"
id="backUp">BRIGHTER
</button>
</div>
<div>
<button class="mui-btn mui-btn--small mui-btn--accent lightDown"
id="backDown">DARKER
</button>
</div>
</div>
</div>
</div>
<div class="mui-panel" id="heating-panel" style="display: none ;">
<div class="mui-row">
<div class="mui-col-xs-4 mui--text-center"><i
class="material-icons md-100">&#xE332;</i>
</div>
<div class="mui-col-xs-4 item_content">
<div class="mui-row">
<div class="mui--text-title mui--text-center"><a class='title'
href="#">Fan</a>
</div>
</div>
<div class="mui-row mui--text-center">
<button id="heatingOn" class="mui-btn mui-btn--primary">On
</button>
<button id="heatingOff" class="mui-btn mui-btn--danger"
style="display: none;">Off
</button>
</div>
</div>
<div class="mui-col-xs-4 mui--text-center">
<div id="curTemp" class="temp"></div>
</div>
</div>
</div>
<div class="mui-panel" id="projector-panel" style="display:;">
<div class="mui-row">
<div class="mui-col-xs-4 mui--text-center"><i
class="material-icons md-100">&#xE307;</i></div>
<div class="mui-col-xs-4 item_content">
<div class="mui-row">
<div class="mui--text-title mui--text-center"><a class='title'
href="#">Projector</a>
</div>
</div>
<div class="mui-row mui--text-center">
<button id="projectorOn" class="mui-btn mui-btn--primary">On
</button>
<button id="projectorOff" class="mui-btn mui-btn--danger"
style="display: none;">Off
</button>
</div>
</div>
<div class="mui-col-xs-4 mui--text-center" id="auxProjector"
style="display:none;">
<div>
<button class="mui-btn mui-btn--small mui-btn--accent"
id="projectorHDMI">HDMI
</button>
</div>
<div>
<button class="mui-btn mui-btn--small mui-btn--accent"
id="projectorVGA">VGA
</button>
</div>
</div>
</div>
</div>
<!--<div class="mui-panel">
<div class="mui-row">
<div class="mui-col-md-3"><span id="lightR">-&#45;&#45;</span></div>
<div class="mui-col-md-3"><span id="lightG">-&#45;&#45;</span></div>
<div class="mui-col-md-3"><span id="lightB">-&#45;&#45;</span></div>
<div class="mui-col-md-3"><span id="lightW">-&#45;&#45;</span></div>
</div>
<div class="mui-row">
<div class="mui-col-md-3"><span id="projR">-&#45;&#45;</span></div>
<div class="mui-col-md-3"><span id="projG">-&#45;&#45;</span></div>
<div class="mui-col-md-3"><span id="projB">-&#45;&#45;</span></div>
<div class="mui-col-md-3"><span id="projW">-&#45;&#45;</span></div>
</div>
</div>-->
</div>
<script src="cordova.js"></script>
<!-- build:vendor -->
<script src="lib/mui.js"></script>
<script src="lib/jquery.js"
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
crossorigin="anonymous"></script>
<script src="lib/chroma.js"></script>
<script src="lib/underscore.js"></script>
<script src="lib/backbone.js"></script>
<!--<script src="lib/sugar-date.js"></script>-->
<script src="lib/sugar-full.min.js"></script>
<script src="lib/skycons.js"></script>
<script src="lib/microevent.js"></script>
<!-- endbuild -->
<!-- build:js -->
<script src="js/sowebsocket.js"></script>
<script src="js/colours.js"></script>
<script src="js/parts/clock.js"></script>
<script src="js/parts/meetings.js"></script>
<script src="js/parts/lights.js"></script>
<script src="js/parts/projector.js"></script>
<script src="js/appv3.js"></script>
</body>
<!-- endbuild -->
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<title>Meetings</title>
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<link href="css/notification.css" rel="stylesheet" type="text/css"/>
<script src="lib/mui.js"></script>
</head>
<body>
<div class="mui-container">
<div class='mui-row'>
<div class="mui-panel">
<div class="mui--text-title">Meeting Log</div>
</div>
</div>
<div class='mui-row'>
<div class="mui-panel">
<form id="meetingForm">
<legend>New Meeting</legend>
<div class="mui-select">
<select id="device" name="device" required>
<option></option>
<option value="1">
Large Meeting Room
</option>
<option value="2">
Small Meeting Room
</option>
<option value="3">
Lab
</option>
</select> <label>Room</label>
</div>
<div class="mui-row">
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="date" placeholder="" id='from' name="from" required/>
<label>Day</label>
</div>
</div>
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="time" placeholder="" id='start' name="start" required/>
<label>Start</label>
</div>
</div>
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="time" placeholder="" id='end' name="end" required/>
<label>End</label>
</div>
</div>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="number" value="0" id="occupancy" required/> <label>Occupants</label>
</div>
<button type="submit" class="mui-btn mui-btn--raised">Submit</button>
</form>
</div>
</div>
</div>
<script src="lib/jquery.js"
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
crossorigin="anonymous"></script>
<script src="lib/underscore.js"></script>
<script src="lib/backbone.js"></script>
<script src="lib/sugar-date.js"></script>
<script src="lib/notification.js"></script>
<script src="js/meeting.js"></script>
</body>
</html>

View File

@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Graph</title>
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<!-- build:css -->
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<link href="css/test.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/notification.css">
<!-- endbuild -->
<link rel="apple-touch-icon" sizes="57x57"
href="/fav/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60"
href="/fav/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72"
href="/fav/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76"
href="/fav/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114"
href="/fav/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120"
href="/fav/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144"
href="/fav/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152"
href="/fav/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180"
href="/fav/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/fav/android-chrome-192x192.png"
sizes="192x192">
<link rel="icon" type="image/png" href="/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/fav/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/fav/manifest.json">
<link rel="mask-icon" href="/fav/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/fav/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="/fav/mstile-144x144.png">
<meta name="msapplication-config" content="/fav/browserconfig.xml">
<meta name="theme-color" content="#00aeef">
</head>
<body style="background-color:#171d25" class="mui--no-user-select">
<div class="mui-container">
<div class='mui-row'>
<div class="mui-col-md-3 panel">
<div class='mui-panel' id="main"></div>
<div id="output"></div>
</div>
<div class="mui-col-md-9">
<div class="mui-container">
<div id="chartdiv" style="width:100%; height:600px;"></div>
</div>
</div>
</div>
<script type="text/template" id="loaded-template">
<div
style="background-color: darkred;color: white;font-weight: 900;text-align: center">Loaded
</div>
</script>
<script type="text/template" id="main-template">
<div class="mui-container">
<div class="mui-row">
<div class="mui-select">
<select id="device" name="device">
<option></option>
<option>
HIE-mobile-1
</option>
<option>
HIE-demo
</option>
<option>
HIE-mobile-2
</option>
<option>
HIE-smart-campus-1
</option>
<option>
HIE-smart-campus-2
</option>
<option>
HIE-smart-campus-3
</option>
<option>
HIE-smart-campus-4
</option>
<option>
HIE-smart-campus-5
</option>
<option>
HIE-smart-campus-6
</option>
<option>
HIE-smart-campus-7
</option>
<option>
CENSIS-LoRa-1
</option>
<option>
CENSIS-LoRa-2
</option>
<option>
CENSIS-LoRa-3
</option>
<option>
CENSIS-LoRa-4
</option>
<option>
HIE-mDot-1
</option>
</select> <label>Device</label>
</div>
</div>
</div>
<div class="mui-row">
<div class="mui-col-md-12">
<button id='refresh'
class="mui-btn mui-btn--small mui-btn--primary">Refresh
</button>
</div>
</div>
</script>
<script type="text/template" id="list-template">
<ul></ul>
</script>
<script type="text/template" id="item-template">
<div class="mui-row">
<div class="mui-col-md-2"><%= item.timestamp %></div>
<div class="mui-col-md-2"><%= item.lux %></div>
<div class="mui-col-md-2"><%= item.co2 %></div>
<div class="mui-col-md-2"><%= item.temp %></div>
<div class="mui-col-md-2"><%= item.humidity %></div>
<div class="mui-col-md-2"><%= item.sound %></div>
</div>
</script>
<script type="text/template" id="AMChart-template">
<div class="mui-container">
<div class="mui-row">
<div class="mui-select mui-col-md-12">
<select id="displaymode" name="displaymode">
<option value="0"></option>
<option value="1">
Light
</option>
<option value="2">
Temp
</option>
<option value="3">
Co2
</option>
<option value="4">
Humidity
</option>
<option value="5">
Noise
</option>
<option value="6">
Light & Co2
</option>
<option value="7">
Temperature & Humidity
</option>
</select> <label>Graph</label>
</div>
</div>
</div>
</script>
<script type="text/template" id="graph-template">
<div class="mui-container">
<div class="mui-row">
<div class="mui-select mui-col-md-6">
<select id="displaymode" name="displaymode">
<option value="0"></option>
<option value="1">
Light
</option>
<option value="2">
Temp
</option>
<option value="3">
Co2
</option>
<option value="4">
Humidity
</option>
<option value="5">
Noise
</option>
</select> <label>Graph</label>
</div>
<div class="mui-col-md-6">
<svg id="graphSVG" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="maxY" x="36" y="15" text-anchor="end">--</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="MinY" x="36" y="139" text-anchor="end">0</text>
<polyline id="line" fill="none" stroke="#2196F3" text-anchor="end"
stroke-width="1" points=""></polyline>
<g id="datapoints"></g>
<g id="baseline"></g>
</svg>
</div>
</div>
</div>
</script>
<!-- build:vendor -->
<script src="lib/mui.js"></script>
<script src="lib/notification.js"></script>
<script src="lib/jquery.js"
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
crossorigin="anonymous"></script>
<script src="lib/base64.js"></script>
<script src="lib/underscore.js"></script>
<script src="lib/backbone.js"></script>
<script src="lib/sugar-date.js"></script>
<script src="lib/notification.js"></script>
<script src="lib/amcharts.js"></script>
<script src="lib/serial.js"></script>
<script src="lib/amstock.js"></script>
<!-- endbuild -->
<!-- build:js -->
<script src="js/mdot.js"></script>
<!-- endbuild -->
</body>
</html>

View File

@ -8,6 +8,7 @@
},
"dependencies": {
"atob": "^2.0.3",
"basic-authentication": "^1.6.2",
"body-parser": "^1.15.1",
"btoa": "^1.1.2",
"cfenv": "1.0.x",

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>404</title>
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="mui-container">
<div class="mui-panel">
<div class="mui--text-dark-secondary mui--text-display4">404</div>
<div class="mui--text-dark-secondary mui--text-display2">Not Found</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<title>Meetings</title>
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<link href="css/notification.css" rel="stylesheet" type="text/css"/>
<script src="lib/mui.js"></script>
</head>
<body>
<div class="mui-container">
<div class='mui-row'>
<div class="mui-panel">
<div class="mui--text-title">Meeting Log</div>
</div>
</div>
<div class='mui-row'>
<div class="mui-panel">
<form id="meetingForm">
<legend>New Meeting</legend>
<div class="mui-select">
<select id="device" name="device" required>
<option></option>
<option value="1">
Large Meeting Room
</option>
<option value="2">
Small Meeting Room
</option>
<option value="3">
Lab
</option>
</select> <label>Room</label>
</div>
<div class="mui-row">
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="date" placeholder="" id='from' name="from" required/>
<label>Day</label>
</div>
</div>
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="time" placeholder="" id='start' name="start" required/>
<label>Start</label>
</div>
</div>
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="time" placeholder="" id='end' name="end" required/>
<label>End</label>
</div>
</div>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="number" value="0" id="occupancy" required/> <label>Occupants</label>
</div>
<button type="submit" class="mui-btn mui-btn--raised">Submit</button>
</form>
</div>
</div>
</div>
<script src="lib/jquery.js"
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
crossorigin="anonymous"></script>
<script src="lib/underscore.js"></script>
<script src="lib/backbone.js"></script>
<script src="lib/sugar-date.js"></script>
<script src="lib/notification.js"></script>
<script src="js/meeting.js"></script>
</body>
</html>

View File

@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Graph</title>
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<!-- build:css -->
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<link href="css/test.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/notification.css">
<!-- endbuild -->
<link rel="apple-touch-icon" sizes="57x57"
href="/fav/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60"
href="/fav/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72"
href="/fav/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76"
href="/fav/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114"
href="/fav/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120"
href="/fav/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144"
href="/fav/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152"
href="/fav/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180"
href="/fav/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/fav/android-chrome-192x192.png"
sizes="192x192">
<link rel="icon" type="image/png" href="/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/fav/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/fav/manifest.json">
<link rel="mask-icon" href="/fav/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/fav/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="/fav/mstile-144x144.png">
<meta name="msapplication-config" content="/fav/browserconfig.xml">
<meta name="theme-color" content="#00aeef">
</head>
<body style="background-color:#171d25" class="mui--no-user-select">
<div class="mui-container">
<div class='mui-row'>
<div class="mui-col-md-3 panel">
<div class='mui-panel' id="main"></div>
<div id="output"></div>
</div>
<div class="mui-col-md-9">
<div class="mui-container">
<div id="chartdiv" style="width:100%; height:600px;"></div>
</div>
</div>
</div>
<script type="text/template" id="loaded-template">
<div
style="background-color: darkred;color: white;font-weight: 900;text-align: center">Loaded
</div>
</script>
<script type="text/template" id="main-template">
<div class="mui-container">
<div class="mui-row">
<div class="mui-select">
<select id="device" name="device">
<option></option>
<option>
HIE-mobile-1
</option>
<option>
HIE-demo
</option>
<option>
HIE-mobile-2
</option>
<option>
HIE-smart-campus-1
</option>
<option>
HIE-smart-campus-2
</option>
<option>
HIE-smart-campus-3
</option>
<option>
HIE-smart-campus-4
</option>
<option>
HIE-smart-campus-5
</option>
<option>
HIE-smart-campus-6
</option>
<option>
HIE-smart-campus-7
</option>
<option>
CENSIS-LoRa-1
</option>
<option>
CENSIS-LoRa-2
</option>
<option>
CENSIS-LoRa-3
</option>
<option>
CENSIS-LoRa-4
</option>
<option>
HIE-mDot-1
</option>
</select> <label>Device</label>
</div>
</div>
</div>
<div class="mui-row">
<div class="mui-col-md-12">
<button id='refresh'
class="mui-btn mui-btn--small mui-btn--primary">Refresh
</button>
</div>
</div>
</script>
<script type="text/template" id="list-template">
<ul></ul>
</script>
<script type="text/template" id="item-template">
<div class="mui-row">
<div class="mui-col-md-2"><%= item.timestamp %></div>
<div class="mui-col-md-2"><%= item.lux %></div>
<div class="mui-col-md-2"><%= item.co2 %></div>
<div class="mui-col-md-2"><%= item.temp %></div>
<div class="mui-col-md-2"><%= item.humidity %></div>
<div class="mui-col-md-2"><%= item.sound %></div>
</div>
</script>
<script type="text/template" id="AMChart-template">
<div class="mui-container">
<div class="mui-row">
<div class="mui-select mui-col-md-12">
<select id="displaymode" name="displaymode">
<option value="0"></option>
<option value="1">
Light
</option>
<option value="2">
Temp
</option>
<option value="3">
Co2
</option>
<option value="4">
Humidity
</option>
<option value="5">
Noise
</option>
<option value="6">
Light & Co2
</option>
<option value="7">
Temperature & Humidity
</option>
</select> <label>Graph</label>
</div>
</div>
</div>
</script>
<script type="text/template" id="graph-template">
<div class="mui-container">
<div class="mui-row">
<div class="mui-select mui-col-md-6">
<select id="displaymode" name="displaymode">
<option value="0"></option>
<option value="1">
Light
</option>
<option value="2">
Temp
</option>
<option value="3">
Co2
</option>
<option value="4">
Humidity
</option>
<option value="5">
Noise
</option>
</select> <label>Graph</label>
</div>
<div class="mui-col-md-6">
<svg id="graphSVG" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="maxY" x="36" y="15" text-anchor="end">--</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="MinY" x="36" y="139" text-anchor="end">0</text>
<polyline id="line" fill="none" stroke="#2196F3" text-anchor="end"
stroke-width="1" points=""></polyline>
<g id="datapoints"></g>
<g id="baseline"></g>
</svg>
</div>
</div>
</div>
</script>
<!-- build:vendor -->
<script src="lib/mui.js"></script>
<script src="lib/notification.js"></script>
<script src="lib/jquery.js"
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
crossorigin="anonymous"></script>
<script src="lib/base64.js"></script>
<script src="lib/underscore.js"></script>
<script src="lib/backbone.js"></script>
<script src="lib/sugar-date.js"></script>
<script src="lib/notification.js"></script>
<script src="lib/amcharts.js"></script>
<script src="lib/serial.js"></script>
<script src="lib/amstock.js"></script>
<!-- endbuild -->
<!-- build:js -->
<script src="js/mdot.js"></script>
<!-- endbuild -->
</body>
</html>