WindowsIoT.TouchSample/Communication/BusDispatcher.cs
/// <summary>
/// Push an item into a dispatcher queue
/// </summary>
/// <param name="item">One of SerialComm instances</param>
Push an item into a dispatcher queue
Push an item into a dispatcher queue
public void EnqueueItem(SerialComm item)
        {
            lock (lockObj)
            {
                if (!serialComm.Contains<SerialComm>(item))
                    serialComm.Enqueue(item);
                if (serialComm.Count > 0)
                    _ARE.Set();
            }
            if (_timeout++ > 9) 
            {
                _timeout = 0;
                _fails++;
                _stats = new Stats() { packets = 0, badCRC = 0, rxLost = 0, txLost = 0 };
                _queue.Clear();
                asyncAction?.Cancel();
                _isRunning = false;
                Start();
            }
        }
public void EnqueueItem ( SerialComm item ) { lock ( lockObj ) { if ( ! serialComm . Contains < SerialComm > ( item ) ) serialComm . Enqueue ( item ) ; if ( serialComm . Count > 0 ) _ARE . Set ( ) ; } if ( _timeout ++ > 9 ) { _timeout = 0 ; _fails ++ ; _stats = new Stats ( ) { packets = 0 , badCRC = 0 , rxLost = 0 , txLost = 0 } ; _queue . Clear ( ) ; asyncAction ? . Cancel ( ) ; _isRunning = false ; Start ( ) ; } }
Push an item into a dispatcher queue
Push an item into a dispatcher queue
//Restart dispatcher if he's hanging
item
SerialComm
One of SerialComm instances
One of SerialComm instances