Beispiel #1
0
        override protected byte[] GetCommandBuffer()
        {
            var commandHeader = new byte[] { 0x02, 0x00 };
            var command       = new byte[commandHeader.Length /* header */ + 2 /* payload */ + 2 /* numberOfTracks */ + 2 /* id */ + 1 /* checkSum */];

            Array.Copy(commandHeader, 0, command, 0, commandHeader.Length);

            int offset = commandHeader.Length;

            byte[] payload = HexUtils.GetBytes((Int16)(512 + 896));
            Array.Copy(payload, 0, command, offset, payload.Length);
            offset += 2;

            byte[] numberOfTracks = HexUtils.GetBytes((Int16)1);
            Array.Copy(numberOfTracks, 0, command, offset, numberOfTracks.Length);
            offset += 2;

            byte[] idBytes = HexUtils.GetBytes(_status.Id);
            Array.Copy(idBytes, 0, command, offset, idBytes.Length);
            offset += 2;

            command[offset] = HexUtils.CheckSum(command, commandHeader.Length, 2 /* payload */ + 2 /* numberOfTracks */ + 2 /* id */);
            return(command);
        }