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";
 }
 /// <summary>
 /// Remove all references and remove children
 /// </summary>
 /// <param name="disposing">If true, cleanup</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         if (disposing)
         {
             DisposeStack.Dispose();
             DisposeStack = null;
             IsDisposed   = true;
         }
     }
 }
Esempio n. 3
0
        /// <summary> Initializes this object. </summary>
        /// <param name="receiveCommandQueue"></param>
        /// <param name="commandSeparator">    The End-Of-Line separator. </param>
        /// <param name="fieldSeparator"></param>
        /// <param name="escapeCharacter"> The escape character. </param>
        /// <param name="disposeStack"> The DisposeStack</param>
        /// /// <param name="transport"> The Transport Layer</param>
        public void Initialize(DisposeStack disposeStack, ITransport transport, ReceiveCommandQueue receiveCommandQueue, char commandSeparator, char fieldSeparator, char escapeCharacter)
        {
            disposeStack.Push(this);
            _transport                  = transport;
            _receiveCommandQueue        = receiveCommandQueue;
            _transport.NewDataReceived += NewDataReceived;
            _commandSeparator           = commandSeparator;
            _fieldSeparator             = fieldSeparator;
            _escapeCharacter            = escapeCharacter;

            _isEscaped = new IsEscaped();
        }
Esempio n. 4
0
        /// <summary> Constructor. </summary>
        /// <param name="disposeStack">Dispose stack to add itself to</param>
        /// <param name="interval"> The execution interval. </param>
        /// <param name="action">   The action to execute. </param>
        public TimedAction(DisposeStack disposeStack, double interval, Action action)
        {
            disposeStack.Push(this);
            _action      = action;
            _threadState = new ThreadState {
                IsRunning = false
            };


            _actionTimer = new Timer(interval)
            {
                Enabled = false, SynchronizingObject = null
            };
            _actionTimer.Elapsed += OnActionTimer;
        }
Esempio n. 5
0
        /// <summary> command queue constructor. </summary>
        /// <param name="disposeStack"> DisposeStack. </param>
        /// <param name="cmdMessenger"> The command messenger. </param>
        public CommandQueue(DisposeStack disposeStack, CmdMessenger cmdMessenger)
        {
            CmdMessenger = cmdMessenger;
            disposeStack.Push(this);

            // Create queue thread and wait for it to start
            QueueThread = new Thread(ProcessQueue)
            {
                Priority = ThreadPriority.Normal
            };
            QueueThread.Start();
            while (!QueueThread.IsAlive && QueueThread.ThreadState != ThreadState.Running)
            {
                Thread.Sleep(TimeSpan.FromMilliseconds(25));
            }
        }
Esempio n. 6
0
 /// <summary> Constructor. </summary>
 /// <param name="receiveCommandQueue"></param>
 /// <param name="commandSeparator">    The End-Of-Line separator. </param>
 /// <param name="fieldSeparator"></param>
 /// <param name="escapeCharacter"> The escape character. </param>
 /// <param name="disposeStack"> The DisposeStack</param>
 /// <param name="transport"> The Transport Layer</param>
 public CommunicationManager(DisposeStack disposeStack, ITransport transport, ReceiveCommandQueue receiveCommandQueue, char commandSeparator, char fieldSeparator, char escapeCharacter)
 {
     Initialize(disposeStack, transport, receiveCommandQueue, commandSeparator, fieldSeparator, escapeCharacter);
 }
Esempio n. 7
0
        private char _escapeCharacter;                                      // The escape character


        /// <summary> Default constructor. </summary>
        /// /// <param name="disposeStack"> The DisposeStack</param>
        /// <param name="transport"> The Transport Layer</param>
        /// <param name="receiveCommandQueue"></param>
        public CommunicationManager(DisposeStack disposeStack, ITransport transport, ReceiveCommandQueue receiveCommandQueue)
        {
            Initialize(disposeStack, transport, receiveCommandQueue, ';', ',', '/');
        }