示例#1
0
        public void AddHeader(ref byte[] buffer)
        {
            // Add Function Code
            UsefulMethods.InsertElementArray(ref buffer, 0, FunctionCode);

            // Add Application Control
            UsefulMethods.InsertElementArray(ref buffer, 0, ApplicationControl);
        }
示例#2
0
        private static byte[] InsertBytes(byte[] buffer, ushort data)
        {
            byte lsb = (byte)(data & 0xFF);
            byte hsb = (byte)((data >> 8) & 0xFF);

            UsefulMethods.InsertElementArray(ref buffer, 0, hsb);
            UsefulMethods.InsertElementArray(ref buffer, 0, lsb);
            return(buffer);
        }
示例#3
0
        public void serialize(ref byte[] buffer)
        {
            // Add Header
            byte header = 0;

            header |= (byte)(FIN << 7);
            header |= (byte)(FIR << 6);
            header |= seq;
            UsefulMethods.InsertElementArray(ref buffer, 0, header);
        }
示例#4
0
        public void AddHeader(ref byte[] buffer)
        {
            // Add Crc
            UInt16 Crc = GetCRC(ref buffer);

            buffer = InsertBytes(buffer, Crc);

            // Add src and dest
            buffer = InsertBytes(buffer, source);
            buffer = InsertBytes(buffer, destination);

            // Add Control byte
            UsefulMethods.InsertElementArray(ref buffer, 0, controlByte);

            // Add Length
            length = (byte)(buffer.Count()); // yet to add the start bytes but remove the CRC bytes
            UsefulMethods.InsertElementArray(ref buffer, 0, length);

            // Add Start Bytes
            startBytes = 0x6405;
            buffer     = InsertBytes(buffer, startBytes);
        }