예제 #1
0
        /// <summary>
        /// Entry-point for submitting any command
        /// </summary>
        /// <param name="port">The client port for the transport</param>
        /// <param name="command">The command to be submitted</param>
        /// <returns>The result of the query</returns>
        public CommResponse ExecuteGeneric(ICommClient port, ModbusCommand command)
        {
            var data = new ClientCommData(this)
            {
                UserData = command
            };

            Codec.ClientEncode(data);

            return(port.Query(data));
        }
예제 #2
0
        public CommResponse ExecuteGeneric(
            ICommClient port,
            ModbusCommand command, int retries, int timeout)
        {
            var data = new ClientCommData(this);

            data.UserData = command;
            data.Retries  = retries;
            data.Timeout  = timeout;
            this.Codec.ClientEncode(data);

            return(port
                   .Query(data));
        }
예제 #3
0
        /// <summary>
        /// Entry-point for submitting any command
        /// </summary>
        /// <param name="port">The client port for the transport</param>
        /// <param name="command">The command to be submitted</param>
        /// <returns>The result of the query</returns>
        public CommResponse ExecuteGeneric(
            ICommClient port,
            ModbusCommand command)
        {
            var data = new ClientCommData(this);
            data.UserData = command;
            Codec.ClientEncode(data);

            var rVal = port.Query(data);
            if (data.OutgoingData != null)
                OnOutgoingData(data.OutgoingData.ToArray());
            if (data.IncomingData != null)
                OnIncommingData(data.IncomingData.ToArray());
            return rVal;
        }
예제 #4
0
        /// <summary>
        /// Entry-point for submitting any command
        /// </summary>
        /// <param name="port">The client port for the transport</param>
        /// <param name="command">The command to be submitted</param>
        /// <returns>The result of the query</returns>
        public CommResponse ExecuteGeneric(
            ICommClient port,
            ModbusCommand command)
        {
            var data = new ClientCommData(this);

            data.UserData = command;
            Codec.ClientEncode(data);

            var rVal = port.Query(data);

            if (data.OutgoingData != null)
            {
                OnOutgoingData(data.OutgoingData.ToArray());
            }
            if (data.IncomingData != null)
            {
                OnIncommingData(data.IncomingData.ToArray(), data.IncomingData.Length);
            }
            return(rVal);
        }