Пример #1
0
        public EosStepper(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name = "Servo " + number;

            _calibration = new CalibrationPointCollectionLong(-6000d, -6000, 6000d, 6000);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _zero = new HeliosAction(board.EOSInterface, "Stepper " + Number.ToString(), "zero", "", "Sets the current position as zero.");
            _zero.Execute += Zero_Execute;
            Actions.Add(_zero);

            _targetPosition = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Stepper " + Number.ToString(), "target position", "Sets the raw target position of this stepper.", "", BindingValueUnits.Numeric);
            _targetPosition.Execute += TargetPosition_Execute;
            Actions.Add(_targetPosition);

            _value = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Stepper " + Number.ToString(), "input value", "Sets the input value to be displayed on this stepper.", "Input value will be interpolated with the calibration data and set the target position for the stepper as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;
            Actions.Add(_value);

            _increment = new HeliosAction(board.EOSInterface, "Stepper " + Number.ToString(), "increment", "", "Increments the stepper position.", "Number of steps to increment steppers position. If empty or not a number 1 will be used.", BindingValueUnits.Numeric);
            _increment.Execute += IncrementPosition_Execute;
            Actions.Add(_increment);

            _decrement = new HeliosAction(board.EOSInterface, "Stepper " + Number.ToString(), "decrement", "", "Decrements the stepper position.", "Number of steps to decrement steppers position. If empty or not a number 1 will be used.", BindingValueUnits.Numeric);
            _decrement.Execute += DecrementPosition_Execute;
            Actions.Add(_decrement);
        }
Пример #2
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.Name.Equals("Type"))
            {
                BusType = (EosBusType)Enum.Parse(typeof(EosBusType), reader.ReadElementString("Type"));
            }
            string port = reader.ReadElementString("Port");

            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("Boards");
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    reader.ReadStartElement("Board");
                    string   name    = reader.ReadElementString("Name");
                    byte     address = byte.Parse(reader.ReadElementString("Address"), System.Globalization.CultureInfo.InvariantCulture);
                    EosBoard board   = new EosBoard(this, address, name);
                    board.ReadXml(reader);
                    reader.ReadEndElement();
                    _boards.Add(board);
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Read();
            }

            Port = port;
        }
Пример #3
0
        private void ResetBoardList()
        {
            foreach (EosBoard board in _boards)
            {
                board.Active = false;
            }

            foreach (EosDevice device in _bus.Devices)
            {
                bool found = false;
                foreach (EosBoard board in _boards)
                {
                    if (board.Address == device.Address)
                    {
                        found        = true;
                        board.Active = true;
                        board.Device = device;
                        board.ProcessState();
                    }
                }
                if (!found)
                {
                    EosBoard board = new EosBoard(this, device);
                    board.Active = true;
                    _boards.Add(board);
                }
            }
        }
Пример #4
0
        public EosStepper(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name    = "Servo " + number;

            _calibration = new CalibrationPointCollectionLong(-6000d, -6000, 6000d, 6000);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _zero          = new HeliosAction(board.EOSInterface, "Stepper " + Number.ToString(), "zero", "", "Sets the current position as zero.");
            _zero.Execute += Zero_Execute;
            Actions.Add(_zero);

            _targetPosition          = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Stepper " + Number.ToString(), "target position", "Sets the raw target position of this stepper.", "", BindingValueUnits.Numeric);
            _targetPosition.Execute += TargetPosition_Execute;
            Actions.Add(_targetPosition);

            _value          = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Stepper " + Number.ToString(), "input value", "Sets the input value to be displayed on this stepper.", "Input value will be interpolated with the calibration data and set the target position for the stepper as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;
            Actions.Add(_value);

            _increment          = new HeliosAction(board.EOSInterface, "Stepper " + Number.ToString(), "increment", "", "Increments the stepper position.", "Number of steps to increment steppers position. If empty or not a number 1 will be used.", BindingValueUnits.Numeric);
            _increment.Execute += IncrementPosition_Execute;
            Actions.Add(_increment);

            _decrement          = new HeliosAction(board.EOSInterface, "Stepper " + Number.ToString(), "decrement", "", "Decrements the stepper position.", "Number of steps to decrement steppers position. If empty or not a number 1 will be used.", BindingValueUnits.Numeric);
            _decrement.Execute += DecrementPosition_Execute;
            Actions.Add(_decrement);
        }
Пример #5
0
        public EosTextOutput(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name = "Text " + number;

            HeliosAction setText = new HeliosAction(board.EOSInterface, board.Name, Name, "set", "Sets the text displpayed.", "", BindingValueUnits.Text);
            setText.Execute += SetText_Execute;
            Actions.Add(setText);
        }
Пример #6
0
        public EosAnalogInput(EosBoard board, byte number)
        {
            _board  = new WeakReference(board);
            _number = number;
            Name    = "Analog Input " + number;

            _value = new HeliosValue(board.EOSInterface, new BindingValue(0), board.Name, Name, "Analog input", "0-1024", BindingValueUnits.Numeric);
            Triggers.Add(_value);
        }
Пример #7
0
        public EosTextOutput(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name    = "Text " + number;

            HeliosAction setText = new HeliosAction(board.EOSInterface, board.Name, Name, "set", "Sets the text displpayed.", "", BindingValueUnits.Text);

            setText.Execute += SetText_Execute;
            Actions.Add(setText);
        }
Пример #8
0
        private void BacklightOff_Click(object sender, RoutedEventArgs e)
        {
            EosBoard eosBoard = this.BoardListBox.SelectedItem as EosBoard;

            if (eosBoard == null)
            {
                return;
            }
            eosBoard.Device.SetBacklightPower(false);
        }
Пример #9
0
        private void BacklighLevel_Changed(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            EosBoard eosBoard = this.BoardListBox.SelectedItem as EosBoard;

            if (eosBoard == null)
            {
                return;
            }
            eosBoard.Device.SetBacklightLevel((byte)e.NewValue);
        }
Пример #10
0
        public EosDigitalInput(EosBoard board, byte number)
        {
            _board = new WeakReference(board);
            _number = number;
            Name = "Digital Input " + number;

            _onTrigger = new HeliosTrigger(board.EOSInterface, board.Name, Name, "On", "Triggered when this digital input is moved to the on state.");
            Triggers.Add(_onTrigger);

            _offTrigger = new HeliosTrigger(board.EOSInterface, board.Name, Name, "Off", "Triggered when this digitla input is moved to the off state.");
            Triggers.Add(_offTrigger);
        }
Пример #11
0
        public EosBacklight(EosBoard board) : base(board)
        {
            Name = "Backlight";

            HeliosAction backlightBrightness = new HeliosAction(board.EOSInterface, board.Name, "backlight brightness", "set", "Sets the brightness level of the backlight outputs.", "0-255", BindingValueUnits.Numeric);
            backlightBrightness.Execute += BacklighBrightness_Execute;
            Actions.Add(backlightBrightness);

            HeliosAction backlightPower = new HeliosAction(board.EOSInterface, board.Name, "backlight power", "set", "Turns backlight power on and off.", "False turns backlight off, true turns it on.", BindingValueUnits.Boolean);
            backlightPower.Execute += BacklightPower_Execute;
            Actions.Add(backlightPower);
        }
Пример #12
0
        public EosDigitalInput(EosBoard board, byte number)
        {
            _board  = new WeakReference(board);
            _number = number;
            Name    = "Digital Input " + number;

            _onTrigger = new HeliosTrigger(board.EOSInterface, board.Name, Name, "On", "Triggered when this digital input is moved to the on state.");
            Triggers.Add(_onTrigger);

            _offTrigger = new HeliosTrigger(board.EOSInterface, board.Name, Name, "Off", "Triggered when this digitla input is moved to the off state.");
            Triggers.Add(_offTrigger);
        }
Пример #13
0
        private void LedOff_Click(object sender, RoutedEventArgs e)
        {
            EosBoard eosBoard = this.BoardListBox.SelectedItem as EosBoard;
            Button   button   = e.Source as Button;

            if (eosBoard == null || button == null)
            {
                return;
            }
            byte led = (byte)button.Tag;

            eosBoard.Device.SetLedPower(led, false);
        }
Пример #14
0
        public EosLedOutput(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name = "LED " + number;

            HeliosAction backlightBrightness = new HeliosAction(board.EOSInterface, board.Name, Name, "brightness", "Sets the brightness level of the led outputs.", "0-255", BindingValueUnits.Numeric);
            backlightBrightness.Execute += LedBrightness_Execute;
            Actions.Add(backlightBrightness);

            HeliosAction backlightPower = new HeliosAction(board.EOSInterface, board.Name, Name, "power", "Turns led power on and off.", "False turns backlight off, true turns it on.", BindingValueUnits.Boolean);
            backlightPower.Execute += LedPower_Execute;
            Actions.Add(backlightPower);
        }
Пример #15
0
        public EosBacklight(EosBoard board) : base(board)
        {
            Name = "Backlight";

            HeliosAction backlightBrightness = new HeliosAction(board.EOSInterface, board.Name, "backlight brightness", "set", "Sets the brightness level of the backlight outputs.", "0-255", BindingValueUnits.Numeric);

            backlightBrightness.Execute += BacklighBrightness_Execute;
            Actions.Add(backlightBrightness);

            HeliosAction backlightPower = new HeliosAction(board.EOSInterface, board.Name, "backlight power", "set", "Turns backlight power on and off.", "False turns backlight off, true turns it on.", BindingValueUnits.Boolean);

            backlightPower.Execute += BacklightPower_Execute;
            Actions.Add(backlightPower);
        }
Пример #16
0
        private void BoardSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            EosDirectSerial bus   = Interface as EosDirectSerial;
            EosBoard        board = BoardListBox.SelectedItem as EosBoard;

            DigitalInputsTab.IsEnabled = board.DigitalInputCount > 0;
            LedTab.IsEnabled           = board.LedOutputCount > 0;
            AnalogInputsTab.IsEnabled  = board.AnalogInputCount > 0;
            ServoTab.IsEnabled         = board.ServoOutputCount > 0;
            StepperTab.IsEnabled       = board.StepperOutputCount > 0;
            CoilTab.IsEnabled          = board.CoilOutputCount > 0;

            if (board.ServoOutputCount > 0)
            {
                ServoSelector.SelectedIndex = 0;
            }

            if (board.StepperOutputCount > 0)
            {
                StepperSelector.SelectedIndex = 0;
            }

            if (board.CoilOutputCount > 0)
            {
                CoilSelector.SelectedIndex = 0;
            }

            TabItem selectedTab = PropertyTab.SelectedItem as TabItem;

            if (selectedTab.IsEnabled == false)
            {
                PropertyTab.SelectedItem = PropertiesTab;
            }

            for (byte i = 0; i < board.ServoOutputCount; i++)
            {
                if (board.Device != null)
                {
                    board.Device.GetServoConfig(i);
                }
            }
            for (byte i = 0; i < board.StepperOutputCount; i++)
            {
                if (board.Device != null)
                {
                    board.Device.GetStepperConfig(i);
                }
            }
        }
Пример #17
0
        public EosLedOutput(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name    = "LED " + number;

            HeliosAction backlightBrightness = new HeliosAction(board.EOSInterface, board.Name, Name, "brightness", "Sets the brightness level of the led outputs.", "0-255", BindingValueUnits.Numeric);

            backlightBrightness.Execute += LedBrightness_Execute;
            Actions.Add(backlightBrightness);

            HeliosAction backlightPower = new HeliosAction(board.EOSInterface, board.Name, Name, "power", "Turns led power on and off.", "False turns backlight off, true turns it on.", BindingValueUnits.Boolean);

            backlightPower.Execute += LedPower_Execute;
            Actions.Add(backlightPower);
        }
Пример #18
0
        public EosServo(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name    = "Servo " + number;

            _calibration = new CalibrationPointCollectionLong(0d, 1000, 180d, 2000);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _signalValue          = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Servo " + Number.ToString(), "signal value", "Sets the raw signal pulse in microseconds.", "", BindingValueUnits.Numeric);
            _signalValue.Execute += SignalValue_Execte;
            Actions.Add(_signalValue);

            _value          = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Servo " + Number.ToString(), "input value", "Sets the input value to be displayed on this servo.", "Input value will be interpolated with the calibration data and set the target position for the servo as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;
            Actions.Add(_value);
        }
Пример #19
0
        public EosServo(EosBoard board, byte number) : base(board)
        {
            _number = number;
            Name = "Servo " + number;

            _calibration = new CalibrationPointCollectionLong(0d, 1000, 180d, 2000);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _signalValue = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Servo " + Number.ToString(), "signal value", "Sets the raw signal pulse in microseconds.", "", BindingValueUnits.Numeric);
            _signalValue.Execute += SignalValue_Execte;
            Actions.Add(_signalValue);

            _value = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Servo " + Number.ToString(), "input value", "Sets the input value to be displayed on this servo.", "Input value will be interpolated with the calibration data and set the target position for the servo as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;
            Actions.Add(_value);
        }
Пример #20
0
        public EosCoilOutput(EosBoard board, byte number)
            : base(board)
        {
            _number = number;
            Name    = "Coil " + number;

            _calibration = new CalibrationPointCollectionLong(-255, -255, 255, 255);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _coilValue          = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Coil " + Number.ToString(), "coil value", "Sets the coil output value.", "-255 to 255", BindingValueUnits.Numeric);
            _coilValue.Execute += CoilValue_Execte;
            Actions.Add(_coilValue);

            _value          = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Coil " + Number.ToString(), "input value", "Sets the input value to be displayed on this coil.", "Input value will be interpolated with the calibration data and set the target position for the servo as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;
            Actions.Add(_value);
        }
Пример #21
0
        public EosCoilOutput(EosBoard board, byte number)
            : base(board)
        {
            _number = number;
            Name = "Coil " + number;

            _calibration = new CalibrationPointCollectionLong(-255, -255, 255, 255);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _coilValue = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Coil " + Number.ToString(), "coil value", "Sets the coil output value.", "-255 to 255", BindingValueUnits.Numeric);
            _coilValue.Execute += CoilValue_Execte;
            Actions.Add(_coilValue);

            _value = new HeliosValue(board.EOSInterface, new BindingValue(0d), "Coil " + Number.ToString(), "input value", "Sets the input value to be displayed on this coil.", "Input value will be interpolated with the calibration data and set the target position for the servo as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;
            Actions.Add(_value);
        }
Пример #22
0
 public EosOutput(EosBoard board)
 {
     _board = new WeakReference(board);
 }
Пример #23
0
        private void ResetBoardList()
        {
            foreach (EosBoard board in _boards)
            {
                board.Active = false;
            }

            foreach (EosDevice device in _bus.Devices)
            {
                bool found = false;
                foreach (EosBoard board in _boards)
                {
                    if (board.Address == device.Address)
                    {
                        found = true;
                        board.Active = true;
                        board.Device = device;
                        board.ProcessState();
                    }
                }
                if (!found)
                {
                    EosBoard board = new EosBoard(this, device);
                    board.Active = true;
                    _boards.Add(board);
                }
            }
        }
Пример #24
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.Name.Equals("Type"))
            {
                BusType = (EosBusType)Enum.Parse(typeof(EosBusType), reader.ReadElementString("Type"));
            }
            string port = reader.ReadElementString("Port");

            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("Boards");
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    reader.ReadStartElement("Board");
                    string name = reader.ReadElementString("Name");
                    byte address = byte.Parse(reader.ReadElementString("Address"), System.Globalization.CultureInfo.InvariantCulture);
                    EosBoard board = new EosBoard(this, address, name);
                    board.ReadXml(reader);
                    reader.ReadEndElement();
                    _boards.Add(board);
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Read();
            }

            Port = port;
        }
Пример #25
0
 public EosOutput(EosBoard board)
 {
     _board = new WeakReference(board);
 }