Beispiel #1
0
        /// <summary>
        /// 发送并读取报文
        /// </summary>
        /// <param name="agent">通信代理</param>
        /// <param name="cmd">命令</param>
        /// <param name="data">正文</param>
        /// <returns>响应的报文</returns>
        internal static byte[] SendAndRead(this SerialPortsUtils.Agents.Agent agent, byte cmd, byte[] data = null)
        {
            var packet = PacketUtils.BuildSend(cmd, data);
            var reader = new ReadFilter(cmd);

            return(agent.SendAndRead(packet, reader));
        }