You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| callback | <code>errorCallback</code> | Called once a connection is closed. |
400
400
401
401
402
-
-
403
-
404
-
<aname="module_serialport--SerialPort+flush"></a>
405
-
406
-
#### `serialPort.flush([callback])`
407
-
Flushes data received but not read. See [`tcflush()`](http://linux.die.net/man/3/tcflush) for Mac/Linux and [`FlushFileBuffers`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439) for Windows.
408
-
409
-
**Kind**: instance method of <code>[SerialPort](#exp_module_serialport--SerialPort)</code>
410
-
411
-
| Param | Type | Description |
412
-
| --- | --- | --- |
413
-
|[callback]| <code>[errorCallback](#module_serialport--SerialPort..errorCallback)</code> | Called once the flush operation finishes. |
414
-
415
-
416
402
-
417
403
418
404
<aname="module_serialport--SerialPort+set"></a>
@@ -433,6 +419,20 @@ Sets flags on an open port. Uses [`SetCommMask`](https://msdn.microsoft.com/en-u
433
419
|[callback]| <code>[errorCallback](#module_serialport--SerialPort..errorCallback)</code> || Called once the port's flags have been set. |
434
420
435
421
422
+
-
423
+
424
+
<aname="module_serialport--SerialPort+flush"></a>
425
+
426
+
#### `serialPort.flush([callback])`
427
+
Flush discards data received but not read and written but not transmitted. For more technical details see [`tcflush(fd, TCIFLUSH)`](http://linux.die.net/man/3/tcflush) for Mac/Linux and [`FlushFileBuffers`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439) for Windows.
428
+
429
+
**Kind**: instance method of <code>[SerialPort](#exp_module_serialport--SerialPort)</code>
430
+
431
+
| Param | Type | Description |
432
+
| --- | --- | --- |
433
+
|[callback]| <code>[errorCallback](#module_serialport--SerialPort..errorCallback)</code> | Called once the flush operation finishes. |
* Flushes data received but not read. See [`tcflush()`](http://linux.die.net/man/3/tcflush) for Mac/Linux and [`FlushFileBuffers`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439) for Windows.
483
-
* @param {module:serialport~errorCallback=} callback Called once the flush operation finishes.
484
-
*/
485
-
SerialPort.prototype.flush=function(callback){
486
-
if(!this.isOpen){
487
-
debug('flush attempted, but port is not open');
488
-
returnthis._error(newError('Port is not open'),callback);
debug('SerialPortBinding.flush had an error',err);
494
-
returnthis._error(err,callback);
495
-
}
496
-
if(callback){callback.call(this,null,result)}
497
-
}.bind(this));
498
-
};
499
-
500
481
/**
501
482
* Sets flags on an open port. Uses [`SetCommMask`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363257(v=vs.85).aspx) for windows and [`ioctl`](http://linux.die.net/man/4/tty_ioctl) for mac and linux.
502
483
* @param {object=} options All options are operating system default when the port is opened. Every flag is set on each call to the provided or default values. If options isn't provided default options will be used.
* Flush discards data received but not read and written but not transmitted. For more technical details see [`tcflush(fd, TCIFLUSH)`](http://linux.die.net/man/3/tcflush) for Mac/Linux and [`FlushFileBuffers`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439) for Windows.
524
+
* @param {module:serialport~errorCallback=} callback Called once the flush operation finishes.
525
+
*/
526
+
SerialPort.prototype.flush=function(callback){
527
+
if(!this.isOpen){
528
+
debug('flush attempted, but port is not open');
529
+
returnthis._error(newError('Port is not open'),callback);
debug('SerialPortBinding.flush had an error',err);
535
+
returnthis._error(err,callback);
536
+
}
537
+
if(callback){callback.call(this,null,result)}
538
+
}.bind(this));
539
+
};
540
+
541
541
/**
542
542
* Waits until all output data has been transmitted to the serial port. See [`tcdrain()`](http://linux.die.net/man/3/tcdrain) or [FlushFileBuffers()](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364439(v=vs.85).aspx) for more information.
543
543
* @param {module:serialport~errorCallback=} callback Called once the drain operation returns.
0 commit comments