private SiDriverState Startup() { SiDriverState currentState = SiDriverState.STARTUP.Send(writer, siHandler) .Receive(messageQueue, writer, siHandler); return(currentState); }
public void Run() { try { SiDriverState currentState = StartupBootstrap(); while (IsAlive(currentState)) { GecoSiLogger.StateChanged(currentState.GetType().Name); currentState = currentState.Receive(messageQueue, writer, siHandler); } if (currentState.IsError()) { siHandler.NotifyError(CommStatus.FatalError, currentState.Status()); } } catch (ThreadInterruptedException e) { // normal way out } catch (Exception e) { e.PrintStackTrace(); GecoSiLogger.Error(" #run# " + e); } finally { Stop(); } }
private bool IsAlive(SiDriverState currentState) { return(thread.IsAlive && !currentState.IsError()); }