linux-device
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -5,3 +5,3 @@ var DeviceHandle = require('bindings')('DeviceHandle').DeviceHandle; | ||
DeviceHandle.prototype.gpio = function(gpio, value, cb) { | ||
DeviceHandle.gpio = DeviceHandle.prototype.gpio = function(gpio, value, cb) { | ||
cb = cb || function(){}; | ||
@@ -8,0 +8,0 @@ |
{ | ||
"name": "linux-device", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Native addon to communicate with linux devices (can also be used for sockets or FIFOs)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,2 +63,8 @@ "use strict"; | ||
metadata.static_functions.forEach((func) => { | ||
DeviceHandleProxy[func] = function() { | ||
server.then(serv => serv.emit.bind(serv, 'static_'+func).apply(null, arguments)); | ||
}; | ||
}); | ||
metadata.constants.forEach((c, index) => { | ||
@@ -65,0 +71,0 @@ DeviceHandleProxy[c] = c; |
{ | ||
"functions": ["write", "ioctl", "ioctl_raw", "close", "gpio"], | ||
"static_functions": ["gpio"], | ||
"constants": ["IOCTL_NONE","IOCTL_READ","IOCTL_WRITE","IOCTL_RW"] | ||
} |
@@ -54,2 +54,15 @@ "use strict"; | ||
metadata.static_functions.forEach((name) => { | ||
if(blacklist.indexOf(name) >= 0) return; | ||
socket.on('static_'+name, function() { | ||
let args = Array.prototype.slice.apply(arguments); | ||
console.log('static', name, arguments); | ||
try { | ||
DeviceHandle[name].apply(null, arguments); | ||
} catch(e) { | ||
socket.emit('server_error', e && e.stack ? e.stack : e); | ||
} | ||
}); | ||
}); | ||
socket.on('ioctl', (path, dir, type, cmd, data) => { | ||
@@ -56,0 +69,0 @@ dir = DeviceHandle[dir]; |
@@ -5,3 +5,3 @@ "use strict"; | ||
let input = new DH('/dev/input/by-path/platform-gpio_keys-event',false,16,console.log); | ||
input.gpio(58, 0, console.log.bind(0,'gpio cb')); | ||
DH.gpio(58, 0, console.log.bind(0,'gpio cb')); | ||
@@ -8,0 +8,0 @@ setTimeout(() => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23627
155