Home AMX User Forum AMXForums Archive Threads AMX Hardware
Options

DVR communication

Hello all,
I need some help with commucations protocol DVR Infinity NDR-X5416P.
I have a litle information about protocol.
This is message format.
<BOM><ID>:<Class>:<Code>[:Operands]:<Checksum>[EOM]

Where
Symbol Value Description
: Field delimiter
<BOM> @ Beginning of message (for command)
< Beginning of message (for reply)
<ID> 00~99 Device ID
<Class> DR Device Class (?DR? for DVR systems)
<Code> AA~zz Op-code (see below)
<Operands> Optional operands defined for each operation
<Checksum> 00~99 Checksum (sum of ASCII codes before checksum discarding overflow)
[EOM] ^J^M End of message (optional: only for convenience of users using general terminal)

I am wrote function to get checksum:

Define_Function Char[256] GetFullPacket (Char Packet[])
{
local_var volatile Char ChkSum;
local_var volatile Integer i;

ChkSum = 0;

For (i = 1; i <= Length_String(Packet); i++)

ChkSum = ChkSum + Packet;

ChkSum = ChkSum + $3A; // $3A = ASCII code of ":" sing


ChkSum = ChkSum % 100;


return "Packet, ':', Format('%02d', ChkSum)";
}

When com port online :

Send_Command Data.Device, 'SET BAUD 9600,N,8,1';
SEND_STRING DATA.DEVICE, GetFullPacket("'@00: DR:vs'");

In protocol says "Checksum -sum of ASCII codes before checksum discarding overflow".
This Function is correct?

And another question - the DVR have 1 RS 485 and 1 RS 232. I tryed them - dont work.
Where is mistake?

Comments

Sign In or Register to comment.