Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions io.js
Original file line number Diff line number Diff line change
@@ -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");
})
50 changes: 50 additions & 0 deletions kalpana.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>

<html>
<head>
<title>Kalapana</title>
<link rel = "stylesheet" href = "style.css">
<meta charset="UTF-8">
<meta name = "description" content="Hackathon">
<meta name = "keywords" content = "IOT,ML,Python">
<meta name = "viewport" content = "width = device-width , initial-scale = 1.0">
</head>

<body>

<header>
<img src = "logo3.png" class = "dark">
</header>

<main>
<center><img src = "demo.png" class = "logo"></center>
<br>
<center><input type = "text" class = "out" placeholder="BARCODE"></center>
<br>
<center><input type="text" class="out" placeholder="DUMMY"></center>
<center><button class = "b" onclick="scan()">SCAN</button></center>
</main>

<footer>
<center><img class = "tick" src = "success.png"></center>
</footer>

<script src = "io.js">
var socket, socketData;
function init(){
initSockets();
}
function initSockets(){
// var io = require('socket.io')(http);
//socket = io.connect('http://localhost:5500');
socket.on('scanData',onScanData);
}
function onScanData(data){
socketData = data;
console.log('scanReceived',data);
}
init();</script>

</body>

</html>
22 changes: 22 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#barcodevideo, #barcodecanvas, #barcodecanvasg {
height: 400px;
}

#barcodecanvasg {
position: absolute;
top: 0px;
left: 0px;
}

#result {
font-family: verdana;
font-size: 1.5em;
}

#barcode {
position: relative;
}

#barcodecanvas {
display: none;
}