Пример #1
0
            //Public
            public MBAP(PDU pdu, byte unitIdentifier = 1, int transactionIdentifier = 1, int protocolIdentifier = 0)
            {
                PDU = pdu;

                Data.Add(HighByte(transactionIdentifier));
                Data.Add(LowByte(transactionIdentifier));

                Data.Add(HighByte(protocolIdentifier));
                Data.Add(LowByte(protocolIdentifier));

                Data.Add(HighByte(pdu.Data.Count + 1));
                Data.Add(LowByte(pdu.Data.Count + 1));

                Data.Add(unitIdentifier);
            }
Пример #2
0
            public MBAP(PDU pdu, byte[] data)
            {
                PDU = pdu;

                if (data.Length < 10)
                {
                    Data.AddRange(new byte[7]);

                    PDU.Data.AddRange(new byte[7]);
                    PDU.Data[0] = 255;
                    return;
                }

                List <byte> data_list = new List <byte>(data);

                Data.AddRange(data_list.GetRange(0, 7));
                PDU.Data.AddRange(data_list.GetRange(7, this.Length - 1));

                if (PDU.Data.Count < this.Length - 1)
                {
                }
            }