Hi, i wrote a function, it outputs an object message with an array in payload and bytes. I need those bytes to been sent into tcp packet. Actually it converts the buffer to a string and also add commas! how can I overcome it?
Here is the last parto fo the code:
var buffer = new Uint8Array (12);
buffer= [0x55, 0x33, 0x61, 0x39, 0x02, zona, comando1, comando2, comando3, checksum, 0xaa, 0xaa];
msg={payload:buffer};
return msg;
Here is the debug log in Node red, it sent correct to TCP:
24/1/2019, 12:06:41node: cfc34e3f.3c648msg : Object
object
payload: array[12]
[0 … 9]
0: 85
1: 51
2: 97
3: 57
4: 2
5: 0
6: 2
7: 16
8: 146
9: 164
[10 … 11]
10: 170
11: 170
_msgid: "2c01d1a2.dc9b5e"
here is what I sniff receiving the TCP packet:
<- {192.168.1.251/37272} 38 35 2C 35 31 2C 39 37 2C 35 37 2C 32 2C 30 2C 32 2C 31 36 2C 31 34 36 2C 31 36 34 2C 31 37 30 2C 31 37 30
which translated to ascii is:
85,51,97,57,2,0,2,16,146,164,170,170
it's the buffer, converted in decimal, then string, and added commas!
I need (hex) {192.168.1.251/37272} 55 33 61 39 02 etc.etc
thank you!