Commit graph

130 commits

Author SHA1 Message Date
Krzysztof Rosiński
730bc61942
extract bindings (#128)
Hello,

I have a use case where size of an application is important, I'd like to
webpack as much as possible. The problematic part is related *.node
files, I found a potential solution, example with sqlite:

```
externals: {
    './sqlite3-binding.js':       'commonjs ./node_sqlite3.node',
}
```

I can replace sqlite3-binding.js [1] with *.node, then I copy
node_sqlite3.node to the main application folder. I'd like to try
something similar with the serialport. However, it is slightly more
complicated since serialport doesn't have single import file. This PR is
an attempt to fix the problem.

[1]
https://github.com/TryGhost/node-sqlite3/blob/master/lib/sqlite3-binding.js

---------

Co-authored-by: Krzysztof Rosiński <krzysiek@jrdltd.co.uk>
2024-12-23 15:12:57 -05:00
Nerivec
5d157b180e
Bring everything up-to-date (#194)
Ended up refactoring quite a bit while investigating a bug (_seems
prebuilds are failing on more and more setups_), figured a recap PR
might help...

- Fix outdated packages (that don't require more refactoring)
- Update node version in `test` to match that of `prebuild` action
- Update napi_versions to 8
- Update prebuildify target to 20
- Update (split) matrix
  - force tags where missing
  - add `win32-arm64`
- fix outdated image for linux-x64 (`centos7-devtoolset7` =>
`almalinux-devtoolset11`)
  - switch `linux-arm64-lts` to `linux-arm64`
- Update artifact names with `matrix.name` to avoid conflicts (merged on
download)
- Fix lint in tests

TODO:

- **Currently, this removes the `semantic-release` step in favor of a
`tree prebuilds` to finish debugging ([naming seems to have
changed](https://www.npmjs.com/package/@serialport/bindings-cpp?activeTab=code):
impact?), see action run:**
  - https://github.com/Nerivec/bindings-cpp/actions/runs/12331013585
- Can probably also add `dockcross/linux-riscv64`, which is becoming
more requested? (although not yet in `prebuild/docker-images`)

_Feel free to update/split as desired._

---------

Co-authored-by: Francis Gulotta <wizard@roborooter.com>
2024-12-23 14:38:28 -05:00
Gareth Hancock
01a3babeaf
correct async write (#125) 2023-07-14 18:06:25 +01:00
avsdev-cw
41e8275aaa
Fallback to ID_USB_* (#116) 2023-07-14 18:05:48 +01:00
Francis Gulotta
b3cb9c98f3
chore: upgrade ts and fix type warnings (#91) 2022-11-16 22:09:25 -05:00
Greg Van Aken
027529224a
feat: Allow for RTS to be explicitly enabled on windows (#23)
* Allow for RTS to be explicitly enabled
* Expose new option to windows types
2022-02-26 00:04:52 -05:00
Francis Gulotta
27c1685158
chore: update mock binding and readline (#30) 2022-02-03 18:30:00 -05:00
Francis Gulotta
e7e31ca0c6
fix: poller debug namespace 2022-02-01 23:30:04 -05:00
Francis Gulotta
53b5c2530b
feat: BindingsError with a canceled property 2022-01-31 22:25:28 -05:00
Francis Gulotta
3de2969561
fix: fix windows type and make name them per os (#26) 2022-01-31 18:07:32 -05:00
Francis Gulotta
7f3226291a
chore: update to @serialport/bindings-interface (#21) 2022-01-30 23:04:06 -05:00
Francis Gulotta
bc587b3c31
fix: break out parity into platform specifc opts (#20) 2022-01-30 10:31:49 -05:00
Francis Gulotta
cf03d6ddd1
feat: new binding interface (#19)
- We now only return a port object if it's open and list and open methods are now exported on an interface
- hardware tests now work and only require a loopback (no ready event)
- Test pass on darwin (not on mock - it's not up to date yet and coverage is going to drop)
- cleanup up tests with modern javascript
- Breaking - change the names of the exported types
- No more constructors, now all binding specicific open options are specificd on open
- Arduino test file for loopback
2022-01-29 22:51:40 -05:00
Francis Gulotta
d7a855da8b
feat: change autodetect output to a function 2022-01-22 22:25:52 -05:00
Francis Gulotta
2a93f48ee6
feat: migrate to typescript (#3)
This change migrates to typescript. The tests have been modified to conform to typescript and to cleanup cases when they weren't actually working (only one or two cases).

I've defined the existing bindings interface for all platforms. There are changes I'd love to make but didn't here (update/set/get/getBaudRate etc are messy). This should in theory be a drop in for the existing bindings. If there are bugs I imagine they're type related not functionality.

I dropped abstract bindings as having it a separate package didn't make sense during the refactor. I'd like to iterate on the design a bit more before returning to that class. Mockbinding may also now be drifted slightly from this package. I'll clean those inconsistencies up when I upgrade the main repo.
2022-01-22 15:55:03 -05:00
Francis Gulotta
095b7c50be
chore: cleanup single package repository 2021-12-29 21:53:13 -05:00
Francis Gulotta
826545bd0a
chore: change to a monorepo structure with Lerna (#1586)
- move from istanbul to nyc and update coverage reporting
- global docs
- global linting
- global tests
2018-07-24 01:15:09 -04:00
Rony Kubat
384eb379e3 Add support for beaglebone serial ports. (#1600) 2018-07-20 23:40:33 -04:00
shodan8192
9006bd61f4 fix: memory leak in unix serialport poller (#1572) 2018-06-23 21:37:42 -04:00
Francis Gulotta
d829ada7b5
chore: change to new parser packages and upgrade (fix builds) (#1562) 2018-05-06 02:25:50 -04:00
Francis Gulotta
a31078f054 docs: Switch to @reconbot/jsdoc-theme for docs
It looks a little nicer and has a github link. This also upgrades eslint and tweaks the config.
2018-04-15 22:12:17 -04:00
Francis Gulotta
4bccb62e47 chore: move parsers to their new packages and clean up docs 2018-03-25 17:33:17 -04:00
Сковорода Никита Андреевич
0c1533b825 chore: Avoid using deprecated Buffer constructor (#1510)
safe-buffer is already used and provides Buffer.alloc polyfill, so
just use Buffer.alloc directly to avoid hitting deprecated API.

Refs:
https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor
2018-03-02 18:27:44 -05:00
Per Kristian Schanke
45b3a2feb5 feat(windows): Fetch USB serial number by lookups in win registry (#1483)
Serial numbers in win32 from USB devices cannot be readily derived from the PnP ID.
This adds some logic to iterate through the win32 registry, as per the research in #1459.
2018-02-28 07:37:49 -05:00
Francis Gulotta
41f1d2d2d6 docs(parsers): improve the parser examples 2018-02-27 23:07:07 -05:00
Francis Gulotta
e8b73c2784
docs: fix missing options objects and descriptions (#1504) 2018-02-27 22:49:33 -05:00
Jade Bilkey
910438c2ca feat(linux): Custom baud rates for linux (eg 250k baudrate) (#1464)
* 250k baudrate now works
* Generic linux non-standard baudrate setting using termios2
* Tested successfully with an FTDI usb chip with the tx and rx pins bridged. Previous solution using the B38400 hack returned gibberish in same setup.
* Test for linux and win32 baudrate setting. Darwin stubbed out.

The arbitrary baud interface has been working on darwin up to this point so it's
likely that it works properly. The GetBaudRate extension should still get
written to be thorough but for now, this will let the CI tests pass properly and
still throw a warning about the check being disabled.

That is, of course, if anyone's testing with the arduino hardware on darwin,
otherwise, these tests never run anyway.
2018-02-05 09:33:11 -05:00
Rodrigo Saboya
6a3ab65f09 feat(parsers): Adding option to include delimiter in the DelimiterParser transform. (#1453) 2018-01-25 15:59:28 -05:00
Francis Gulotta
f7eb2f0df4
feat(parsers): ByteLength is now more efficient (#1402)
And better documented
2017-11-16 12:50:48 -05:00
Francis Gulotta
dcd256d27a
docs(readyParser): correct the required parameters (#1392) 2017-11-04 23:48:09 -04:00
Francis Gulotta
60fc047289
feat(docs): Switch to JSDOC docs not in the readme (#1383)
- Improve a few docs here and there
- Rename the repo
- Remove the authors field in the package.json
2017-10-31 23:42:59 -04:00
Frank Lemanschik
bcb492f386 feat(parsers): Add cctalk parsers (#1342)
* Added Working CCTalk Parser
* add basic tests
* compiled docs for cctalk parser
2017-10-01 17:03:38 -04:00
Francis Gulotta
a3b8d35597 feat(open): Throw on incorrect baudrate option (#1347)
This was causing a lot of issues, lets make it easier on people.
2017-09-24 17:14:58 -04:00
Francis Gulotta
3faadac88a fix(docs): add missing parsers to properties list 2017-09-07 00:24:29 -04:00
Francis Gulotta
e83ec4e585 fix(docs): correct default highWaterMark to 65536 bytes 2017-08-10 16:30:33 -04:00
Francis Gulotta
0b554d7368 fix(windows): Parse more types of pnpIds (#1288)
This should give us more serial numbers on windows.

fixes #1220
2017-08-06 23:21:37 -04:00
Francis Gulotta
56074f606f fix(tests): fixup for #1279 (#1285) 2017-08-06 20:49:51 -04:00
Erik Kallen
bf46f682d4 fix(linux): The productID should be a number not a description string (#1279)
fix: #1278
2017-08-06 20:28:53 -04:00
Francis Gulotta
92c7dd4bfd docs: Fix missing new thanks to @patrykkalinowski 2017-07-31 23:05:40 -04:00
Francis Gulotta
af82d40cdb Remove console.log from regex parser 2017-07-29 20:28:39 -04:00
Francis Gulotta
4fc1404c8c [all] Unify the serialport.list output (#1266)
- [osx] remove the 0x from productID and locationId and vendorId
- [linux] remove the starting 0x from any values, small refactor
- [linux] Fixup output using the hex encoded fields
- [windows] Grab the serial number from the pnp id
- Isolate list functions to their own platform files (c++)
- Better ensure our serialports fields are present

closes #1220
2017-07-29 19:40:39 -04:00
Francis Gulotta
8b07a48576 [all] Change parsers to be es6 classes
- Reduces code a bit
- Provides a better code example
- clean up options passing into transform streams
2017-07-29 17:41:53 -04:00
Francis Gulotta
63c5554fee [unix] fix a bug when poller errors would be unhandled
They will now be handled by the reads and writes that use it.
2017-07-29 01:37:09 -04:00
Francis Gulotta
f69407dc6a [all] Change the default high water mark to 64k (#1255)
The 16k water mark was set a long time ago, 64k is the default for `fs.ReadStream` You should experiment with your application and baudrate.

We also now allocate a buffer pool during object initialization because 99% of the time we'll be doing during runtime and why not take the perf hit upfront instead on first byte.

A side note: The source behind `Buffer.poolSize` and how buffers are allocated and the `ReadStream`'s `BufferList` are fascinating reads. It's obvious a lot of work has gone into these systems.
2017-07-24 18:24:40 -07:00
Francis Gulotta
470afbcae6 Queue drains
Drains don't make any sense if called on a closed port or before any writes. I'm queuing drains so they run one the port opens, just like `write()` this allows for a much easier time ensuring all data is written in a script.

- `drain()` waits for an open event if the port is closed
-  mock-bindings now cancel pending reads

closes #1229
2017-07-24 17:03:05 -07:00
Jesus
2e45249078 lint & fixes 2017-07-23 08:19:39 -07:00
Jesus
c32ea9b5dd readline parser 2017-07-23 08:19:39 -07:00
Jesus
d55979d42a linted 2017-07-23 08:19:39 -07:00
Jesus
6de1d2bc28 call udevadm single time 2017-07-23 08:19:39 -07:00
Francis Gulotta
e8d9d2b16c Add write recording capabilities to the mock bindings (#1249)
- change echo default
- add a bunch of logging and serialport serialnumbers
2017-07-22 10:42:32 -07:00