Exemple #1
0
        public override void OnExit()
        {
            if (mCurrentState != null)
            {
                mCurrentState.OnExit();
            }

            if (mMotorControllerArduino != null)
            {
                if (mMotorControllerArduino.TelemetryActive)
                {
                    mMotorControllerArduino.TelemetryToggle(0);
                }

                mMotorControllerArduino.Disconnected -= OnArduinoPrematureDisconnect;
                mMotorControllerArduino.StopArduinoComms(true);
                mMotorControllerArduino.TelemetryUpdate -= UpdateMotorTelemetry;
                mMotorControllerArduino = null;
            }

            if (mSensorNodeArduino != null)
            {
                if (mSensorNodeArduino.TelemetryActive)
                {
                    mSensorNodeArduino.TelemetryToggle(0);
                }

                mSensorNodeArduino.Disconnected -= OnArduinoPrematureDisconnect;
                mSensorNodeArduino.StopArduinoComms(true);
                mSensorNodeArduino.TelemetryUpdate -= UpdateSensorTelemetry;
                mSensorNodeArduino = null;
            }
        }
Exemple #2
0
        public OperationalSuperState(IProsthesisContext context) : base(context)
        {
            mMotorControllerArduino = new ArduinoCommunicationsLibrary.MotorControllerArduino(context.Logger);
            mMotorControllerArduino.TelemetryUpdate += UpdateMotorTelemetry;
            mMotorControllerArduino.Disconnected    += OnArduinoPrematureDisconnect;

            mSensorNodeArduino = new ArduinoCommunicationsLibrary.SensorNodeArduino(context.Logger);
            mSensorNodeArduino.TelemetryUpdate += UpdateSensorTelemetry;
            mSensorNodeArduino.Disconnected    += OnArduinoPrematureDisconnect;
        }
        public OperationalSuperState(IProsthesisContext context)
            : base(context)
        {
            mMotorControllerArduino = new ArduinoCommunicationsLibrary.MotorControllerArduino(context.Logger);
            mMotorControllerArduino.TelemetryUpdate += UpdateMotorTelemetry;
            mMotorControllerArduino.Disconnected += OnArduinoPrematureDisconnect;

            mSensorNodeArduino = new ArduinoCommunicationsLibrary.SensorNodeArduino(context.Logger);
            mSensorNodeArduino.TelemetryUpdate += UpdateSensorTelemetry;
            mSensorNodeArduino.Disconnected += OnArduinoPrematureDisconnect;
        }
        public override void OnExit()
        {
            if (mCurrentState != null)
            {
                mCurrentState.OnExit();
            }

            if (mMotorControllerArduino != null)
            {
                if (mMotorControllerArduino.TelemetryActive)
                {
                    mMotorControllerArduino.TelemetryToggle(0);
                }

                mMotorControllerArduino.Disconnected -= OnArduinoPrematureDisconnect;
                mMotorControllerArduino.StopArduinoComms(true);
                mMotorControllerArduino.TelemetryUpdate -= UpdateMotorTelemetry;
                mMotorControllerArduino = null;
            }

            if (mSensorNodeArduino != null)
            {
                if (mSensorNodeArduino.TelemetryActive)
                {
                    mSensorNodeArduino.TelemetryToggle(0);
                }

                mSensorNodeArduino.Disconnected -= OnArduinoPrematureDisconnect;
                mSensorNodeArduino.StopArduinoComms(true);
                mSensorNodeArduino.TelemetryUpdate -= UpdateSensorTelemetry;
                mSensorNodeArduino = null;
            }
        }