Esempio n. 1
0
 /// <summary> send command queue constructor. </summary>
 /// <param name="disposeStack"> DisposeStack. </param>
 /// <param name="cmdMessenger"> The command messenger. </param>
 /// <param name="sender">Object that does the actual sending of the command</param>
 /// <param name="sendBufferMaxLength">Length of the send buffer</param>
 public SendCommandQueue(DisposeStack disposeStack, CmdMessenger cmdMessenger, Sender sender, int sendBufferMaxLength)
     : base(disposeStack, cmdMessenger)
 {
     MaxQueueLength = 5000;
     QueueThread.Name = "SendCommandQueue";
     _sender = sender;
     _sendBufferMaxLength = sendBufferMaxLength;
     // _queueSpeed.Name = "SendCommandQueue";
 }
Esempio n. 2
0
        /// <summary> Initialises this object. </summary>
        /// <param name="transport">   The transport layer. </param>
        /// <param name="fieldSeparator">   The field separator. </param>
        /// <param name="commandSeparator"> The command separator. </param>
        /// <param name="escapeCharacter">  The escape character. </param>
        /// <param name="sendBufferMaxLength"> The maximunm size of the send buffer</param>
        private void Init(ITransport transport, char fieldSeparator, char commandSeparator,
            char escapeCharacter, int sendBufferMaxLength)
        {
            _controlToInvokeOn = null;

            _receiveCommandQueue  = new ReceiveCommandQueue(DisposeStack, this);
            _communicationManager = new CommunicationManager(DisposeStack, transport, _receiveCommandQueue, commandSeparator, fieldSeparator, escapeCharacter);
            _sender               = new Sender(_communicationManager, _receiveCommandQueue);
            _sendCommandQueue     = new SendCommandQueue(DisposeStack, this, _sender, sendBufferMaxLength);

            _receiveCommandQueue.NewLineReceived += (o, e) => InvokeNewLineEvent(NewLineReceived, e);
            _sendCommandQueue.NewLineSent        += (o, e) => InvokeNewLineEvent(NewLineSent, e);

            _fieldSeparator = fieldSeparator;
            _commandSeparator = commandSeparator;
            PrintLfCr = false;

            Command.FieldSeparator = _fieldSeparator;
            Command.CommandSeparator = _commandSeparator;
            Command.PrintLfCr = PrintLfCr;

            Escaping.EscapeChars(_fieldSeparator, _commandSeparator, escapeCharacter);
            _callbackList = new Dictionary<int, MessengerCallbackFunction>();
            //CurrentSentLine = "";
            CurrentReceivedLine = "";
        }