C# - Decode server response (MSN, LSN)

  • Thread starter Thread starter Guilherme_
  • Start date Start date
G

Guilherme_

Guest
I'm trying to decode a server (TCP Client) response.

In the server manual, these are the rules:

Octet 001 : Command code
Octet 002-005 : Serial number
Octet 006 : MSB block number
Octet 007 : LSB block number

Octet 008 : 8 least significant bits of the first visible channel counter, nth interval (binary).

Octet 009 : MSN: 4 most significant bits of the first visible channel counter, nth interval (binary).
LSN: 4 most significant bits of the second visible channel counter, nth interval (binary).

Octet 010 : 8 least significant bits of the second visible channel counter, nth interval.
Octet 011 : 8 least significant bits of the third visible channel counter, nth interval.

Octet 012 : MSN: 4 most significant bits of the third visible channel counter, nth interval (binary).
LSN: 4 most significant bits of the first visible channel counter, nth + 1 interval (binary).

Octet 013 : 8 least significant bits of the first visible channel counter, nth + 1 interval (binary), follow the rest of intervals.

Octet 254 : 8 least significant bits of the third visible channel counter, nth + 54 interval (binary).

Octet 255 : MSN: 4 most significant bits of the third visible channel counter, nth + 54 interval (binary).
LSN: 4 most significant bits of the first visible channel counter, nth + 55 interval (binary).

Octet 256 : 8 least significant bits of the first visible channel counter, nth + 55 interval (binary).

Octet 257 : CRC LSB
Octet 258 : CRC MSB


Server response example:

524009232300020700001c000700001d0600001c000600001c0700001c000700001c0700001d000800001c0700001c000700001c0600001d000800001c0700001c000800001c0800001c000600001c0600001d000600001c0600001c000500001c0800001d000900001c0b00001c000d00001c0b00001d000e00001c0e00001c000d00001c0e00001c000d00001d0e00001c000e00001c0d00001d000d00001c0e00001c000e0000220e000024000e0000230e000024000d0000230d000024000c0000230f000024000e0000230a000024000a0000230900002400090000230c000024000e0000230e000024000d0000230c000024000c0000230e000026000e7f3b

The first octet checks, is the command 52. Octet 2-5 checks the serial number is 40092323. But the rest of the server response, I have no idea how to decode it.

Continue reading...
 
Back
Top