mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
- Test requiring the library as part of the build processes on all platforms - move all js code into ./lib - move all the easy stuff into ./lib/bindings the rest will bring breaking changes probably
34 lines
784 B
JavaScript
34 lines
784 B
JavaScript
'use strict';
|
|
|
|
var bindings = require('bindings')('serialport.node');
|
|
var listUnix = require('./list-unix');
|
|
|
|
var linux = process.platform !== 'win32' && process.platform !== 'darwin';
|
|
|
|
function listLinux(callback) {
|
|
callback = callback || function(err) {
|
|
if (err) { this.emit('error', err) }
|
|
}.bind(this);
|
|
return listUnix(callback);
|
|
};
|
|
|
|
var platformOptions = {};
|
|
if (process.platform !== 'win32') {
|
|
platformOptions = {
|
|
vmin: 1,
|
|
vtime: 0
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
close: bindings.close,
|
|
drain: bindings.drain,
|
|
flush: bindings.flush,
|
|
list: linux ? listLinux : bindings.list,
|
|
open: bindings.open,
|
|
SerialportPoller: bindings.SerialportPoller,
|
|
set: bindings.set,
|
|
update: bindings.update,
|
|
write: bindings.write,
|
|
platformOptions: platformOptions
|
|
};
|