Commit graph

160 commits

Author SHA1 Message Date
Francis Gulotta
b3cb9c98f3
chore: upgrade ts and fix type warnings (#91) 2022-11-16 22:09:25 -05:00
Francis Gulotta
bc67b4027d
chore: fix arduino echo script 2022-02-01 23:29:54 -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
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
63f803f56b
Update our dev deps notably mocha (#2162) 2020-11-02 23:44:53 -05:00
Francis Gulotta
50f967e788
fix: bindings.close() should cause a canceled read error (#1972)
`stream` seems unaffected by this but other future interfaces may not be so forgiving.

- removed the unused disconnect handler that we passed to bindings in tests.
- moved shouldReject to a test global
- unit tested unixRead
2019-11-09 21:46:21 -05:00
Francis Gulotta
b1cc840e5a
fix: enabling disabled tests rename all pkgs to lib (#1941)
We weren't calling a few more tests and I standardized the package layout so this is harder to miss.
2019-09-24 22:03:13 -04:00
Francis Gulotta
a5f7d607ea
fix: we weren’t running all the tests (#1937) 2019-09-22 21:47:03 -04:00
Francis Gulotta
d4f15c0a09
chore: remove node6 support and upgrade codebase (#1851)
- use async functions
- use Object.entries/Object.values
- use Object spreading

BREAKING CHANGE: bindings now use async functions so they’ll never throw, only reject
2019-05-01 21:19:29 -04:00
Francis Gulotta
e883f3b166
chore(packages): upgrade packages and add global outdated command (#1845)
- adds `npm run outdated` to our scripts that ensures every package in the monorepo is checked for outdated npm packages.
- upgrade nan for node 12 support
- upgrade debug and promirepl (no major changes)
- upgrade mocha and nyc
2019-04-26 19:25:43 -04:00
Francis Gulotta
f123d2745f chore: linting - a much more reasonable line length 2018-09-15 05:02:59 -04:00
Francis Gulotta
7cee2020f1
chore: use Prettier for formatting (#1635)
This is a crazy diff that's unreadable. Prettier has gained a lot of traction I personally like it and a lot of code looks like this these days. It also supports linting and formatting that eslint doesn't on its own. That alone helps keep the code more standard. This PR is equivalent of ripping off a bandaid.

- Add prittier
- `npm run format`
2018-08-25 19:05:56 -07:00
Francis Gulotta
dad88ce899
chore: drop node 4 and upgrade to node 6 features (#1633)
Libraries, LTS support and a large enough amount of users have all dropped node 4. As part of this years [J5 summit](https://github.com/rwaldron/johnny-five/issues/1463) we discussed supporting all Active, Maintenance and Current LTS releases only. This will greatly reduce maintenance overhead and make this maintainer a little bit more happy. The last version of serialport to support node 4 will be `serialport@6`.

- remove "use strict;"
- add engines directives to all package.json's
- drop safe-buffer as they're all safe now
- let eslint-plugin-node use the engines directive
- use new language features in a few random places to feel better about this
- stop including the package-lock.json
- upgrade a few packages

BREAKING: Dropping support for node 4
2018-08-25 18:41:39 -07: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
Francis Gulotta
e21fe7a2d1
fix: Remove a new Buffer() call (#1603) 2018-07-20 23:54:23 -04:00
Francis Gulotta
46d798d63c chore(package): upgrade packages
`standard` is breaking on the new eslint, will need to to revaluate linting rules without it
2018-06-25 03:00:55 -04:00
Francis Gulotta
a250f0983c
fix: a few warnings and deprecations (#1558)
- c++ string copies were potentially insecure
- sandboxes are now made differently
2018-04-28 21:22:40 -04:00
Francis Gulotta
4bccb62e47 chore: move parsers to their new packages and clean up docs 2018-03-25 17:33:17 -04: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
dcd256d27a
docs(readyParser): correct the required parameters (#1392) 2017-11-04 23:48:09 -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
c590021f62 chore(packages): upgrade eslint and sinon (#1343) 2017-09-22 09:41:44 -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
greenkeeper[bot]
648a7f556a chore(package): update sinon to version 3.0.0 (#1280) 2017-08-06 20:26:32 -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
ae898304c7 Add a timeout for the open/close integration test 2017-07-29 12:55:50 -04:00
John Whittington
90931ddb04 Move parser object into port open 2017-07-27 10:34:02 -07:00
John Whittington
bbeac32614 Use parser not data callback without time and linting 2017-07-27 10:34:02 -07:00
John Whittington
7816f29607 Comments and number of bytes to send 2017-07-27 10:34:02 -07:00
John Whittington
72a461f0cf Drain receive manual test added 2017-07-27 10:34:02 -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
caffe7167a tests 2017-07-23 08:19:39 -07:00
Francis Gulotta
c47b924aa1 Baudrate.250000 (#1239)
* Test for 250k baud rate
2017-07-16 22:42:51 -04:00
Francis Gulotta
61e23d0907 [all] Have drain wait for pending JS write operations before calling system drain
This should allow drain to be a lot easier to use.

Bonus:
- More logging!
- Bluebird in tests with it's great long stack traces!
2017-07-16 22:05:58 -04:00
Francis Gulotta
b822721855 refactor some test logic 2017-07-16 16:21:08 -04:00
Francis Gulotta
9c67ee2a43 [unix] Move setting up the baudrate to the end of the open()
- Test 1000000 baud
2017-07-15 13:06:44 -04:00
Francis Gulotta
ee7315f59c Make the mock bindings example work properly and the bindings easier to use 2017-07-15 12:24:33 -04:00
Francis Gulotta
2045d8542f Remove the disconnect event 2017-07-09 21:54:53 -04:00
Francis Gulotta
1888efc944 Ensure flushing doesn't cause a read error which closes the port 2017-07-09 21:25:02 -04:00
Francis Gulotta
2ed7b119d0 Test flushing data
- [unix] small changes to flushing data during port open and setup to prevent bad data
- [all] mock binding flush now works
- cleanup on mock-binding pending reads
- add `serialport-repl` as a bin and npm command
2017-07-09 21:25:02 -04:00
Francis Gulotta
6455ecbb51 [unix] New read/write subsystem (#1212)
This has always been the dream. Use `fs.read` and `fs.write` to do reading and writing. To make that happen I've created a cross platform `Poller` object that notifies us once on `readable` and `writable` states.

- Reduce large write cpu usage from 100% to 1-2%
- Replace ReadPoller with a multi purpose poller because you can only have a single uv_poll_t on a fd at a time because reasons
- Experimented with doing this all in c++, maybe there are gains to doing that but I'd never finish.
- Some unrelated eslint changes
- Arduino echo should just echo, writing random bytes was messing it up
- use a file to disable tests in envs
- read and write errors can trigger disconnects
- disconnect event only happens if there are listeners, otherwise error events will be triggered
- a disconnect during write will always have a write error too
- win32 bindings seem to only trigger disconnects on writes
2017-07-05 09:12:31 -04:00
greenkeeper[bot]
06543aa317 Update dependencies to enable Greenkeeper 🌴 (#1195)
* chore(package): update dependencies
* docs(readme): add Greenkeeper badge
* Ignore package-lock.json and fix linting
* Work around some issues with ci's
* fix windows coverage
2017-06-18 22:09:13 -04:00
Francis Gulotta
ab4b55c0a0 Pull README edits into the template and JS Doc
Updated the generated section of the docs but not all changes can be preserved.
2017-06-18 21:24:51 -04:00
Francis Gulotta
5f53a45cae Buffer upgrades (#1168)
* upgrade to non deprecated buffer methods
* Don't lint on node 4 as it's now broken

I really wish packages would keep things working on LTS platforms.
2017-05-14 12:58:56 -04:00