mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-25 18:37:19 +00:00
put the dataCallback back for windows reads (#976)
This commit is contained in:
parent
007aef6870
commit
22a369112e
1 changed files with 7 additions and 5 deletions
|
|
@ -164,6 +164,8 @@ function SerialPort(path, options, callback) {
|
|||
this.bufferSize = settings.bufferSize;
|
||||
this.readable = true;
|
||||
this.reading = false;
|
||||
} else {
|
||||
settings.dataCallback = this._emitData.bind(this);
|
||||
}
|
||||
|
||||
this.options = settings;
|
||||
|
|
@ -293,6 +295,11 @@ SerialPort.prototype.write = function(data, callback) {
|
|||
}.bind(this));
|
||||
};
|
||||
|
||||
SerialPort.prototype._emitData = function(data) {
|
||||
this.emit('data', data);
|
||||
};
|
||||
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
SerialPort.prototype._read = function() {
|
||||
if (!this.readable || this.paused || this.reading || this.closing) {
|
||||
|
|
@ -370,11 +377,6 @@ if (process.platform !== 'win32') {
|
|||
this.pool.used += toRead;
|
||||
};
|
||||
|
||||
SerialPort.prototype._emitData = function(data) {
|
||||
this.emit('data', data);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Pauses an open connection (unix only)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue