public byte[] BuildRequest() { var Request = new byte[ReqSize]; Request[0] = (byte)(Device as RTU_Device).Address; var PDUReq = PDU.BuildRequest(); PDUReq.CopyTo(Request, 1); var crc = CRC.Get(Request, PDUReq.Length + 1); Request[PDUReq.Length + 1] = ((byte)(crc & 0xFF)); Request[PDUReq.Length + 2] = ((byte)(crc >> 8)); return(Request); }
public byte[] BuildRequest() { var Request = new byte[ReqSize]; Header = new MBAP(Device.Address, PDU.ReqSize); Request[0] = (byte)((Header.TransactionID >> 8) & 0xFF); Request[1] = (byte)(Header.TransactionID & 0xFF); Request[2] = (byte)((Header.ProtocolID >> 8) & 0xFF); Request[3] = (byte)(Header.ProtocolID & 0xFF); Request[4] = (byte)((Header.Lenght >> 8) & 0xFF); Request[5] = (byte)(Header.Lenght & 0xFF); Request[6] = (byte)(Header.UnitID); var PDUReq = PDU.BuildRequest(); PDUReq.CopyTo(Request, 7); return(Request); }