예제 #1
0
        public void ExecuteAsync(
            ICommClient port,
            ModbusCommand command)
        {
            var data = new ClientCommData(this);

            data.UserData = command;
            Codec.ClientEncode(data);
            port.QueryAsync(data);
        }
예제 #2
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));
        }
예제 #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(), data.IncomingData.Length);
            }
            return(rVal);
        }