Buffer value adding - SIA Protocol

Hello,
I am trying to send alarm alerts messages using SIA - DC09 protocol ( https://www.yumpu.com/en/document/view/47594214/dc-09-preparing-for-ansi-public-review-security-industry- )
Already look at the forum, don't succeed in finding an answer...

I have to send through TCP Buffer a message once converted should be lokking like that :
[10,49,49,70,70,48,48,50,53,34,78,65,75,34,48,48,48,48,82,48,76,48,65,48,91,93,95,49,52,58,53,52,58,50,54,44,48,52,45,49,50,45,50,48,50,48,13]

from a string : "11FF0025"NAK"0000R0L0A0_14:54:26,04-12-2020"

For this, I use Function : var data = Buffer.from(msg.payload); and TCP Request node.

It works well to send.

In order to be well read, I need to add 0x0a (10) and 0x0d (13) at the beginning and the end of the buffer (bold digit in the message above.

Do you have any idea how I can add these hexa values to my buffer array before sending ?

Thank you in advance

var data = Buffer.from("\n"+msg.payload+"\r");
1 Like

Thank you for your help !
It works with the full fonction :

var data = Buffer.from("\n"+msg.payload+"\r");
msg.payload = data;
return msg;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.