+
+
From 0246989bbbb6931fff9926ffdd3466288d3604df Mon Sep 17 00:00:00 2001 From: Tejus-D <47404489+Tejus-D@users.noreply.github.com> Date: Sat, 21 Sep 2019 20:43:18 +0530 Subject: [PATCH] Add files via upload --- io.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ kalpana.html | 50 ++++++++++++++++++++++++++++++++++++++++++++++ style.css | 22 +++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 io.js create mode 100644 kalpana.html create mode 100644 style.css diff --git a/io.js b/io.js new file mode 100644 index 0000000..2be0378 --- /dev/null +++ b/io.js @@ -0,0 +1,56 @@ +function scan() +{ + document.getElementsByClassName("tick")[0].style.display = 'block'; +} +var app = require('express')(); +var http = require('http').Server(app); +var io = require('socket.io')(http); + +io.on('connection', function(socket){ + console.log('connect'); + socket.on('scanData', function(data){ //scenario has been created + console.log('scanDataReceived',data); + io.emit('forwardScanData', data); //add the scenario to the world map + }); +}); + +http.listen(3000, function(){ + console.log('listening on *:3000'); +}); + +var serialport = require("serialport").SerialPort; +//var SerialPort = serialport.SerialPort; // localize object constructor +var portName = "";//portname + +var sp = new serialport(portName, { + //parser: serialport.parsers.readline("\n")r + parser: serialport.parsers.raw +}); + + +sp.open(function (error) { + if ( error ) { + console.log('failed to open: '+error); + } else { + console.log('open'); + sp.on('data', function(data) { + console.log('data received: ' + String(data)); + io.emit('scanData',String(data)); + }); + } +}); +app.get('/',function(req,res){ + res.redirect('/registration') +}); + +app.get('/registration',function(req,res){ + res.render("registration"); +}); + +app.get('/food',function(req,res){ + res.render("food"); +}); + +app.listen(8080,function(){ + console.log("Server Has Started"); +}) \ No newline at end of file diff --git a/kalpana.html b/kalpana.html new file mode 100644 index 0000000..1dfb202 --- /dev/null +++ b/kalpana.html @@ -0,0 +1,50 @@ + + + +
+