Giter Club home page Giter Club logo

node-serialport-worker's People

Contributors

dudeofawesome avatar tibus avatar weiway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-serialport-worker's Issues

Add SerialPort disconnect event and make the isOpen method synchronous

First, thank you for your hard working.

I just noticed that the disconnect event is not implemented in node-serialport-worker, could you add it to serial_worker.js?

By now your isOpen() method is asynchronous, which is different from node-serialport:
https://github.com/voodootikigod/node-serialport/blob/master/lib/serialport.js#L254

SerialPort.prototype.isOpen = function() {
  return this.fd !== null && !this.closing;
};

Since there is no special processing within the original one, I suggest you can keep an isOpen flag internally, set it to true while receiving a successful SerialPort open event, and set it to false while receiving SerialPort close / disconnect events.

The parser option cannot pass to serial_worker

The parser option is a function type, it cannot use process.send() to pass a function to serial_worker.js:

var port = new SerialPort('/dev/tty-usbserial1', {
  parser: serialport.parsers.readline('\n')
});

Might be you can use an alternative way to specify the parser option. For example:

For the raw parser:

parser: 'raw'

For the readline parser:

parser: {
    type: 'readline',
    delimiter: '\n',
    encoding: 'utf8'
} 

ref. https://github.com/voodootikigod/node-serialport/blob/master/lib/parsers.js

Issue running under Windows 10

On Windows 10 I have installed electron using:

npm install -g electron-prebuilt

I then created a new project using npm init and installed node-serialport-worker using:

npm install serial-worker --save

My application simply does:

const electron = require('electron');
const serial = require('serial-worker');
...
...
...
...
serial.list((e,ports)=>{
    console.log(ports)
});

When I try to run I get:

App threw an error when running [Error: A dynamic link library (DLL) initialization routine failed.
\\?\Z:\Desktop\winplc\node_modules\serialport\build\Release\node-v47-win32-x64\serialport.node]
ATOM_SHELL_ASAR.js:157
        return old.apply(this, arguments);
                   ^

Error: A dynamic link library (DLL) initialization routine failed.
\\?\Z:\Desktop\winplc\node_modules\serialport\build\Release\node-v47-win32-x64\serialport.node
    at Error (native)
    at process.module.(anonymous function) [as dlopen] (ATOM_SHELL_ASAR.js:157:20)
    at Object.Module._extensions..node (module.js:450:18)
    at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:157:20)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (Z:\Desktop\winplc\node_modules\serialport\serialport.js:14:25)
    at Module._compile (module.js:425:26)

Any guidance will be appreciated.

Open immediately option not working.

I am trying out node-serialport-worker as a drop in replacement for node-serialport and noticed that the openImmediate option doesn't seem to do anything. Calling open manually however worked as expected.

Identifier 'process' has already been declared

Hello,

I got some big CPU usage on Electron with serial port and I tried yours. It would be verry useful for me to make it works but I've a problem with this module. When I run it, it's said :

Identifier 'process' has already been declared

serial-worker/serial_master.js:5 Uncaught SyntaxError: Identifier 'process' has already been declared

if I replace "const process" by "var process" in this line, I've another one : "Uncaught Error: channel closed" but maybe caused by the const to var?

Thank's for this module, realy look forward to get it work

there is a severe problem in the module

I construct two SerialInterface Object

let a1 = new SerialInterface()
let a2 = new SerialInterface()

when I emit a "close" Event in a1 , the listener of "close" Event in a1 and a2 will react at the save time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.