Socket
Socket
Sign inDemoInstall

serialport

Package Overview
Dependencies
Maintainers
0
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialport - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

5

changelog.md

@@ -0,1 +1,6 @@

Version 0.2.5 - Version 0.2.6
-----------------------------
- Debugging issue with IOWatcher not holding in the event loop in node.js.
- Converted to ReadStream instead of IOWatcher.
Version 0.2.4

@@ -2,0 +7,0 @@ -------------

2

package.json
{ "name" : "serialport",
"version" : "0.2.5",
"version" : "0.2.6",
"description" : "Welcome your robotic javascript overlords. Better yet, program them!",

@@ -4,0 +4,0 @@ "author": "Chris Williams <voodootikigod@gmail.com>",

@@ -15,3 +15,3 @@ <pre>

Version: 0.2.5 - Released June 27, 2011
Version: 0.3.0 - Released June 28, 2011

@@ -18,0 +18,0 @@ *****

@@ -76,26 +76,19 @@ "use strict";

this.fd = serialport_native.open(this.port, options.baudrate, options.databits, options.stopbits, options.parity, options.flowcontrol);
this.readWatcher = new IOWatcher();
this.empty_reads = 0;
this.readWatcher.callback = (function (file_id, me) {
return function () {
var buffer = new Buffer(options.buffersize);
var bytes_read = 0, err = null;
try {
bytes_read = serialport_native.read(file_id, buffer);
} catch (e) {
err = e;
}
if (bytes_read <= 0) {
// assume issue with reading.
me.emit("error", (err ? err :"Read triggered, but no bytes available. Assuming error with serial port shutting down."));
me.close();
} else {
options.parser(me, buffer.slice(0, bytes_read));
}
}
})(this.fd, this);
this.readWatcher.set(this.fd, true, false);
this.readWatcher.start();
if (this.fd == -1) {
this.emit("error", new Error('could not open serial port'))
} else {
this.readStream = fs.createReadStream(this.port);
var dataCallback = (function (me) {
return (function (buffer) {
options.parser(me, buffer)
});
})(this);
var errorCallback = (function (me) {
return (function (err) {
me.emit("error", err);
});
});
this.readStream.on("data", dataCallback);
this.readStream.on("error", errorCallback);
}
}

@@ -106,4 +99,3 @@

SerialPort.prototype.close = function () {
this.readWatcher.stop();
this.readStream.close();
if (this.fd) {

@@ -110,0 +102,0 @@ serialport_native.close(this.fd);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc