Got a specific example which got me confused.
Configuration:
Swap: none
Output: key/value
Type: int16 (be)
Length: 1
Offset: 0
No mask
Calculation: 1
Input msg.payload
is [35800,0]
.
Output: -29736
How is output determined here?
First value in input (35800) translates to 2 bytes 10001011'11011000
. 2nd value translates to 00000000'00000000
. Output (-29736) translates to 11111111'11111111'10001011'11011000
. So the first value is pushed right to byte nr 3 and 4. First 2 bytes are all 1s?
Is the int16 (be) supposed to match each individual value in the array (2 x 16bit values)?
Example flow:
[
{
"id": "d0de03fa646462c8",
"type": "inject",
"z": "5ed12f1487755951",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 320,
"y": 240,
"wires": [
[
"665e84c517835998"
]
]
},
{
"id": "e32552b274e94be4",
"type": "buffer-parser",
"z": "5ed12f1487755951",
"name": "",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "int16be",
"name": "item1",
"offset": 0,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
}
],
"swap1": "",
"swap2": "",
"swap3": "",
"swap1Type": "swap",
"swap2Type": "swap",
"swap3Type": "swap",
"msgProperty": "payload",
"msgPropertyType": "str",
"resultType": "keyvalue",
"resultTypeType": "return",
"multipleResult": false,
"fanOutMultipleResult": false,
"setTopic": true,
"outputs": 1,
"x": 650,
"y": 240,
"wires": [
[
"d62e00ae1b7685f0"
]
]
},
{
"id": "d62e00ae1b7685f0",
"type": "debug",
"z": "5ed12f1487755951",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 240,
"wires": []
},
{
"id": "665e84c517835998",
"type": "function",
"z": "5ed12f1487755951",
"name": "function 2",
"func": "msg.payload = [35800, 0];\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 480,
"y": 240,
"wires": [
[
"e32552b274e94be4"
]
]
}
]