Commit graph

94 commits

Author SHA1 Message Date
Francis Gulotta
672e8319c3 Conform to NodeJS error message formats (#998)
https://github.com/nodejs/node/pull/3374
2016-11-04 23:29:07 -04:00
Francis Gulotta
39d0103937 Streams rewrite
This is a major change.  To reading, the poller and the bindings layer, there isn’t a great way to do this piecemeal. The goal here is to make bindings a plugin layer, our c++ bindings isolated and tested, and make Serialport a streams object.

- Move all bindings into platform specific modules DarwinBinding LinuxBinding, and WindowsBinding
- Separate out the bindings from the SerialPort class so it can be required by itself.
- Provide mock bindings as a tested first class bindings layer
- Mixin stream methods with `pushBindingWrap`, inspired from fs.readStream
- All integration tests now require an Arduino 
- Ditch sandboxed modules as we don't need to be that heavy handed to test anymore

TODO

- windows binding
- performance test
- memory leak test
- 🎉
2016-11-04 21:03:35 -04:00
Francis Gulotta
9f8a359a86 Test changes
- Increase code coverage of parsers 
- Ask mocha to fail fast
- Auto detect arduino for tests
2016-11-04 17:26:41 -04:00
Francis Gulotta
23de171055 Do error checking when getting modem control flags 2016-10-21 21:35:50 -04:00
Francis Gulotta
0d757fd72c Merge pull request #967 from jgillick/master
Get modem status bits (CTS, DSR, DCD)
2016-10-21 17:50:49 -04:00
jgillick
598c8e9ec8 Add basic tests 2016-10-21 00:07:41 -07:00
Francis Gulotta
72fc5b2597 rename ReadLineParser to ReadlineParser
matches gnu and nodejs conventions for `readline`
2016-10-13 02:26:05 +01:00
Andrew Koroluk
672abb4936 depreciated -> deprecated 2016-10-11 01:15:53 -04:00
Francis Gulotta
d2bb973382
Transform parsers into streams
Parsers are now transform streams! I'm not 100% convinced this is easier to use but it is more clear about the mechanics. I think that might make it worthwhile. It also opens up a clear example to how to make your own parser.
2016-09-08 19:18:36 -04:00
Francis Gulotta
cf822fcaf4 some more linting rules so we're consistent (#909) 2016-08-16 21:50:26 -04:00
Francis Gulotta
3247987c1f Allow opening after an open error. (#910)
fixes #908
2016-08-16 21:49:35 -04:00
Francis Gulotta
3400822e80 [unix] Flush now gives errors and flushes tx and rx (#900)
- Bonus less structs as many functions return nothing or error
2016-08-08 15:13:04 -04:00
Francis Gulotta
b3404072cf
Test the write non binding code a bit more 2016-08-08 00:35:23 -04:00
Francis Gulotta
5616664ed6 Change isOpen() to a propterty (#899) 2016-08-06 21:51:56 -04:00
Francis Gulotta
3aafa77e2c Remove lowercase options and properly define .path (#898) 2016-08-06 20:26:49 -04:00
arve0
c5c7440415 parsers.byteDelimiter: compare arrays instead of increasing nextDelimIndex 2016-07-28 14:37:06 +02:00
arve0
5249f5c02b parsers.byteDelimiter: add test, emit only on following delimiters
Example:

```
var parser = byteDelimiter([0,0]);

parser(emit, new Buffer('\0hello\0world\0\0');
```

Expected: `emit` should be called once, upon `\0\0` with whole string.
What happens: `emit` is called twice, with `\0hello\0` and `world\0\0`.
2016-07-28 13:37:21 +02:00
Francis Gulotta
d0c64555c0 Choose a different invalid FD (#883)
that hopefully throws an error on our new ci
2016-07-26 07:45:36 -04:00
Francis Gulotta
dcfe2ab4ee Switch up testing infrastructure (#881)
- npm test now runs everything but stress tests
 - TEST_PORT is optional but now requires an arduino, the travis provided OS X serial port wasn't worth it
 - do some improvements to coverage
 - Drop grunt for file size and complexity
 - Eslint has dropped 0.10

I don't think Istanbul can detect coverage on sandboxed modules like our mocked bindings. Moving to an isolated binding will improve this situation.

I also don't think coveralls is working on travis
2016-07-24 22:20:23 -04:00
Francis Gulotta
4c55b57ffb Drop Sinon Chai and refactor some tests (#868) 2016-07-13 00:42:56 -04:00
Francis Gulotta
36be232bb1 Cleanup disconnect path (#855)
- make the disconnect path more consistent
 - call callback in the context of the port
2016-06-16 00:21:42 -04:00
Francis Gulotta
c84c9a22c9 Cleanup some callbacks (#851)
- remove the dataCallback option
 - remove the disconnectedCallback option
 - call callback in the context of the port
2016-06-14 23:12:44 -04:00
Francis Gulotta
7eca965961 Enable locking and sharing of the serialport (#840) 2016-06-11 22:34:07 -04:00
Francis Gulotta
e986563c75 Make sure .drain and .set error on all platforms. (#834) 2016-05-29 16:03:18 -04:00
Francis Gulotta
18b59eff3e Implement .update() on windows (#831) 2016-05-29 00:26:02 -04:00
Francis Gulotta
77c4ea37eb Remove the openImmediatly flag in favor of the autoOpen option (#830)
closes #809
2016-05-28 21:33:52 -04:00
Francis Gulotta
9a98ede77f Remove the serial port factory and throw errors on invalid arguments (#822)
- Constructor now throws errors when given invalid options
 - The Constructor’s callback is given to `.open()` if `openImmediately` is set
 - Depreciation warning when using the old style SerialPort.SerialPort
2016-05-26 11:40:58 -04:00
Francis Gulotta
079777b694 Flowcontrol (#821)
Remove the extra flow control settings
2016-05-23 23:45:11 -04:00
Francis Gulotta
4b984e8995 write binding tests and cleanup (#808)
- Fix bug where write callback was being called multiple times when write operations blocked
 - [windows] refactored write code to be less complex
 - [unix] refactored write code to be less complex
 - added arduino required integration tests
2016-05-16 21:33:00 -04:00
Francis Gulotta
77b1cbc2f7 Tighten up the graphics on level 4
I mean the linter rules, whitespace only.
2016-05-14 19:12:52 -04:00
Francis Gulotta
0063e13364 Make update cross platform for baud rates (#763)
- Errors should always be an error or null
 - bindings.close doesn't throw with proper args so why are we catching?
 - throw on update if given bad options
 - support and test updating and opening with custom baud rates
2016-05-12 13:03:59 -04:00
Francis Gulotta
8d95d6f532 Fix an error in listUnix where we were filtering improperly (#792) 2016-05-08 22:16:04 -04:00
Francis Gulotta
cf41ef76bd Update the errors for unix to always include the err string and tests for close (#790) 2016-05-06 23:38:17 -04:00
Francis Gulotta
cf678e6f0b Small Update for windows bindings (#785)
- Error with the provided com port name instead of the mess we use under the hood to talk to the apis
 - update _snprintf calls to _snprintf_s as the former is depreciated 
 - Add a binding test for bad ports
2016-05-05 10:30:50 -04:00
Francis Gulotta
9f9693cb15 Update cli tools (#776)
- Better argument handling
 - Switch to commander as optimist is deprecated 
 - more output formats for serial port list
 - give serialportterm a list option
2016-05-01 18:19:54 -04:00
Francis Gulotta
566a8d48e9 Move some tests around 2016-05-01 16:53:49 -04:00
Francis Gulotta
1bd3e06c58 SerialportList updates (#761)
- Errors are now consistent across platforms
 - List is now completely async and promise ready
 - Test the bindings abstraction not the bindings itself
2016-04-23 12:43:31 -04:00
Francis Gulotta
6945217c0b Isolate the bindings (#755)
- Test requiring the library as part of the build processes on all platforms
 - move all js code into ./lib
 - move all the easy stuff into ./lib/bindings the rest will bring breaking changes probably
2016-04-15 23:54:58 -04:00
Francis Gulotta
8342d1725c Add support for bluetooth devices /dev/rfcomm (#742) 2016-04-08 12:50:56 -04:00
Francis Gulotta
156e405bbc Define, document, and test flow control and setting port flags (#726)
We had ambiguous behavior and documentation around these settings and functions, this preserves all of the previous behavior and defines it in documentation and tests. This is a step towards separating out and cleaning up user supplied options to the constructor.
2016-04-08 11:44:18 -04:00
Francis Gulotta
39946c4bc0 Make the output of .list undefined if it’s an empty string (#740)
Add some tests to start defining the bindings.
2016-04-08 11:18:37 -04:00
Francis Gulotta
540a96015c Add npm run stress to run stress tests
- Fixed the write memory leak test

 - failed attempt at a open close memory leak test



Closes #602
2016-04-03 21:21:26 -04:00
Francis Gulotta
a9a5d865f6 Test port open errors 2016-04-03 18:31:22 -04:00
Francis Gulotta
abc3c19565 Test & Fix a race condition when closing a port & trying to do anything
- isOpen() now pays attention to if we're in the middle of closing



Our faux state machine for opening and closing consists for 4 states

 - closed

 - opening

 - open

 - closing



Currently we only really care about if we're in open or not because that's when all our operations can happen. `#open` and `#close` care if they're opening or closing.
2016-04-03 01:05:41 -04:00
Rick Waldron
a79ff28d88 Dependency cleanup (quick pass)
- Eliminates use of node-pre-gyp as an actual module dependency (just a package dependency, this might even be just a devDep now?)

- Reduces 5 blocking fs operations to 1



Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2016-04-02 20:29:02 -04:00
Francis Gulotta
836064abe3 Fix double open
- Test for and stop the double opening of ports
 - More tests around opening and disconnecting
 - Fix mock darwin hardware to be async and hold off zalgo
 - Fix broken tests that counted on non async darwin hardware
2016-04-02 18:44:22 -04:00
Francis Gulotta
77851e2e75 Closing a port is better tested & correctly reports isOpen in it’s event
- Ports correctly respond to `isOpen` during a close event
 - cleanup some assertions
 - if a CI has a port to test with, open and close it


Bonus
 - Appveyor seems to think if you have a `&` in your commit message you’re trying to run a command
2016-03-31 15:20:07 -04:00
Francis Gulotta
4fbf6d923b Integration Tests!
We weren’t running these except on node v0.10 now we can! One day we might have a virtual serial port on each CI environment and we can test a lot more. That day isn’t today.

 - add another test for listing ports
 - mock some more things in our mock binding, specially the real bindings
2016-03-30 23:19:59 -04:00
Francis Gulotta
eed507969f Merge pull request #708 from voodootikigod/listunix-refactor
Move listUnix to its own module
2016-03-30 21:16:26 -04:00
Francis Gulotta
c93fb3b81f Move listUnix to its own module
- Refactor to fix bugs 
 - Remove the path behind `udevadm` as it’s not always in the same place but it’s so far it is always in the path
 - Tests listUnix, (`pnpId` assumes a lot about `udevadm` =( )
 - Adds `ttyMDF` to the list of serial ports for “High Speed UART device of Intel Medfield platform”
 - turn down the verboseness on appveyor nam installs
 - upgrade sandboxed-module for windows support

Fixes #650,  #651, #634, #697 and #621
2016-03-30 18:51:47 -04:00