/// <summary>Constructor de la clase.</summary>
 /// <param name="IdSensor">Identificador del sensor.</param>
 /// <param name="NombreSensor">Nombre del sensor.</param>
 public SensorEntity(int IdSensor, string NombreSensor)
 {
     this.IdSensor     = IdSensor;
     this.NombreSensor = NombreSensor;
     this.StatusSensor = StatusSensor.Disponible;
 }
Beispiel #2
0
        public GUI()
        {
            InitializeComponent();

            portInfoLabel.Text = string.Format("{0}@{1}kbaud",
                                               ControlStation.Properties.Settings.Default.PortName,
                                               ControlStation.Properties.Settings.Default.BaudRate / 1000);

            //setup serial port
            BetterSerialPort port = new BetterSerialPort(ControlStation.Properties.Settings.Default.PortName,
                                                         ControlStation.Properties.Settings.Default.BaudRate);

            //handles communication thread
            comms = new SerialCommunication(port);
            //displays port info and connect/disconnect button
            comms.CommunicationException += OnCommunicationException;
            comms.Started         += OnCommunicationStarted;
            comms.Stopped         += OnCommunicationStopped;
            comms.TenElapsed      += OnTenElapsed;
            comms.FiftyElapsed    += OnHundredElapsed;
            comms.ThousandElapsed += OnThousandElapsed;

            //construct sensor and actuator objects
            depth = new DepthSensor(new DepthData());
            imu   = new OrientationSensor(new OrientationData());

            List <ToolData> toolList = new List <ToolData>();

            for (int i = 0; i < 3; i++)
            {
                toolList.Add(new ToolData());
            }
            tools = new ToolsActuator(toolList);

            List <ESCData> escList = new List <ESCData>();

            for (int i = 0; i < 6; i++)
            {
                escList.Add(new ESCData());
            }
            escs      = new PropulsionSensor(escList);
            thrusters = new PropulsionActuator(escList);

            StatusData state = new StatusData();

            status        = new StatusSensor(state);
            statusControl = new StatusActuator(state);

            versioning = new DiagnosticsSensor(new VersionData());

            //put them in the list
            devices = new List <GenericAbstractDevice>();
            devices.Add(depth);
            devices.Add(imu);
            devices.Add(escs);
            devices.Add(thrusters);
            devices.Add(tools);
            devices.Add(status);
            devices.Add(statusControl);
            devices.Add(versioning);

            statusPanel.Controls.Add(status, 0, 0);
            statusPanel.Controls.Add(statusControl, 0, 1);
            statusPanel.Controls.Add(versioning, 0, 2);
            statusPanel.Controls.Add(escs, 1, 0);
            statusPanel.SetRowSpan(escs, 3);

            toolsPanel.Controls.Add(tools);

            thrustersPanel.Controls.Add(thrusters);

            depthBox.Controls.Add(depth);
            attitudeBox.Controls.Add(imu);

            //disable all devices to start off
            foreach (GenericAbstractDevice device in devices)
            {
                device.Enabled = false;
            }
        }