Browse Source

bob updated

bob
P.BARRY 6 years ago
parent
commit
e880bcd2fe
31 changed files with 100 additions and 20 deletions
  1. 0
      .gitignore
  2. 2
      app.js
  3. 0
      bin/www
  4. 3
      package.json
  5. 12
      pm2.json
  6. 0
      public/css/bootstrap.min.css
  7. 0
      public/css/cover.css
  8. 0
      public/css/style.css
  9. 0
      public/css/view.css
  10. 0
      public/img/common/294.GIF
  11. 0
      public/img/footer/cloclo.jpg
  12. 0
      public/img/footer/m-cloclo.jpg
  13. 0
      public/img/footer/m-cloclo.xcf
  14. 0
      public/img/footer/m-clotilde60.jpg
  15. 0
      public/img/footer/m-clotilde60.xcf
  16. 0
      public/img/template/default.jpg
  17. 0
      public/js/bootstrap.min.js
  18. 0
      public/js/jquery-1.11.2.min.js
  19. 0
      public/js/socket.io-1.3.4.js
  20. 73
      routes/index.js
  21. 0
      routes/users.js
  22. 0
      server/dnsmasq.conf
  23. 0
      server/hosts
  24. 9
      tools/tools-gphoto2.js
  25. 0
      tools/tools-photobooth.js
  26. 0
      tools/tools-test.js
  27. 0
      views/error.ejs
  28. 19
      views/fixdate.ejs
  29. 2
      views/index.ejs
  30. 0
      views/index_back.ejs
  31. 0
      views/view.ejs

0
.gitignore

2
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');

0
bin/www

3
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"
}

12
pm2.json

@ -0,0 +1,12 @@
{
"apps" : [{
"name" : "Bobinoscope",
"script" : "./bin/www",
"args" : [],
"cwd" : "/home/odroid/workspace/bobinoscope",
"env": {
"NODE_ENV": "production",
}
}]
}

0
public/css/bootstrap.min.css

0
public/css/cover.css

0
public/css/style.css

0
public/css/view.css

0
public/img/common/294.GIF

Before After
Width: 220  |  Height: 20  |  Size: 9.2 KiB Width: 220  |  Height: 20  |  Size: 9.2 KiB

0
public/img/footer/cloclo.jpg

Before After
Width: 1240  |  Height: 1778  |  Size: 266 KiB Width: 1240  |  Height: 1778  |  Size: 266 KiB

0
public/img/footer/m-cloclo.jpg

Before After
Width: 1600  |  Height: 280  |  Size: 50 KiB Width: 1600  |  Height: 280  |  Size: 50 KiB

0
public/img/footer/m-cloclo.xcf

0
public/img/footer/m-clotilde60.jpg

Before After
Width: 1600  |  Height: 280  |  Size: 303 KiB Width: 1600  |  Height: 280  |  Size: 303 KiB

0
public/img/footer/m-clotilde60.xcf

0
public/img/template/default.jpg

Before After
Width: 1600  |  Height: 2391  |  Size: 53 KiB Width: 1600  |  Height: 2391  |  Size: 53 KiB

0
public/js/bootstrap.min.js

0
public/js/jquery-1.11.2.min.js

0
public/js/socket.io-1.3.4.js

73
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();

0
routes/users.js

0
server/dnsmasq.conf

0
server/hosts

9
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)
});
})

0
tools/tools-photobooth.js

0
tools/tools-test.js

0
views/error.ejs

19
views/fixdate.ejs

@ -0,0 +1,19 @@
<html>
<body style="text-align:center">
<h2>Click to force Bobinoscope date from your phone.</h2>
<br/>
<button class="fixdate">Fix Date</button>
</body>
<!-- Latest compiled and minified JQuery -->
<script src="/js/jquery-1.11.2.min.js"></script>
<script>
$(document).ready(function() {
$('.fixdate').click(function() {
$.get('/fixdate/'+((new Date()).getTime()), function(pResponse) {
console.log('DONE', pResponse);
alert('done', pResponse.error);
})
})
})
</script>
</html>

2
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();

0
views/index_back.ejs

0
views/view.ejs

Loading…
Cancel
Save