protected void Flush(TimeSpan timeout) { if (!InterCharStopwatch.IsRunning) { // sometimes e.g. first frame transmit the stopwatch is not running and it is necessary to start it InterCharStopwatch.Reset(); InterCharStopwatch.Start(); } bool firstRun = true; do { GetICommunicationLayer.Flush(); if (firstRun) { firstRun = false; } else { InterCharStopwatch.Reset(); InterCharStopwatch.Start(); } }while (CheckCharTimeout(timeout, InterCharStopwatch)); InterCharStopwatch.Reset(); }
private void Flush(TimeSpan timeout) { FlushStopWatch.Reset(); FlushStopWatch.Start(); do { if (GetICommunicationLayer.CheckChar() == TCheckCharRes.DataInd) { GetICommunicationLayer.Flush(); } System.Threading.Thread.Sleep(1); }while (FlushStopWatch.Elapsed < timeout); FlushStopWatch.Stop(); }