简体   繁体   中英

(Efe) Fire panel coding advice for a beginner?

I have a fire panel that I need to send data to, through serial port. I am using C#. I know how to send the data, I just don't know what to send. Could you check the below screenshot and give me an example? You would be saving my life.

If you could show me an example packet sequence, I would be in your debt. Thank you very much for your attention.

我正在使用的 PDF 文件的屏幕截图

It looks like to request the panel send back the query response you need to send an empty packet

byte[] data = new byte[6]
data[0] = 0xdb;
data[1] = msgId  ???
data[2] = 0x01;
data[3] = packetType ???
data[4] = 0; // No data
data[5] = checksum ???

I presume in the manual it says what msgId and packetType should be, and how to calculate the checksum (probably a sum of all the bytes).

--

My reading of the manual suggests that msgId is a number used to determine which response is for which request. eg you send msgId 1, and the response msg should also be 1. This allows you to send several messages at once, and process the responses later on. I would suggest you use a counter that increments for each message sent.

PacketType should be 0x05 which corresponds to PACKET_TYPE_QUERY_PANEL_DATA , which is the type of request you want the response to be. For example, you could send 0x08 PACKET_TYPE_TIME_STAMP to get the current time stamp of the panel.

To calculate the checksum you need to add up all the bytes between msgId and checksum, so:

byte checksum = data[1] + data[2] + data[3] + data[4];

Obviously, if you are sending data (where data[4] > 0) then you need to also add up all that data too:

for(int x=1; x < data[4];x++)
    checkSum += data[5+x];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM