node-red-contrib-buffer-parser
Advanced tools
Comparing version 2.5.1 to 3.0.1
@@ -214,4 +214,5 @@ | ||
*/ | ||
function setObjectProperty(obj, path, val) { | ||
const keys = path.split('.'); | ||
function setObjectProperty(obj, path, val, sep) { | ||
sep = sep == null ? "=>" : sep; | ||
const keys = path.split(sep); | ||
const lastKey = keys.pop(); | ||
@@ -398,4 +399,6 @@ const lastObj = keys.reduce((obj, key) => | ||
item.value = dataGetter(buffer, item.offset, item.length, bufferFunction, dataSize, item.mask, item.scale); | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -555,4 +558,6 @@ result.values.push(item.value); | ||
item.value = buf.toString(type, offset, _end); | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -589,4 +594,6 @@ result.values.push(item.value); | ||
} | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -609,4 +616,6 @@ result.values.push(item.value); | ||
item.value = bitData; | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -632,4 +641,6 @@ result.values.push(item.value); | ||
item.value = bitData; | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -651,4 +662,6 @@ result.values.push(item.value); | ||
item.value = dataBCD; | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -662,4 +675,6 @@ result.values.push(item.value); | ||
item.value = buf.slice(offset, _end); | ||
result.objectResults[item.name] = item; | ||
result.keyvalues[item.name] = item.value; | ||
// result.objectResults[item.name] = item; | ||
setObjectProperty(result.objectResults, item.name, item); | ||
// result.keyvalues[item.name] = item.value; | ||
setObjectProperty(result.keyvalues, item.name, item.value); | ||
result.arrayResults.push(item); | ||
@@ -666,0 +681,0 @@ result.values.push(item.value); |
{ | ||
"name": "node-red-contrib-buffer-parser", | ||
"version": "2.5.1", | ||
"description": "Convert values in a buffer, integer array or hex string into many different data type(s). Supports Big/Little Endian, BCD, byte swapping and much more", | ||
"version": "3.0.1", | ||
"description": "Node-red nodes to convert values to and from buffer/array. Supports Big/Little Endian, BCD, byte swapping and much more", | ||
"keywords": [ | ||
@@ -28,3 +28,4 @@ "node-red", | ||
"nodes": { | ||
"buffer-parser": "buffer-parser.js" | ||
"buffer-parser": "buffer-parser.js", | ||
"buffer-maker": "buffer-maker.js" | ||
} | ||
@@ -31,0 +32,0 @@ }, |
@@ -8,4 +8,5 @@ node-red-contrib-buffer-parser | ||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to convert values in a buffer, integer array or hex string into many different data type(s). Supports Big/Little Endian, BCD, byte swapping and much more. | ||
A pair of <a href="http://nodered.org" target="_new">Node-RED</a> nodes to convert values to and from buffer/array. Supports Big/Little Endian, BCD, byte swapping and much more. | ||
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIoAAABJCAYAAADi+75+AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAgPSURBVHhe7ZzfbxRVFMf5k4y7+mLif7BP+uJDH1ATNaSJGl4oTyZESYhAlBVW2G5LkyKhdGvQWh9EIzUpkNg0kEABI6YtNqSS0kAp8uMw5+69d8/cvTN75+7s7pQ5J/nS+XHvmTtzPnvvzDD37ACLra+vy6XOjP3E23byw6B4WB79MCgelkc/DIqH5dFPJChbW1vw8OFD+OW3C1AZHoNypZpYRyonrNtNVaqjsTpWHbFuTyr206rqyVPw+x9z8OTJEz9QVlZWoPztMLz3ZR3e2H8BXv1irit65bNfobD/Erx28AqrD3rz0J/wYXlGALO8vCwJaLVIUKpj38HbB36wBjdNMSjZ0DtfnYeTpyclAa1mBeXWrVvw+dExa2DTFoOSHR2onoHV1VVJQdisoFy+fFkMObbApi0GJTvCIejq1auSgrBZQbl48SIMHJiyBjZtMSjZ0btf/wwLCwuSgrD1AJR5+GD8imV7QwxKdtRHUObh4N//Bx6fwsLcdct+BiVLcgbl+fPn4i8FpWAENlY/3oVL1/6BklhXkDRs47baHlZ7UGahWCpAcdesZV871aFYKEAhUHHXtPCDy4WBuqVsL9XJOaWv1+VfCopiQZkGBW9gp6enYWJiAmrDNagcr8KR4XE4XJuAj7851xJgqxY2ha+N20tQppCs3IFBW/lAXQVl104olMqN5T17A0j2tpbpi7IDyqeVGTg8Ognl2imonBiGWq0mGEAWkAllAhTcMDU1JWhaXFwMCbednZx0g0WCQi0OElTXQVG9B4KioOm7sgHKJwEkZyfrkXFHJhQsO7CLQXpshZVw36GgZ2k7DJmgrK/BkK0ckTsoZT2MNANuueADcmhBSFT5wltkeScU92HZ5rCEKu6R9ffhcfZCEf3Q7UqyZyoS/6KMLB+u02if2t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ywT2QTUMdQyKLZuBBSI14z+UEaAHOdxC+4lf1TYBalBPDH+yDfIYQibEdJ8eKuX5DshjdDCE9jeH2/n7sCEQMecmz0PpGClH5ApKM8ByXVykGFBwOXLoMerRVBcyjUZkD6ZAUMcQ6xQ+taz2yWPKehoqXKdwBO3Wx6TtDrVVnrsJlaf6l8Mt0ODCJiwvuU9gdwaF/np0ADxBkb2GroNSgXLKj0L3W9qgJHodCgo5plgP6pk9lvJn9lLiPGKO5aEe5HCjagw3j9fuemU38LpH0YH2BEUGqUVYzwmUCMhke5S/UDI/Wz2jHQ04jAQ/WhHn24G6msOtNH4DBmsq0OF7kuVrNzQArvICRV90T1BsPYpSJz2KCQNdN/eZ0r2P9NfS06DSBaWrOdzqa0GtRw/g9Bnbjasdhji536OoiyzXFQwIhh6z5a+xHSgtF7xRT6w7gULqinVZni6b7TZBoW1T+9W6uU+fY3qgdD2HmwAFjWSE7CSpjnuPggHEC0/BCCQCK7cHgehVDjf1VIRq/voVHKjAxx7iq+X4gYiPcC9l7osCvDN1NYebBkXaxr/+kKDag5Ix2QK+jdW1HG4mKI1hKFwmiRiU/qsrOdxaQEFb/w92W8q6iEHJjtL93+PadRg6dzOk3ePJs0EqbTtQXmL1/DODJGJQsqPEoOBNDH8KmT9xDjeWkziHG6utOs7hxhPAXm51PAGMp5RGi6eUSourkMTYT7xtJz8Miofl0Q+D4mF59MM53DyURz/co3hY/vwAvABP3UATcHo5dQAAAABJRU5ErkJggg=='/> | ||
@@ -22,4 +23,23 @@ ## A picture is worth a thousand words | ||
## buffer-maker - Summary of functionality | ||
* Set-up a specification and convert multiple values into a buffer from... | ||
* int, int8, byte, uint, uint8, | ||
* int16, int16le, int16be, uint16, uint16le, uint16be, | ||
* int32, int32le, int32be, uint32, uint32le, uint32be, | ||
* bigint64, bigint64be, bigint64le, biguint64, biguint64be, biguint64le, | ||
* float, floatle, floatbe, double, doublele, doublebe, | ||
* 8bit, 16bit, 16bitle, 16bitbe, bool, | ||
* bcd, bcdle, bcdbe, | ||
* string, hex, ascii, utf8, utf16le, ucs2, latin1, binary, buffer | ||
* Specification is either configured by the built in UI or can be set by a msg/flow/global | ||
* Input data for each item to include in the final buffer can come from just about anywhere, making it very flexible... | ||
* a constant (e.g. a number, a string, a boolean, a JSON array) | ||
* a `msg` property (e.g from `msg.payload.myInteger`) | ||
* a `flow` property (e.g from `flow.myInteger`) | ||
* a `global` property (e.g from `global.myInteger`) | ||
* The final built buffer can be byte swapped one or more times. 16, 32 or 64 bit swaps are possible. The byte swaps are performed the data conversions like LE or BE functions (sometimes it is necessary to do multiple swaps) | ||
* The final buffer can be output to any `msg` property (defaults to `msg.payload`) | ||
* Built in help | ||
## Summary of functionality | ||
## buffer-parser - Summary of functionality | ||
@@ -26,0 +46,0 @@ * Set-up a specification and convert multiple parts of an array or buffer to... |
Sorry, the diff of this file is not supported yet
580130
20
1573
142