public override async Task StopAsync(bool isClose = false) { //Logger.Error("停止考试模块"); Speaker.CancelAllAsync(); //Logger.Error("停止语音播报"); await ExamManager.StopExamAsync(isClose); }
public override async Task StopAsync(bool isClose = false) { //Logger.DebugFormat("停止考试模块"); Speaker.CancelAllAsync(); await ExamManager.StopExamAsync(isClose); //TODO:把ExamManager=null,整个考试流程应该就停止了 }
public override async Task StopAsync(bool close = false) { Speaker.CancelAllAsync(); if (LightExamItem != null) { await LightExamItem.StopAsync(); Speaker.CancelAllAsync(); } }
protected virtual async Task StartExamAsync(ExamContext context) { if (!context.IsExaming) { return; } await StartExamItemAutoAsync(context, ExamItemCodes.CommonExamItem); //启用绕车一周 to 在车上进行验证探头 if (Settings.PrepareDrivingEnable) { var prepareTask = StartExamItemAutoAsync(context, ExamItemCodes.PrepareDriving); await prepareTask; await Task.Run(() => { while (context.IsExaming && prepareTask.Result.State != ExamItemState.Finished) { Thread.Sleep(100); } }); } if (!context.IsExaming) { Logger.Debug("考试结束:context.IsExaming"); return; } //吉首白天夜间都要灯光模拟 if (context.ExamTimeMode == ExamTimeMode.Day && Settings.CheckLightingSimulation && Settings.SimulationsLightOnDay || context.ExamTimeMode == ExamTimeMode.Night && Settings.CheckLightingSimulation && Settings.SimulationsLightOnNight) { Speaker.CancelAllAsync(false); //等待关闭发动机 var lightTask = StartExamItemAutoAsync(context, ExamItemCodes.Light); await lightTask; await Task.Run(() => { while (context.IsExaming && lightTask.Result.State != ExamItemState.Finished) { Thread.Sleep(100); } }); } if (!context.IsExaming) { Logger.Debug("考试结束:context.IsExaming"); return; } await StartExamItemAutoAsync(context, ExamItemCodes.Start); }
public override async Task StartAsync(ExamContext context) { var signalSet = Singleton.GetCarSignalSet; signalSet.Clear(); var executionContext = new ExamItemExecutionContext(context); executionContext.ItemCode = ExamItemCodes.Light; Speaker.CancelAllAsync(); TokenSource = new CancellationTokenSource(); if (LightExamItem == null) { LightExamItem = (ILightExamItem)Singleton.GetProviderFactory.CreateExamItem(ExamItemCodes.Light); } await LightExamItem.StartAsync(executionContext, TokenSource.Token); }
/// <summary> /// 特殊要求:灯光完成后5秒才能报起步(泸州) /// </summary> /// <param name="context"></param> /// <returns></returns> protected override async Task StartExamAsync(ExamContext context) { if (!context.IsExaming) { return; } Logger.Error("TriggerStartExamAsync"); //不能二次触发 //判断下如果正在开始考试 //判断下如果就不能触发 if (Constants.IsTriggerStartExam) { Logger.Error("已经触发过考试流程"); } Constants.IsTriggerStartExam = true; if (Settings.PrepareDrivingEnable) { var prepareTask = StartExamItemAutoAsync(context, ExamItemCodes.PrepareDriving); await prepareTask; await Task.Run(() => { while (context.IsExaming && prepareTask.Result.State != ExamItemState.Finished) { Thread.Sleep(100); } }); } await StartExamItemAutoAsync(context, ExamItemCodes.CommonExamItem); if (!context.IsExaming) { Logger.Info("考试结束:context.IsExaming"); return; } //上车准备完成之后就启动灯光模拟 //吉首白天夜间都要灯光模拟 if (context.ExamTimeMode == ExamTimeMode.Day && Settings.SimulationsLightOnDay || context.ExamTimeMode == ExamTimeMode.Night && Settings.SimulationsLightOnNight) { Speaker.CancelAllAsync(false); while (SignalSet.Current == null) { Thread.Sleep(100); } if (SignalSet.Current != null && !SignalSet.Current.Sensor.Engine) { if (Settings.CommonExambeforeSimionLightStartEngine) { Speaker.PlayAudioAsync(Settings.CommonExambeforeSimionLightStartEngineVoice); } } while (!(SignalSet.Current != null && SignalSet.Current.Sensor.Engine) && Settings.CommonExambeforeSimionLightStartEngine) { Thread.Sleep(100); } //打火黑屏延时启动灯光模拟 if (Settings.CommonExambeforeSimionLightStartEngine && Settings.CommonStartEngineDeleyTime > 0) { await Task.Run(() => { int delaytime = Settings.CommonStartEngineDeleyTime * 1000; Thread.Sleep(delaytime); }); } //等待关闭发动机 var lightTask = StartExamItemAutoAsync(context, ExamItemCodes.Light); await lightTask; await Task.Run(() => { while (context.IsExaming && lightTask.Result.State != ExamItemState.Finished) { Thread.Sleep(100); } }); } if (!context.IsExaming) { Logger.Debug("考试结束:context.IsExaming"); return; } //TODO:可以考虑做成配置 决定综合评判启动的位置 await StartExamItemAutoAsync(context, ExamItemCodes.Start); }
public async Task StartExamAsync(ExamContext context) { Speaker.CancelAllAsync(); StartExam(context); PointSearcher.SetMapPoints(context.Map.MapPoints); }
protected virtual async Task StartExamAsync(ExamContext context) { if (!context.IsExaming) { return; } //启用绕车一周 to 在车上进行验证探头 if (Settings.PrepareDrivingEnable) { var prepareTask = StartExamItemAutoAsync(context, ExamItemCodes.PrepareDriving); await prepareTask; await Task.Run(() => { while (context.IsExaming && prepareTask.Result.State != ExamItemState.Finished) { Thread.Sleep(100); } }); } await StartExamItemAutoAsync(context, ExamItemCodes.CommonExamItem); if (!context.IsExaming) { Logger.Debug("考试结束:context.IsExaming"); return; } //上车准备完成之后就启动灯光模拟 //吉首白天夜间都要灯光模拟 if (context.ExamTimeMode == ExamTimeMode.Day && Settings.SimulationsLightOnDay || context.ExamTimeMode == ExamTimeMode.Night && Settings.SimulationsLightOnNight) { Speaker.CancelAllAsync(false); while (SignalSet.Current == null) { Thread.Sleep(100); } if (SignalSet.Current != null && !SignalSet.Current.Sensor.Engine) { if (Settings.CommonExambeforeSimionLightStartEngine) { Speaker.PlayAudioAsync(Settings.CommonExambeforeSimionLightStartEngineVoice); } } while (!(SignalSet.Current != null && SignalSet.Current.Sensor.Engine) && Settings.CommonExambeforeSimionLightStartEngine) { //如果启动要扣分 Thread.Sleep(100); } //打火黑屏延时启动灯光模拟 if (Settings.CommonExambeforeSimionLightStartEngine && Settings.CommonStartEngineDeleyTime > 0) { await Task.Run(() => { int delaytime = Settings.CommonStartEngineDeleyTime * 1000; Thread.Sleep(delaytime); }); } //等待关闭发动机 var lightTask = StartExamItemAutoAsync(context, ExamItemCodes.Light); await lightTask; await Task.Run(() => { while (context.IsExaming && lightTask.Result.State != ExamItemState.Finished) { Thread.Sleep(100); } }); } if (!context.IsExaming) { Logger.Debug("考试结束:context.IsExaming"); return; } //TODO:可以考虑做成配置 决定综合评判启动的位置 //TODO:以及是否自动起步也可以考虑做成配置 await StartExamItemAutoAsync(context, ExamItemCodes.Start); }