object SendBufferProcess(object o) { while (!TxQueue.IsEmpty) { try { Byte[] packet = TxQueue.Dequeue(); #if DEBUG //CrestronConsole.Print("Samsung Tx: "); //Tools.PrintBytes(packet, packet.Length); #endif if (programStopping) { TxQueue.Clear(); return(null); } else { this.ComPort.Send(packet, packet.Length); CrestronEnvironment.AllowOtherAppsToRun(); Thread.Sleep(10); } } catch (Exception e) { if (e.Message != "ThreadAbortException") { ErrorLog.Exception(string.Format("{0} - Exception in tx buffer thread", GetType().Name), e); } } } return(null); }
/// <summary> /// Stops the current processes, and clears the TxQueue /// </summary> public virtual void Dispose() { isStopping = true; while (CommManagerThread.IsAlive) { ; } TxQueue.Clear(); }