mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
2.9 KiB
2.9 KiB
Upgrading from 3.x to 4.x
4.x brings a lot of changes please see the changelog for the full list of changes. We'll review the api and behavior changes here.
The constructor has changed. We've removed an argument, changed how errors are thrown and it is returned when you require('serialport');
- Requiring
serialportnow returns the SerialPort constructor function instead of a factory object.SerialPort.SerialPortis now deprecated. SerialPortconstructor now throws on argument errors immediately.- Removed
openImmediatelyfrom the constructor's api, the functionality is now namedautoOpenon the options object. - Removed extraneous flow control settings from the
flowControloption, use the specific options to set these flags now. - Removed undocumented callbacks from the options object
disconnectedCallbackanddataCallback
Write had a major change
.write(writeCallback)now only calls it's callback once after the entire write operation, it used to be called for each write cycle and return the bytes written. This reduces the number of callbacks by hundreds of thousands over a megabyte at low bandwidth.
Callbacks changed a little
- All callbacks are called in the context of the port,
thisnow equals the port. - Disconnections now always attempt to close the port, and you'll always get a
closeevent after adisconnectevent
Renamed our binaries
- Reanmed
serialportlisttoserialport-list - Renamed
serialporttermtoserialport-term
We fixed a bunch of bugs too
- [unix]
.drainand.setnow properly report errors - [windows] Fixed a bug where we weren't properly opening ports (provides better support virtual com ports too) thanks to @RogerHardiman
- [windows] known issue
lockfalse doesn't work (no change in behavior)
And added a new features
- [unix] Ports are now locked by default with the new
lockoptions matches windows default behavior - [windows]
.update()now supports windows for changing baud rates
Upgrading from 2.x to 3.x
3.0 brought a single major breaking change and a lot of minor improvements.
We stopped removing event listeners, if you wrote code to work around that, we're sorry we made you do it.
closeanddisconnectevents no longer callremoveAllListenersand removes your event listeners. This was particularly bad for theerrorevent. This is the only change and if you didn't have a special code to deal with this behavior you should probably upgrade from v2.1.2
New Features
- Added support for node 6.0
- Update the cli tools. serialportterm can now list ports, serialportlist can now output in different formats
- [unix] Better unix error messages
Fixed bugs
- [linux] bug fix in
.list()where we weren't filtering out non block devices that are named like serial ports - [unix] Update now has less memory leaks, documentation and better error messages
- [windows] Better error messages for opening ports