예제 #1
0
파일: RealCar.cs 프로젝트: Spawek/valeo
        void deviceManager_evDeviceStateHasChanged(object sender, DeviceStateHasChangedEventArgs args)
        {
            switch (args.GetDeviceState())
            {
            case DeviceOverallState.Error:
                OverrideTargetBrakeSetting(100.0);
                break;

            case DeviceOverallState.OK:
                EndTargetBrakeSteeringOverriding();
                break;

            case DeviceOverallState.Warrning:
                //do nothing
                break;

            default:
                throw new ApplicationException("unhandled device state");
            }
        }
예제 #2
0
        private void dev_evDeviceStateHasChanged(object sender, DeviceStateHasChangedEventArgs args)
        {
            Logger.Log(this,
                String.Format(
                    "device {0} state has changed to: {1}",
                    sender.ToString(),
                    args.ToString()),
                1);

            switch (args.GetDeviceState())
            {
                case DeviceOverallState.Error:
                    overallState = DeviceOverallState.Error;
                    EmergencyStop();
                    break;

                case DeviceOverallState.Warrning:
                    if (overallState == DeviceOverallState.OK)
                    {
                        PauseEffectors();
                        overallState = DeviceOverallState.Warrning;
                    }
                    break;

                case DeviceOverallState.OK:
                    int devsInWarrningState = 0;
                    int devsInErrorState = 0;
                    foreach (Device dev in devicesList)
                    {
                        if (dev.overallState == DeviceOverallState.Warrning) devsInWarrningState++;
                        else if (dev.overallState == DeviceOverallState.Error) devsInErrorState++;

                        if (devsInErrorState > 0) overallState = DeviceOverallState.Error;
                        else if (devsInWarrningState > 0) overallState = DeviceOverallState.Warrning;
                        else overallState = DeviceOverallState.OK;
                    }
                    break;

                default:
                    throw new ApplicationException("Unknown device state");
            }
        }
예제 #3
0
        void deviceManager_evDeviceStateHasChanged(object sender, DeviceStateHasChangedEventArgs args)
        {
            if (args.GetDeviceState() == DeviceOverallState.Error)
            {
                UpdateButtonsStateInCaseOfDeviceError();
            }
            else if (args.GetDeviceState() == DeviceOverallState.OK && //its work arroud for bug causing wrong button enabling when initialized button was clicked in overall error state
                deviceManager.devicesList[0].initializationState == DeviceInitializationState.Initialized || //devices are initialized or initializing
                deviceManager.devicesList[0].initializationState == DeviceInitializationState.Initializing)
            {
                EnableStartSensorsButtonAndDisableInitButton();
            }

            ChangeOverallStateLabel(args.GetDeviceState().ToString());
        }
예제 #4
0
파일: RealCar.cs 프로젝트: Spawek/valeo
        void deviceManager_evDeviceStateHasChanged(object sender, DeviceStateHasChangedEventArgs args)
        {
            switch (args.GetDeviceState())
            {
                case DeviceOverallState.Error:
                    OverrideTargetBrakeSetting(100.0);
                    break;

                case DeviceOverallState.OK:
                    EndTargetBrakeSteeringOverriding();
                    break;

                case DeviceOverallState.Warrning:
                    //do nothing
                    break;

                default:
                    throw new ApplicationException("unhandled device state");
            }
        }