示例#1
0
        /// <summary> Directly executes the send command operation. </summary>
        /// <param name="sendCommand">    The command to sent. </param>
        /// <param name="sendQueueState"> Property to optionally clear the send and receive queues. </param>
        /// <returns> A received command. The received command will only be valid if the ReqAc of the command is true. </returns>
        public ReceivedCommand ExecuteSendCommand(SendCommand sendCommand, SendQueue sendQueueState)
        {
            // Disable listening, all callbacks are disabled until after command was sent

            ReceivedCommand ackCommand;

            lock (_sendCommandDataLock)
            {
                if (PrintLfCr)
                {
                    _communicationManager.WriteLine(sendCommand.CommandString());
                }
                else
                {
                    _communicationManager.Write(sendCommand.CommandString());
                }
                ackCommand = sendCommand.ReqAc ? BlockedTillReply(sendCommand.AckCmdId, sendCommand.Timeout, sendQueueState) : new ReceivedCommand();
            }
            return(ackCommand);
        }
示例#2
0
        /// <summary> Directly executes the send command operation. </summary>
        /// <param name="sendCommand">     The command to sent. </param>
        /// <param name="clearQueueState"> Property to optionally clear the send and receive queues. </param>
        /// <returns> A received command. The received command will only be valid if the ReqAc of the command is true. </returns>
        public ReceivedCommand ExecuteSendCommand(SendCommand sendCommand, ClearQueue clearQueueState)
        {
            // Disable listening, all callbacks are disabled until after command was sent

            lock (_sendCommandDataLock)
            {
                CurrentSentLine = CommandToString(sendCommand);


                if (PrintLfCr)
                {
                    _communicationManager.WriteLine(CurrentSentLine + _commandSeparator);
                }
                else
                {
                    _communicationManager.Write(CurrentSentLine + _commandSeparator);
                }
                InvokeEvent(NewLineSent);
                var ackCommand = sendCommand.ReqAc ? BlockedTillReply(sendCommand.AckCmdId, sendCommand.Timeout, clearQueueState) : new ReceivedCommand();
                return(ackCommand);
            }
        }