1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
Commit Graph

40 Commits

Author SHA1 Message Date
Dave Conway-Jones
0b11d68c02
Let serialport wiatfor a char before starting output 2019-04-04 22:20:21 +01:00
Dave Conway-Jones
b91f61d56f
Add serialport request node to readme (docs only) 2019-03-06 17:45:45 +00:00
Dave Conway-Jones
602586ad82
Bump serialport to latest 0.7 2019-02-12 13:31:06 +00:00
Dave Conway-Jones
73a7b2bc41
bump serialport version 2018-08-11 14:06:25 +01:00
iurly
27a1038993 Serial request (#426)
* serial: simplify serialPool.get

serialPool.get() has a lot of arguments.
Just pass the whole serialConfig object instead.
Also introduce early termination to remove one level of indentation.
(Just set your diff tool to ignore all whitespace changes to see
how very little this patch changes)

* serial: move splitting logic onto serialPool

All SerialIn and SerialOut nodes for a given port
share the same splitting logic as it is indeed
set by the common configuration node.

Move the code from SerialIn into serialPool so that
it can be reused by the serial request node.
Notice how the 'data' event will no longer carry
single bytes, but the whole payload instead.

Also move the output encoding logic into serialPool.

* serial: add serial request node

Add a "serial request" node to handle simple request/response
protocols. This node allows for multiple instances, all
sharing the same underlying device.
Responses coming from the serial line will only be propagated
to the output of the node where the request was originally received
(contrary to the "serial in" nodes which all emit the data
received from the serial line).

Every request received as an input to the node, is transmitted
to the serial line, and a matching response must be received
before the next one can be transmitted.
Any input message received in the meantime is internally enqueued.

The node is essentially a merge of serial in and serial out.
It shares the same configuration with serial in and serial out
for any given port and will not affect the behavior of the
existing nodes.
This means you can use, alongside with the request node:
- as many serial in nodes as you want -- e.g. to "sniff"
- serial out to inject mailicious/tampering data onto the serial
  line, skipping the queueing mechanism

* serial request: provide some visual feedback on the node

add status indication:
- yellow "waiting" when a message is enqueued for sending
- green "OK" after an answer is received
- red "timeout" after a timeout occurs

More sofisticated output would include an indication of the number of messages
enqueued and the actual timeout remaining after sending.

* serial request: make default response timeout configurable

Notice it's a global setting (i.e. stored in the configuration node)
as opposed to per-node, but it can be overridden by setting msg.timeout.

* serial request: cosmetic changes

- added documentation about msg.port
- timeout field made wider so to accommodate default value of 10000ms
- replaced harcoded text with localizable strings for
  "waiting" and "timeout" messages

* serial: cleanup: remove node.tout

this was probably some leftover code from previous implementations.
Now all timeouts are handled within the connection objects.

* serial: cleanup: set obj.tout to null after clearing it

clearing a Timeout without setting it back to null *might* have
adverse effects on later code which would check its null-ity.
Let's just do it.

* serial: cosmetic: add some comments

* serial request: fix "split on timeout" case

In the case of "split on timeout" case, we're reusing the same
.tout for two different purposes:
1) to send a timeout message, in case no answer is received at all [request]
2) to split messages, after receiving the first character [in+request]

So in the case of serial request, checking whether .tout is already
set is no longer a valid condition for 2).
Let's just check whether i === 1, and clear the timeout set up by 1)
if it's already there.

* serial: add "split on silence" behavior

add a fourth logic to split incoming data into messages.
The existing "split on timeout" logic starts the timeout upon
reception of the first character.
This might lead to unwanted behavior if for instance Node-RED is
restarted, as data might accumulate into OS buffers (see #410).
A different logic might be to only emit a message when enough time
has passed, without any new data being received (line silent), a.k.a.
interbyte timeout.
2018-07-09 11:14:08 +01:00
Dave Conway-Jones
76a221919a
Update Readme to remove NMA node
and add 2018 to serialport copyright
2018-06-13 22:13:22 +01:00
Dave Conway-Jones
997458c78e
Fix serial port add char logic
to close #450
2018-06-02 13:24:57 +01:00
Dave Conway-Jones
dca9dfccc1
bump serial port and arduino nodes 2018-05-09 22:04:29 +01:00
Dave Conway-Jones
0253f67882
Add msg.port to serial port input node 2018-03-01 18:21:22 +00:00
Dave Conway-Jones
127fb6ac0c
clarify serial port timeout doc info 2018-02-19 19:21:52 +00:00
Dave Conway-Jones
17886b7296
don't add time value to output when not asked for
to Close #399
2018-01-28 17:00:48 +00:00
Dave Conway-Jones
51124f456d
bump serial package 2017-12-18 18:32:51 +00:00
1ft-seabass
98dd2b858f Update 25-serial.json (#381)
For serial.label.serial , I adapted the name to the current jp translate rule.
2017-12-18 18:31:50 +00:00
Dave Conway-Jones
8c0c7ee272
bump serial port package 2017-11-23 20:58:56 +00:00
1ft-seabass
d11e8d5b15 Update ja 25-serial.json (#377)
* Add English messages of serialport node
2017-11-23 21:58:10 +01:00
Dave Conway-Jones
388ad11b72
Upgrade to latest underlying npm to support node8.x LTS 2017-11-04 17:12:48 +00:00
Dave Conway-Jones
f6e71bf962
"revert" serial port and base64 nodes forwards....
undo buffer syntax updates
2017-06-30 19:52:20 +01:00
Dave Conway-Jones
6c3c16f210
update "core" extra nodes to use newer Buffer syntax 2017-06-24 13:53:22 +01:00
Dave Conway-Jones
316a2fd272 Re-lint a load of nodes 2017-01-29 17:45:44 +00:00
Dave Conway-Jones
dcd2ede2c4 bump serial port package 2017-01-09 20:53:43 +00:00
Dave Conway-Jones
a7247e898a Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
Dave Conway-Jones
36e834fdf1 bump serial port to 4.0.3 library 2016-10-13 14:12:08 +01:00
Dave Conway-Jones
0321bf8150 add a v0.3 serial port to help with node5/6 2016-05-26 19:41:47 +01:00
Dave Conway-Jones
49b9277c26 Bump underlying serial port nam version 2016-04-14 09:17:40 +01:00
Dave Conway-Jones
68bd4cc036 Add "other" baud rates to serialport
to Close #194
Uses typed widget so needs NR 0.13.4.
2016-04-01 08:55:58 +01:00
Dave Conway-Jones
eff8327971 Info/Doc style updates to core/pi nodes 2016-03-02 13:27:52 +00:00
Dave Conway-Jones
dd250a77bc core to Pi node-red-nodes info updates
to be more consistent style
2016-02-12 13:14:12 +00:00
Dave Conway-Jones
d1e5025566 Finally upgrade serial port to serialport2
To address #139
2015-12-10 12:49:12 +00:00
Dave Conway-Jones
b6bbcbd52f Stop serialport open loop 2015-11-09 15:57:10 +00:00
Dave Conway-Jones
fe2ae9c0a3 Let serialport node only report errors once
instead of repeating
2015-11-02 10:40:53 +00:00
Dave Conway-Jones
834115907c update serial port package ver so can republish 2015-08-25 21:04:27 +01:00
Dave Conway-Jones
2d5a71aec2 correct syntax for serial port standalone install 2015-08-25 14:04:46 +01:00
Nick O'Leary
5dc0c0e968 Fix merge conflicts on i18n 2015-07-15 10:24:44 +01:00
Nick O'Leary
ee5ff8b010 Send status message id to be nls'd in editor 2015-07-07 21:31:28 +01:00
dceejay
56bb10642a Update Note(s) in READMEs for all moved out nodes.
redis, mongo, email, feedparse, twitter, irc, arduino, serialport
2015-06-16 21:37:22 +01:00
Nick O'Leary
fd4b319af9 Fix misnamed nls message in serial node 2015-06-16 16:13:55 +01:00
dceejay
ba0e2c3796 Merge linting error fixes into i18n branch of n-r-n 2015-06-16 14:38:36 +01:00
Nick O'Leary
da209a6b66 Update core nodes to pull common msgs from node-red ns 2015-06-16 11:16:29 +01:00
Nick O'Leary
7d011dac99 Add i18n content for moved core nodes 2015-06-16 10:36:19 +01:00
dceejay
73319a20b9 add serialport to node-red-nodes, fix lint etc etc 2015-06-13 18:53:02 +01:00