diff --git a/dmx-web.js b/dmx-web.js index 9ef849d..94bb05b 100755 --- a/dmx-web.js +++ b/dmx-web.js @@ -3,7 +3,7 @@ var fs = require('fs') var http = require('http') -var connect = require('connect') +var body = require('body-parser') var express = require('express') var socketio = require('socket.io') var program = require('commander') @@ -48,14 +48,11 @@ function DMXWeb() { } } }) - io.set('log level', 1) - app.configure(function() { - app.use(connect.json()) - }) + app.use(body.json()) app.get('/', function(req, res) { - res.sendfile(__dirname + '/index.html') + res.sendFile(__dirname + '/index.html') }) app.get('/config', function(req, res) { @@ -75,7 +72,7 @@ function DMXWeb() { res.json({"state": dmx.universeToObject(req.params.universe)}) }) - + app.post('/state/:universe', function(req, res) { if(!(req.params.universe in dmx.universes)) { res.status(404).json({"error": "universe not found"}) diff --git a/drivers/dmx4all.js b/drivers/dmx4all.js index f7190d6..8993b84 100644 --- a/drivers/dmx4all.js +++ b/drivers/dmx4all.js @@ -11,7 +11,7 @@ function DMX4ALL(device_id, options) { this.universe.fill(0) this.dev = new SerialPort(device_id, { - 'baudrate': 38400, + 'baudRate': 38400, 'databits': 8, 'stopbits': 1, 'parity': 'none' @@ -26,7 +26,7 @@ function DMX4ALL(device_id, options) { } DMX4ALL.prototype.send_universe = function() { - if(!this.dev.isOpen()) { + if(!this.dev.writable) { return } @@ -64,4 +64,4 @@ DMX4ALL.prototype.get = function(c) { return this.universe[c] } -module.exports = DMX4ALL \ No newline at end of file +module.exports = DMX4ALL diff --git a/drivers/dmxking-ultra-dmx-pro.js b/drivers/dmxking-ultra-dmx-pro.js index 165b849..3b1ad49 100644 --- a/drivers/dmxking-ultra-dmx-pro.js +++ b/drivers/dmxking-ultra-dmx-pro.js @@ -25,7 +25,7 @@ function DMXKingUltraDMXPro(device_id, options) { } this.dev = new SerialPort(device_id, { - 'baudrate': 250000, + 'baudRate': 250000, 'databits': 8, 'stopbits': 2, 'parity': 'none' @@ -37,7 +37,7 @@ function DMXKingUltraDMXPro(device_id, options) { } DMXKingUltraDMXPro.prototype.send_universe = function() { - if(!this.dev.isOpen()) { + if(!this.dev.writable) { return } var hdr = Buffer([ @@ -81,4 +81,4 @@ DMXKingUltraDMXPro.prototype.get = function(c) { return this.universe[c] } -module.exports = DMXKingUltraDMXPro \ No newline at end of file +module.exports = DMXKingUltraDMXPro diff --git a/drivers/enttec-open-usb-dmx.js b/drivers/enttec-open-usb-dmx.js index aa3f56a..b6508c8 100644 --- a/drivers/enttec-open-usb-dmx.js +++ b/drivers/enttec-open-usb-dmx.js @@ -12,7 +12,7 @@ function EnttecOpenUsbDMX(device_id, options) { self.interval = 46 this.dev = new SerialPort(device_id, { - 'baudrate': 250000, + 'baudRate': 250000, 'databits': 8, 'stopbits': 2, 'parity': 'none' @@ -27,7 +27,7 @@ function EnttecOpenUsbDMX(device_id, options) { EnttecOpenUsbDMX.prototype.send_universe = function() { var self = this - if(!this.dev.isOpen()) { + if(!this.dev.writable) { return } diff --git a/drivers/enttec-usb-dmx-pro.js b/drivers/enttec-usb-dmx-pro.js index d854ce2..48ccad6 100644 --- a/drivers/enttec-usb-dmx-pro.js +++ b/drivers/enttec-usb-dmx-pro.js @@ -16,7 +16,7 @@ function EnttecUSBDMXPRO(device_id, options) { this.universe.fill(0) this.dev = new SerialPort(device_id, { - 'baudrate': 250000, + 'baudRate': 250000, 'databits': 8, 'stopbits': 2, 'parity': 'none' @@ -28,7 +28,7 @@ function EnttecUSBDMXPRO(device_id, options) { } EnttecUSBDMXPRO.prototype.send_universe = function() { - if(!this.dev.isOpen()) { + if(!this.dev.writable) { return } var hdr = Buffer([ @@ -72,4 +72,4 @@ EnttecUSBDMXPRO.prototype.get = function(c) { return this.universe[c] } -module.exports = EnttecUSBDMXPRO \ No newline at end of file +module.exports = EnttecUSBDMXPRO diff --git a/index.html b/index.html index b0acbd0..d35c463 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ return 'channel_' + universe + '_' + channel; } - var socket = io.connect(); + var socket = io(); socket.on('init', function (msg) { $('#presets').empty(); $('#sliders').empty(); diff --git a/package.json b/package.json index 2ad0588..bf3461f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dmx", - "version": "0.0.5", + "version": "0.0.6", "author": "Sebastian Wiedenroth ", "description": "DMX library and webservice", "url": "https://github.com/wiedi/node-dmx", @@ -17,11 +17,11 @@ "light control" ], "dependencies": { - "serialport": "4.0.x", - "socket.io": "0.9.x", - "connect": "2.11.x", - "express": "3.4.x", - "commander": "2.0.x" + "serialport": "^6.0.4", + "socket.io": "^2.0.4", + "express": "^4.16.2", + "body-parser": "^1.5.2", + "commander": "^2.12.2" }, "licenses": [ {