diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/app.js b/app.js old mode 100644 new mode 100755 index f4a9083..a74fd04 --- a/app.js +++ b/app.js @@ -99,7 +99,7 @@ function BOB_initConfig() { prebuilt : "", original : "" }, - footer : BOB_mod_path.resolve(__dirname, './public/img/footer', 'm-clotilde60.jpg') + footer : BOB_mod_path.resolve(__dirname, './public/img/footer', 'm-default.jpg') }; // Init PATH cfgConfig.paths.final = BOB_mod_path.resolve(__dirname, './public/img/final'); diff --git a/bin/www b/bin/www old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 28d18a5..0555102 --- a/package.json +++ b/package.json @@ -11,12 +11,13 @@ "cookie-parser": "~1.3.4", "debug": "~2.1.1", "ejs": "~2.3.1", + "es6-shim": "^0.35.0", "express": "~4.12.2", "gamepad": "^1.0.2", "gm": "~1.17.0", - "gphoto2": "~0.1.7", "mkdirp": "~0.5.0", "morgan": "~1.5.1", + "odroid-gpio": "0.0.2", "serve-favicon": "~2.2.0", "socket.io": "~1.3.5" } diff --git a/pm2.json b/pm2.json new file mode 100755 index 0000000..5e44853 --- /dev/null +++ b/pm2.json @@ -0,0 +1,12 @@ +{ + "apps" : [{ + "name" : "Bobinoscope", + "script" : "./bin/www", + "args" : [], + "cwd" : "/home/odroid/workspace/bobinoscope", + "env": { + "NODE_ENV": "production", + } + }] +} + diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css old mode 100644 new mode 100755 diff --git a/public/css/cover.css b/public/css/cover.css old mode 100644 new mode 100755 diff --git a/public/css/style.css b/public/css/style.css old mode 100644 new mode 100755 diff --git a/public/css/view.css b/public/css/view.css old mode 100644 new mode 100755 diff --git a/public/img/common/294.GIF b/public/img/common/294.GIF old mode 100644 new mode 100755 diff --git a/public/img/footer/cloclo.jpg b/public/img/footer/cloclo.jpg old mode 100644 new mode 100755 diff --git a/public/img/footer/m-cloclo.jpg b/public/img/footer/m-cloclo.jpg old mode 100644 new mode 100755 diff --git a/public/img/footer/m-cloclo.xcf b/public/img/footer/m-cloclo.xcf old mode 100644 new mode 100755 diff --git a/public/img/footer/m-clotilde60.jpg b/public/img/footer/m-clotilde60.jpg old mode 100644 new mode 100755 diff --git a/public/img/footer/m-clotilde60.xcf b/public/img/footer/m-clotilde60.xcf old mode 100644 new mode 100755 diff --git a/public/img/template/default.jpg b/public/img/template/default.jpg old mode 100644 new mode 100755 diff --git a/public/js/bootstrap.min.js b/public/js/bootstrap.min.js old mode 100644 new mode 100755 diff --git a/public/js/jquery-1.11.2.min.js b/public/js/jquery-1.11.2.min.js old mode 100644 new mode 100755 diff --git a/public/js/socket.io-1.3.4.js b/public/js/socket.io-1.3.4.js old mode 100644 new mode 100755 diff --git a/routes/index.js b/routes/index.js old mode 100644 new mode 100755 index 7d70136..2ad4ac9 --- a/routes/index.js +++ b/routes/index.js @@ -12,10 +12,10 @@ var BOB_tol_booth = null; var BOB_cfg_config = null; var BOB_var_boothInProgress = 0; -var BOB_var_gamepad = require("gamepad"); +//var BOB_var_gamepad = require("gamepad"); var BOB_var_ipAddress = '127.0.0.1'; -var BOB_var_path = "/home/cocoon/workspace/bobinoscope"; +var BOB_var_path = "/home/odroid/workspace/bobinoscope"; var BOB_var_killZone = { top : 2, @@ -85,6 +85,28 @@ BOB_mod_router.get('/print/list/todo', function(req, res, next) { }) }) +BOB_mod_router.get('/fixdate', function (req, res, next) { + res.render('fixdate', {serverIpAddress: BOB_var_ipAddress}); +}) + +BOB_mod_router.get('/fixdate/:timestamp', function(req, res, next) { + var spawn = require('child_process').spawn; + + var date = spawn('date', ['-s', '@'+(req.params.timestamp/1000)]); + + var error = ''; + + date.stdout.on('data', function(data) {console.log(data.toString())}); + + date.stderr.on('data', function(data) {error += data; console.log(data.toString())}); + + date.on('close', function(code) { + res.json({error : code !== 0 ? error : ''}) + }) +}) + + + function copyFile(source, target, cb) { var cbCalled = false; @@ -111,23 +133,46 @@ function copyFile(source, target, cb) { } +var gpio = require("odroid-gpio"); +var previous = 1; +gpio.open(7, "input pullup", function(err) { // Open pin 16 for output + console.log(err) + + setInterval(function() { + gpio.read(7, function(err, value) { + if(err) console.log(err); +// console.log(value); // The current state of the pini + if (value === 0 && value !== previous) { + console.log('click') + BOB_cfg_config.io.emit('boothClick', { + id : 0, + num : 0 + }); + } + previous = value; + }); + }, 200) +}); + + + // Initialize the library -BOB_var_gamepad.init() +//BOB_var_gamepad.init() // List the state of all currently attached devices -for (var i = 0, l = BOB_var_gamepad.numDevices(); i < l; i++) { - console.log(i, BOB_var_gamepad.deviceAtIndex(i)); -} +//for (var i = 0, l = BOB_var_gamepad.numDevices(); i < l; i++) { +// console.log(i, BOB_var_gamepad.deviceAtIndex(i)); +//} // Create a game loop and poll for events -setInterval(BOB_var_gamepad.processEvents, 16); +//setInterval(BOB_var_gamepad.processEvents, 16); // Scan for new gamepads as a slower rate -setInterval(BOB_var_gamepad.detectDevices, 500); +//setInterval(BOB_var_gamepad.detectDevices, 500); // Listen for button down events on all gamepads -BOB_var_gamepad.on("down", function (pId, pNum) { - BOB_cfg_config.io.emit('boothClick', { - id : pId, - num : pNum - }); -}) +//BOB_var_gamepad.on("down", function (pId, pNum) { +// BOB_cfg_config.io.emit('boothClick', { +// id : pId, +// num : pNum +// }); +//}) // Get local server ip address var ifaces = BOB_mod_os.networkInterfaces(); diff --git a/routes/users.js b/routes/users.js old mode 100644 new mode 100755 diff --git a/server/dnsmasq.conf b/server/dnsmasq.conf old mode 100644 new mode 100755 diff --git a/server/hosts b/server/hosts old mode 100644 new mode 100755 diff --git a/tools/tools-gphoto2.js b/tools/tools-gphoto2.js old mode 100644 new mode 100755 index c92d2f9..99fc610 --- a/tools/tools-gphoto2.js +++ b/tools/tools-gphoto2.js @@ -13,11 +13,14 @@ var BOB_var_camera = null; var BOB_module = {}; +var BOB_tmpPict = "/home/odroid/bobine-tmp.jpg" + BOB_upCameraReference(function() {}); function BOB_takePicture(pCallback) { - BOB_mod_exec("gphoto2 --capture-image-and-download --filename=/tmp/bobine.jpg --force-overwrite", function(pErr, pStdout, pStderr) { - console.log("takjePixuter", pErr || pStdout || pStderr) + BOB_mod_exec("gphoto2 --capture-image-and-download --filename="+BOB_tmpPict+" --force-overwrite", function(pErr, pStdout, pStderr) { + console.log("takePicture", pErr || pStdout || pStderr) + console.log(pErr, pStdout, pStderr) return pCallback(pErr) }) } @@ -61,7 +64,7 @@ BOB_module.takePicture = function(pBoothId, pPictId, pCallback) { // Else write file on ddisk } else { BOB_mod_mkdirp(destPath, function() { - copyFile("/tmp/bobine.jpg", pictOrig, function(pErr) { + copyFile(BOB_tmpPict, pictOrig, function(pErr) { return pCallback(pErr, pictOrig) }); }) diff --git a/tools/tools-photobooth.js b/tools/tools-photobooth.js old mode 100644 new mode 100755 diff --git a/tools/tools-test.js b/tools/tools-test.js old mode 100644 new mode 100755 diff --git a/views/error.ejs b/views/error.ejs old mode 100644 new mode 100755 diff --git a/views/fixdate.ejs b/views/fixdate.ejs new file mode 100644 index 0000000..67551a3 --- /dev/null +++ b/views/fixdate.ejs @@ -0,0 +1,19 @@ + + +

Click to force Bobinoscope date from your phone.

+
+ + + + + + diff --git a/views/index.ejs b/views/index.ejs old mode 100644 new mode 100755 index fdb463b..f84ea78 --- a/views/index.ejs +++ b/views/index.ejs @@ -174,7 +174,7 @@ var BOB_var_progressTimer = new Date(); function BOB_lauchFakeProgressBar() { setTimeout(function() { - var progress = (new Date() - BOB_var_progressTimer) / 20000 * 100; + var progress = (new Date() - BOB_var_progressTimer) / 15000 * 100; $('#idProgressBar').css('width', progress+'%'); if( progress < 100 ) { BOB_lauchFakeProgressBar(); diff --git a/views/index_back.ejs b/views/index_back.ejs old mode 100644 new mode 100755 diff --git a/views/view.ejs b/views/view.ejs old mode 100644 new mode 100755