Example #1
0
        private static void JBC_NewStationConnected(long stationID)
        {
            station_id = stationID;
            features   = jbc_api.GetStationFeatures(station_id);
            port_count = jbc_api.GetPortCount(station_id);

            jbc_api.SetControlMode(station_id, ControlModeConnection.CONTROL);

            _autoResetEvent.Set();
            //Assert.AreEqual("NewStation", "");
        }
Example #2
0
        private void updateParams()
        {
            //if a station is selected updating all of its parametters
            if (curStation != long.MaxValue)
            {
                // get features supported by the station
                curFeatures = JBC.GetStationFeatures(curStation);

                //updating station parametters
                lblModel.Text = JBC.GetStationModel(curStation);
                lblSW.Text    = JBC.GetStationSWversion(curStation);
                lblError.Text = JBC.GetStationError(curStation).ToString();
                lblName.Text  = JBC.GetStationName(curStation);
                CTemperature.TemperatureUnit units = JBC.GetStationTempUnits(curStation);

                // if station supports display settings changes
                butUnits.Enabled = curFeatures.DisplaySettings;
                butN2.Enabled    = curFeatures.DisplaySettings;
                butHelp.Enabled  = curFeatures.DisplaySettings;
                butBeep.Enabled  = curFeatures.DisplaySettings;
                if (curFeatures.DisplaySettings)
                {
                    lblUnits.Text = units.ToString();
                    lblN2.Text    = System.Convert.ToString(JBC.GetStationN2Mode(curStation).ToString().Replace("_", ""));
                    lblHelp.Text  = System.Convert.ToString(JBC.GetStationHelpText(curStation).ToString().Replace("_", ""));
                    lblBeep.Text  = System.Convert.ToString(JBC.GetStationBeep(curStation).ToString().Replace("_", ""));
                }
                else
                {
                    lblUnits.Text = "N/A";                  // not supported
                    lblN2.Text    = "N/A";                  // not supported
                    lblHelp.Text  = "N/A";                  // not supported
                    lblBeep.Text  = "N/A";                  // not supported
                }
                if (units == CTemperature.TemperatureUnit.Celsius)
                {
                    lblTrafoError.Text = JBC.GetStationTransformerErrorTemp(curStation).ToCelsius().ToString() + " ºC";
                    lblMOSerror.Text   = JBC.GetStationMOSerrorTemp(curStation).ToCelsius().ToString() + " ºC";
                    lblTrafo.Text      = JBC.GetStationTransformerTemp(curStation).ToCelsius().ToString() + " ºC";
                    lblMaxTemp.Text    = JBC.GetStationMaxTemp(curStation).ToRoundCelsius().ToString() + " ºC";
                    lblMinTemp.Text    = JBC.GetStationMinTemp(curStation).ToRoundCelsius().ToString() + " ºC";
                }
                else if (units == CTemperature.TemperatureUnit.Fahrenheit)
                {
                    lblTrafoError.Text = JBC.GetStationTransformerErrorTemp(curStation).ToFahrenheit().ToString() + " ºF";
                    lblMOSerror.Text   = JBC.GetStationMOSerrorTemp(curStation).ToFahrenheit().ToString() + " ºF";
                    lblTrafo.Text      = JBC.GetStationTransformerTemp(curStation).ToFahrenheit().ToString() + " ºF";
                    lblMaxTemp.Text    = JBC.GetStationMaxTemp(curStation).ToRoundFahrenheit().ToString() + " ºF";
                    lblMinTemp.Text    = JBC.GetStationMinTemp(curStation).ToRoundFahrenheit().ToString() + " ºF";
                }

                //clearing all the ports labels and disabling the ports group boxes
                for (int cnt = JBC.GetPortCount(curStation) + 1; cnt <= 4; cnt++)
                {
                    Control gbx = this.Controls.Find("gbxPort" + System.Convert.ToString(cnt), true)[0];
                    foreach (Control ctrl in gbx.Controls)
                    {
                        if (ctrl.Name.Contains("lbl"))
                        {
                            ctrl.Text = "";
                        }
                    }
                    gbx.Enabled = false;
                }

                //updating the ports parametters
                for (int cnt = 1; cnt <= JBC.GetPortCount(curStation); cnt++)
                {
                    Control  port      = this.Controls.Find("gbxPort" + System.Convert.ToString(cnt), true)[0];
                    Control  tool      = this.Controls.Find("lblPort" + System.Convert.ToString(cnt) + "Tool", true)[0];
                    Control  err       = this.Controls.Find("lblPort" + System.Convert.ToString(cnt) + "Error", true)[0];
                    Control  actual    = this.Controls.Find("lblPort" + System.Convert.ToString(cnt) + "ActualTemp", true)[0];
                    Control  selec     = this.Controls.Find("lblPort" + System.Convert.ToString(cnt) + "SelecTemp", true)[0];
                    CheckBox sleep     = (CheckBox)(this.Controls.Find("cbxPort" + System.Convert.ToString(cnt) + "Sleep", true)[0]);
                    CheckBox hiber     = (CheckBox)(this.Controls.Find("cbxPort" + System.Convert.ToString(cnt) + "Hibernation", true)[0]);
                    CheckBox extractor = (CheckBox)(this.Controls.Find("cbxPort" + System.Convert.ToString(cnt) + "Extractor", true)[0]);
                    tool.Text = JBC.GetPortToolID(curStation, (Port)(cnt - 1)).ToString();
                    if (tool.Text != "")
                    {
                        port.Enabled = true;
                        ToolError aux = JBC.GetPortToolError(curStation, (Port)(cnt - 1));
                        if (aux == ToolError.NO_TOOL)
                        {
                            err.Text = ToolError.NO_ERROR.ToString();
                        }
                        else
                        {
                            err.Text = JBC.GetPortToolError(curStation, (Port)(cnt - 1)).ToString();
                        }
                        if (units == CTemperature.TemperatureUnit.Celsius)
                        {
                            actual.Text = JBC.GetPortToolActualTemp(curStation, (Port)(cnt - 1)).ToRoundCelsius().ToString() + " ºC";
                            selec.Text  = JBC.GetPortToolSelectedTemp(curStation, (Port)(cnt - 1)).ToRoundCelsius().ToString() + " ºC";
                        }
                        else if (units == CTemperature.TemperatureUnit.Fahrenheit)
                        {
                            actual.Text = JBC.GetPortToolActualTemp(curStation, (Port)(cnt - 1)).ToRoundFahrenheit().ToString() + " ºF";
                            selec.Text  = JBC.GetPortToolSelectedTemp(curStation, (Port)(cnt - 1)).ToRoundFahrenheit().ToString() + " ºF";
                        }
                        sleep.Checked     = JBC.GetPortToolSleepStatus(curStation, (Port)(cnt - 1)) == OnOff._ON;
                        hiber.Checked     = JBC.GetPortToolHibernationStatus(curStation, (Port)(cnt - 1)) == OnOff._ON;
                        extractor.Checked = JBC.GetPortToolExtractorStatus(curStation, (Port)(cnt - 1)) == OnOff._ON;
                    }
                }
            }
        }