Ejemplo n.º 1
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (CurrentLightRule == null)
            {
                StopCore();
                return;
            }

            var result = CurrentLightRule.Check(signalInfo);

            switch (result)
            {
            case RuleExecutionResult.Continue:
                return;

            case RuleExecutionResult.Break:
            case RuleExecutionResult.Finish:
                ////获取下一个项目
                //var next = ActivedRules.OfType<ILightRule>().SkipWhile(x => x != CurrentLightRule).Skip(1).FirstOrDefault();
                //SetCurrentLightRule(next);
                //获取下一个灯光规则
                currentLightRuleIndex++;
                SetCurrentLightRule(currentLightRuleIndex);
                return;

            case RuleExecutionResult.FinishExamItem:
                break;
            }
        }
Ejemplo n.º 2
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (CurrentLightRule == null)
            {
                StopCore();
                return;
            }

            var result = CurrentLightRule.Check(signalInfo);

            switch (result)
            {
            case RuleExecutionResult.Continue:
                return;

            case RuleExecutionResult.Break:
            case RuleExecutionResult.Finish:

                if (currentLightRuleIndex == 0)
                {
                    //其实只需要判断客户当前停留的灯光是在近光还是远光
                    //如果客户开的是近光
                    if (signalInfo.Sensor.HighBeam)
                    {
                        var NextLightRule = CurrentActiviedRules[currentLightRuleIndex + 1];
                        Logger.Info("SimulationLightss HighBeam", NextLightRule.LightRuleType);
                        //表示远光
                        if (NextLightRule.LightRuleType.Contains("HighBeamLightRule"))
                        {
                            currentLightRuleIndex++;
                        }
                    }
                }
                else if (signalInfo.Sensor.LowBeam)
                {
                    //var NextLightRule = CurrentActiviedRules[currentLightRuleIndex + 1];
                    ////表示是近光
                    Logger.Info("SimulationLightss LowBeam");
                    //if (NextLightRule.LightRuleType.Contains("LowBeamLightRule"))
                    //{
                    //    currentLightRuleIndex++;
                    //}
                }
                else
                {
                    Logger.Info("SimulationLightss Default", "Default");
                }
                //获取下一个灯光规则
                currentLightRuleIndex++;
                SetCurrentLightRule(currentLightRuleIndex);
                return;

            case RuleExecutionResult.FinishExamItem:
                break;
            }
        }
Ejemplo n.º 3
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (CurrentLightRule == null)
            {
                StopCore();
                return;
            }
            var result = CurrentLightRule.Check(signalInfo);

            switch (result)
            {
            case RuleExecutionResult.Continue:
                return;

            case RuleExecutionResult.Break:
            case RuleExecutionResult.Finish:
                ////获取下一个项目
                //var next = ActivedRules.OfType<ILightRule>().SkipWhile(x => x != CurrentLightRule).Skip(1).FirstOrDefault();
                // SetCurrentLightRule(next);
                // SetC
                //获取下一个灯光规则
                //TODO:龙泉的比较特殊,考虑到易操作性所以在这点加了一个条件判断,
                if (DataBase.VersionNumber.Contains("龙泉") && CurrentLightRule.RuleCode == DeductionRuleCodes.RC41603)
                {
                    //怎么判断那一句灯光规则是远近交替
                    //怎么判断是不是龙泉版本不太好判断
                    if (signalInfo.Sensor.HighBeam)
                    {
                        BreakRule(DeductionRuleCodes.RC41603);
                    }
                }

                currentLightRuleIndex++;
                SetCurrentLightRule(currentLightRuleIndex);
                return;

            case RuleExecutionResult.FinishExamItem:
                //发送考试完成消息
                //考试完成消息
                //发送考试完成消息
                Messenger.Send <LightFinishMessage>(new LightFinishMessage());
                break;
            }
        }
Ejemplo n.º 4
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (CurrentLightRule == null)
            {
                StopCore();
                return;
            }

            var result = CurrentLightRule.Check(signalInfo);

            switch (result)
            {
            case RuleExecutionResult.Continue:
                return;

            case RuleExecutionResult.Break:
            case RuleExecutionResult.Finish:
                //如果是远近光交替则需要停留在近光
                if (CurrentLightRule.RuleCode == DeductionRuleCodes.RC41603)
                {
                    //怎么判断那一句灯光规则是远近交替
                    //怎么判断是不是龙泉版本不太好判断
                    if (signalInfo.Sensor.HighBeam)
                    {
                        BreakRule(DeductionRuleCodes.RC41603);
                    }
                }


                currentLightRuleIndex++;
                SetCurrentLightRule(currentLightRuleIndex);
                return;

            case RuleExecutionResult.FinishExamItem:
                break;
            }
        }