Ejemplo n.º 1
0
 /// <summary>
 /// Sends a command to the transport layer with or without a LFCR depending on the state of PrintLfCr
 /// </summary>
 /// <param name="sendCommand"></param>
 private void WriteCommand(SendCommand sendCommand)
 {
     if (PrintLfCr)
     {
         WriteLine(sendCommand.CommandString());
     }
     else
     {
         Write(sendCommand.CommandString());
     }
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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);
        }
        /// <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)
            {
                sendCommand.CommunicationManager = this;
                sendCommand.InitArguments();

                if (sendCommand.ReqAc)
                {
                    // Stop processing receive queue before sending. Wait until receive queue is actualy done
                    _receiveCommandQueue.Suspend();
                }

                if (PrintLfCr)
                {
                    WriteLine(sendCommand.CommandString());
                }
                else
                {
                    Write(sendCommand.CommandString());
                }

                ackCommand = sendCommand.ReqAc ? BlockedTillReply(sendCommand.AckCmdId, sendCommand.Timeout, sendQueueState) : new ReceivedCommand();
                ackCommand.CommunicationManager = this;
            }

            if (sendCommand.ReqAc)
            {
                // Stop processing receive queue before sending
                _receiveCommandQueue.Resume();
            }

            return(ackCommand);
        }