예제 #1
0
        private void ThrowIfFail(bool result, CommQueue queue)
        {
            if (!result)
            {
                string msg;
                var    error = queue.GetLastError(connect, out msg);

                throw new Exception(msg);
            }
        }
예제 #2
0
        /// <summary>
        /// Handles the reception and transmission of messages
        /// </summary>
        protected virtual void CommManager()
        {
            while (!isStopping)
            {
                lock (CommQueue)
                {
                    if (CommQueue.Count > 0)
                    {
                        if (CommQueue.Peek().TargetID == ID)
                        {
                            OnMessageRxEvent(CommQueue.Dequeue());
                        }
                    }
                }

                if (TxQueue.Count > 0)
                {
                    CommQueue.Enqueue(TxQueue.Dequeue());
                }

                Thread.Sleep(100);
            }
        }