Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;
            string ascii = txtASCIIStringToSend.Text;

            for (int i = 0; i < 10; i++)
            {
                ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfTTApplicatorIsReady, null);
                Thread.Sleep(1000);
            }
            ledStatusLightingUtil.InitializeTTApplicator_Async();
            Thread.Sleep(1000);
            ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfTTApplicatorIsReady, null);
            //ledStatusLightingUtil.SendASCIICommand(ascii);
            //LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;
            //for (int i = 0; i < 100; i++)
            //{
            //    ledStatusLightingUtil.InitializeMUBApplicator_Async();
            //    ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfMUBApplicatorIsReady, CheckIfMUBApplicatorIsReady_Callback);

            //    ledStatusLightingUtil.StartMUBApplicator_Async();
            //    ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfMUBApplicatorIsStarted, CheckIfMUBApplicatorIsStarted_Callback);

            //    ledStatusLightingUtil.InitializeTTApplicator_Async();
            //    ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfTTApplicatorIsReady, CheckIfTTApplicatorIsReady_Callback);

            //    ledStatusLightingUtil.StartTTApplicator_Async();
            //    ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfTTApplicatorIsStarted, CheckIfTTApplicatorIsStarted_Callback);
            //}
        }
Example #2
0
        private void btnTurnOffAllLights_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.TurnOffAllLEDs();
            //if (chkSSA.Checked)
            //{
            //    string hexCommand = "";
            //    string asciiCommand = "";
            //    //
            //    // Turn of RED light
            //    //
            //    asciiCommand = "WR 605 0";
            //    hexCommand = ToHEX(asciiCommand);
            //    SendCommand(hexCommand);
            //    //
            //    // Turn of GREEN light
            //    //
            //    asciiCommand = "WR 606 0";
            //    hexCommand = ToHEX(asciiCommand);
            //    SendCommand(hexCommand);
            //    //
            //    // Turn of BLUE light
            //    //
            //    asciiCommand = "WR 604 0";
            //    hexCommand = ToHEX(asciiCommand);
            //    SendCommand(hexCommand);
            //}
        }
Example #3
0
        private void btnCheckIfTTApplicatorIsStarted_Click(object sender, EventArgs e)
        {
            SetTTButtonsStatus(false);
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfTTApplicatorIsStarted, CheckIfTTApplicatorIsStarted_Callback);
        }
Example #4
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;
            string ascii = txtASCIIStringToSend.Text;
            string hex   = txtHEXStringToSend.Text;

            if (!string.IsNullOrEmpty(ascii))
            {
                ledStatusLightingUtil.SendASCIICommand(ascii);
            }
            else
            {
                ledStatusLightingUtil.SendCommand(txtHEXStringToSend.Text);
            }
            //string ascii = txtASCIIStringToSend.Text;
            //string hex = txtHEXStringToSend.Text;
            //if (!string.IsNullOrEmpty(ascii))
            //{
            //    hex = ToHEX(ascii);
            //    txtHEXStringToSend.Text = hex;
            //}
            ////string hex = ToHEX(hexString);
            //byte[] bytestosend = ToByteArray(hex);

            //try
            //{
            //    serialPort1.Write(bytestosend, 0, bytestosend.Length);
            //}
            //catch (Exception ex)
            //{
            //    txtReceivedData.Text = ex.Message;
            //}
        }
Example #5
0
        private void btnCheckIfMUBDoorIsFullyOpen_Click(object sender, EventArgs e)
        {
            SetMUBButtonsStatus(false);

            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.SendCommand_Async(EnumCommands.CheckIfMUBDoorIsFullyOpen, CheckIfMUBDoorIsFullyOpen_Callback);
        }
Example #6
0
        private void FormLEDLightControl_Load(object sender, EventArgs e)
        {
            GetAvailablePorts();
            cboBaudRate.SelectedIndex = 0;
            cboParity.SelectedIndex   = 0;

            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.OnNewEvent += LedStatusLightingUtil_OnNewEvent;
        }
Example #7
0
        private void btnClosePort_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.DataReceived -= LedStatusLightingUtil_DataReceived;

            ledStatusLightingUtil.ClosePort();
            //serialPort1.Close();
            //serialPort1.PortName = cboPortNames.Text;
            //serialPort1.BaudRate = int.Parse(cboBaudRate.Text);
            progressBar1.Value         = 0;
            btnSend.Enabled            = false;
            btnReceive.Enabled         = false;
            txtHEXStringToSend.Enabled = false;
            btnOpenPort.Enabled        = true;
            btnClosePort.Enabled       = false;
        }
Example #8
0
        private void UpdateLEDsLight()
        {
            try
            {
                LEDStatusLightingUtil ledLightUtil = LEDStatusLightingUtil.Instance;

                if (_station.ToUpper() == EnumStation.ARK)
                {
                    // Get latest application status
                    EnumApplicationStatus newApplicationStatus = GetApplicationStatus();

                    if (newApplicationStatus != _applicationStatus)
                    {
                        _applicationStatus = newApplicationStatus;


                        LogManager.Debug("UpdateLEDsLight: TurnOffAllLEDs");
                        LogManager.Debug("UpdateLEDsLight - New status: " + _applicationStatus.ToString());

                        // Always turn off all LEDs before select which LED(s) to turn on.
                        ledLightUtil.TurnOffAllLEDs();

                        //MessageBox.Show(_applicationStatus.ToString());
                        switch (_applicationStatus)
                        {
                        case EnumApplicationStatus.Initialization:
                            ledLightUtil.StartBLUELightFlashing();
                            break;

                        case EnumApplicationStatus.Ready:
                            ledLightUtil.SwitchGREENLightOnOff(true);
                            break;

                        case EnumApplicationStatus.Caution:
                            ledLightUtil.StartYELLOWLightFlashing();
                            break;

                        case EnumApplicationStatus.Error:
                            ledLightUtil.SwitchREDLightOnOff(true);
                            break;

                        case EnumApplicationStatus.Busy:
                            ledLightUtil.SwitchBLUELightOnOff(true);
                            break;

                        default:
                            ledLightUtil.SwitchREDLightOnOff(true);
                            break;
                        }
                    }
                }
                else if (_station.ToUpper() == EnumStation.ALK)
                {
                    // Get latest application status
                    EnumApplicationStatus newApplicationStatus = GetApplicationStatus();

                    if (newApplicationStatus != _applicationStatus)
                    {
                        _applicationStatus = newApplicationStatus;

                        LogManager.Debug("UpdateLEDsLight: TurnOffAllLEDs");
                        LogManager.Debug("UpdateLEDsLight - New status: " + _applicationStatus.ToString());

                        // Always turn off all LEDs before select which LED(s) to turn on.
                        ledLightUtil.TurnOffAllLEDs();

                        //MessageBox.Show(_applicationStatus.ToString());
                        switch (_applicationStatus)
                        {
                        case EnumApplicationStatus.Initialization:
                            ledLightUtil.StartBLUELightFlashing();
                            break;

                        case EnumApplicationStatus.Ready:
                            ledLightUtil.SwitchGREENLightOnOff(true);
                            break;

                        case EnumApplicationStatus.Caution:
                            ledLightUtil.StartYELLOWLightFlashing();
                            break;

                        case EnumApplicationStatus.Error:
                            ledLightUtil.SwitchREDLightOnOff(true);
                            break;

                        case EnumApplicationStatus.Busy:
                            ledLightUtil.SwitchBLUELightOnOff(true);
                            break;

                        default:
                            ledLightUtil.SwitchREDLightOnOff(true);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Error("UpdateLEDsLight exception: " + ex.ToString());
                Debug.WriteLine("UpdateLEDsLight exception: " + ex.ToString());
            }
        }
Example #9
0
        private void btnTTRobotDown_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.MoveDownTTRobot_Async();
        }
Example #10
0
        private void btnOpenTTDoor_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.OpenTTDoor_Async();
        }
Example #11
0
        private void btnStartTTApplicator_Click(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.StartTTApplicator_Async();
        }
Example #12
0
        private void btnOpenPort_Click(object sender, EventArgs e)
        {
            try
            {
                LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

                string station = "";
                string parity  = "";
                if (chkSSA.Checked)
                {
                    station = EnumStation.ALK;
                    parity  = "Even";
                }
                else if (chkSSK.Checked)
                {
                    station = EnumStation.ARK;
                    parity  = "None";
                }
                ledStatusLightingUtil.DataReceived += LedStatusLightingUtil_DataReceived;
                txtReceivedData.Text = ledStatusLightingUtil.OpenPort(station, cboPortNames.Text, int.Parse(cboBaudRate.Text), parity);

                btnOpenPort.Enabled  = false;
                btnClosePort.Enabled = true;
                btnSend.Enabled      = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //try
            //{
            //    if (cboPortNames.Text == "" || cboBaudRate.Text == "")
            //    {
            //        txtReceivedData.Text = "Please select port settings";
            //    }
            //    else
            //    {
            //        serialPort1.PortName = cboPortNames.Text;
            //        serialPort1.BaudRate = int.Parse(cboBaudRate.Text);
            //        progressBar1.Value = 100;
            //        btnSend.Enabled = true;
            //        btnReceive.Enabled = true;
            //        txtHEXStringToSend.Enabled = true;
            //        btnOpenPort.Enabled = false;
            //        btnClosePort.Enabled = true;
            //        //if (cboParity.SelectedIndex == 0)
            //        //{
            //        //    serialPort1.Parity = Parity.Even;
            //        //}
            //        //else
            //        //{
            //        //    serialPort1.Parity = Parity.None;
            //        //}
            //        serialPort1.Parity = Parity.None;
            //        serialPort1.Open();

            //        serialPort1.DataReceived += SerialPort1_DataReceived;
            //    }
            //}
            //catch (UnauthorizedAccessException ex)
            //{
            //    txtReceivedData.Text = ex.Message;
            //}
        }
Example #13
0
        private void radYELLOWLight_CheckedChanged(object sender, EventArgs e)
        {
            LEDStatusLightingUtil ledStatusLightingUtil = LEDStatusLightingUtil.Instance;

            ledStatusLightingUtil.SwitchYELLOWLightOnOff(radYELLOWLight.Checked);
        }