Commit 8e041efb authored by fionera's avatar fionera

Moved the Notifications into the AngularJS System

parent 129fae72
'use strict';
var gpower;
var laststate;
angular.module('roomstateapp.controllers', []).
controller('StatusCtrl', function ($scope, $http, Socket) {
......@@ -20,6 +21,7 @@ angular.module('roomstateapp.controllers', []).
Socket.on('sdata', function(message) {
console.log("received data from server: " + message.data.names);
stateNotification(message.data.state);
$scope.simple = message.data;
gpower.refresh(message.data.power);
});
......@@ -82,3 +84,15 @@ gpower = new JustGage({
});
});
function stateNotification(state) {
if (state == true && laststate != true && laststate != null) {
laststate = true;
showNotification("CTDO - Status", "Der Chaostreff ist nun offen.", "/img/green.png", 4);
} else if (state == false && laststate != false && laststate != null) {
laststate = false;
showNotification("CTDO - Staus", "Der Chaostreff ist nun geschlossen", "/img/red.png", 4);
} else {
laststate = state;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment