rafaelka / node-serialport-enocean-parser Goto Github PK
View Code? Open in Web Editor NEWESP3 parser for nodes serialport
License: Do What The F*ck You Want To Public License
ESP3 parser for nodes serialport
License: Do What The F*ck You Want To Public License
we need to log some fails in byte stream e.g.:
node-serialport-enocean-parser/ESP3Parser.js
Lines 58 to 69 in 2514534
node-serialport-enocean-parser/ESP3Parser.js
Lines 93 to 105 in 2514534
the examples are outdated... so write new ones and/or update existng ones.
new Buffer(...)
is deprecated and unsafe. Could it be replaced with Buffer.from(...)
in these places?
We must evaluate functionality of _flush() properly.
node-serialport-enocean-parser/ESP3Parser.js
Lines 151 to 155 in 2514534
Something else is important?
row 82 is not covered by tests:
node-serialport-enocean-parser/ESP3Parser.js
Lines 78 to 82 in 2514534
See: https://coveralls.io/builds/20408130/source?filename=ESP3Parser.js#L82
Some Packet without optional data is required.
When sending data to a compatible device and having a response from the TCMXXX, it is common that the packet does not have optional data (optional data length == 0), is then causes a fault in the state machine which does not trigger the "data" event and makes the next packet to be dropped in order to the machine to be in its correct state.
A fix is proposed in the #5 Pull Request
node-serialport-enocean-parser/ESP3Parser.js
Lines 99 to 102 in 2514534
is not covered by
node-serialport-enocean-parser/test/ESP3Parser.test.js
Lines 71 to 83 in 2514534
See: https://coveralls.io/builds/20408130/source?filename=ESP3Parser.js#L101
i think this is in your module, can you take a look at this?
this parser does not seem to work with serialport 5.x. Would be great having support for it, going forward. cheers.
a follow up for the disussion in #20
The current version 0.1.0 is now outdated. Any ETA to have the corresponding changes pushed to npmjs?
check every function and method for proper error handling and add tests passing invalid data everywhere.
I propose to try to recover from most bogus inputs as much as we can and only throw if absolutely necessary.
For cases where we recover it's best to log somewhere and outside of the parser we are not in a stream so emit("error") does not work... :-(
the question is again how to log.
we should add linting check in travis, to prevent messy code in master branch.
ERP3Packet should have a pack
method allowing basic encoding. see #36
i propose to split the code into two repositories. Following the Unix principle of doing one thing,well.
Here is the place for the simple parser with the only purpose of detecting packets.
it's a transformable stream that emits structs which should be immutable.
It' should be configurable to emit string or buffer instead.
Everithing else should move to the ESP3 Protocol implementation.
Here can be discussed which coding standards are currently for node important.
Following stuff was interesting for me by coding on tests:
see implementation in #36
I'm using your parser in node-enocean now. My receiving and testing code relies on having the complete telegram avaiable as a Buffer. currently i have to convert the ESPPackat returned by the parser back to a Buffer. It woud be very convienient if this would be part of the ESPPacket.
{
syncByte: 85,
header: { dataLength: 5, optionalLength: 1, packetType: 2 },
crc8Header: 219,
data: <Buffer 00 ff a0 87 00>,
optionalData: <Buffer 09>,
crc8Data: 228,
buffer: <Buffer 55 00 05 00 01...the complete packet as a Buffer...>
}
0.3.0
we should not only export the parsers, but also the classes and structs.
the crc8 calculation is useful in many places in a full enocean implementation. i would like to export that as well.
serialport and engine seem to be wrong for current implementation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.