diff --git a/app.js b/app.js index e0073d9..61df93b 100644 --- a/app.js +++ b/app.js @@ -9,43 +9,3 @@ handle["/"] = requestHandlers.sendInterface; handle["/interface"] = requestHandlers.sendInterface; server.start(router.route,handle,debug); - - - - -// old app.js -/* -console.log("hello world\r"); -var port = 3000; -var express = require('express') -var app = express() - -app.get('/', function (req, res) { - res.send('Hello World') -}); - -app.listen(port, function () { - console.log('Example app listening on port '+port+'!'); -}); - -var serialport = require("serialport"); -var SerialPort = serialport.SerialPort; -var serialPort = new SerialPort("/dev/tty.usbmodemFD121", { - baudrate: 19200, - parser: serialport.parsers.readline("\n") -}); - - -serialPort.on("open", function () { - console.log('open'); -serialPort.on("data", function (data) { - console.log("here: "+data); - - app.get('/', function (req, res) { - res.send(data) - }) -}); - -serialPort.write("AT+CPIN?\r"); -}); -*/ diff --git a/board.html b/board.html index 8dda5cd..6bb1b6e 100644 --- a/board.html +++ b/board.html @@ -49,23 +49,20 @@ { iosocket = io.connect(); iosocket.on('onconnection', function(value) { - pollOneH = value.pollOneValue/2; // recieve start poll value from server initButton(); - // recieve changed values by other client from server - iosocket.on('updateData', function(recievedData) { - pollOneH = recievedData.pollOneValue/2; // recieve start poll value from server + iosocket.on('debugMessage', function(message) { + alert(message); }); - iosocket.on('newMessage', function(message) { - var date = new Date(); - + iosocket.on('newMessage', function(number,message) { var mainTable = document.getElementById("mainTable"); var newRow = mainTable.insertRow(mainTable.rows.length); - var dateCell = newRow.insertCell(0); - var textCell = newRow.insertCell(1); - dateCell.innerHTML = date.toLocaleString(); + var numberCell = newRow.insertCell(1); + var textCell = newRow.insertCell(2); + dateCell.innerHTML = "Insert serverdate"; + numberCell.innerHTML = number; textCell.innerHTML = message; }); }); @@ -74,14 +71,17 @@ function initButton() { - $( "#check" ).button(); + $("#check").button(); } window.onload = function() { initSocketIO(); + iosocket.emit('getLastMessages',10); }; $(document).ready(function() { + //request last messages from server + $('#check').click(function() { toggleVal += 1; toggleVal %= 2; @@ -91,23 +91,19 @@
-Uhrzeit | Nachricht | +Uhrzeit | Nummer | Nachricht |
LED Dimmer
- -