예제 #1
0
        /// <summary>
        /// Método responsável por fechar a conexão com o dispositivo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonDesconectar_Click(object sender, EventArgs e)
        {
            if (serialPort.IsOpen == false)
            {
                return;
            }

            try
            {
                PackageSend packageSend = new PackageSend();
                packageSend.Active = Util.SYSTEM_DESACTIVE;
                this.sendCommandSerialPort(packageSend.ToString());
                this.populateTextBoxDisplayInfo(packageSend.ToString());

                this.serialPort.Close();

                this.comboBoxSelectPortaCom.Enabled     = true;
                this.comboBoxSelectBaudRate.Enabled     = true;
                this.buttonConectar.Enabled             = true;
                this.buttonDesconectar.Enabled          = false;
                this.groupBoxMove.Enabled               = false;
                this.groupBoxDistanciaDianteira.Enabled = false;
                this.groupBoxDistanciaTraseira.Enabled  = false;
                this.groupBoxVelocidade.Enabled         = false;
                this.textBoxDisplayInfo.Enabled         = false;

                this.populateTextBoxDisplayInfo("Desconectado");
            }
            catch (Exception)
            {
            }
        }
 /// <summary>
 /// Método responsável por freiar o dispositivo.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <returns>void</returns>
 private void buttonBreakAll_Click(object sender, EventArgs e)
 {
     PackageSend packageSend = new PackageSend();
     packageSend.Active = Util.SYSTEM_ACTIVE;
     this.sendCommandSerialPort(packageSend.ToString());
     this.populateTextBoxDisplayInfo(packageSend.ToString());
 }
예제 #3
0
        /// <summary>
        /// Método responsável por efetuar a conexão com o dispositivo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonConectar_Click(object sender, EventArgs e)
        {
            if (serialPort.IsOpen == true)
            {
                return;
            }

            serialPort.PortName = comboBoxSelectPortaCom.Items[comboBoxSelectPortaCom.SelectedIndex].ToString();
            serialPort.BaudRate = Convert.ToInt32(comboBoxSelectBaudRate.Items[comboBoxSelectBaudRate.SelectedIndex].ToString());;

            try
            {
                serialPort.Open();
                this.comboBoxSelectPortaCom.Enabled     = false;
                this.comboBoxSelectBaudRate.Enabled     = false;
                this.buttonConectar.Enabled             = false;
                this.buttonDesconectar.Enabled          = true;
                this.groupBoxMove.Enabled               = true;
                this.groupBoxDistanciaDianteira.Enabled = true;
                this.groupBoxDistanciaTraseira.Enabled  = true;
                this.groupBoxVelocidade.Enabled         = true;
                this.textBoxDisplayInfo.Enabled         = true;

                this.populateTextBoxDisplayInfo("Conectado");

                PackageSend packageSend = new PackageSend();
                packageSend.Active = Util.SYSTEM_ACTIVE;
                this.sendCommandSerialPort(packageSend.ToString());
                this.populateTextBoxDisplayInfo(packageSend.ToString());
            }
            catch (Exception)
            {
            }
        }
예제 #4
0
        /// <summary>
        /// Método responsável por freiar o dispositivo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonBreakAll_Click(object sender, EventArgs e)
        {
            PackageSend packageSend = new PackageSend();

            packageSend.Active = Util.SYSTEM_ACTIVE;
            this.sendCommandSerialPort(packageSend.ToString());
            this.populateTextBoxDisplayInfo(packageSend.ToString());
        }
예제 #5
0
        /// <summary>
        /// Método responsável por mover o dispositivo para direita.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonMoveDireita_Click(object sender, EventArgs e)
        {
            PackageSend packageSend = new PackageSend();

            packageSend.Active = Util.SYSTEM_ACTIVE;
            packageSend.RodaDianteiraEsquerda = Util.ROTATE_FORWARD;
            packageSend.RodaDianteiraDireita  = Util.ROTATE_BACKWARD;
            packageSend.RodaTraseiraEsquerda  = Util.ROTATE_FORWARD;
            packageSend.RodaTraseiraDireita   = Util.ROTATE_BACKWARD;

            this.sendCommandSerialPort(packageSend.ToString());
            this.populateTextBoxDisplayInfo(packageSend.ToString());
        }
        /// <summary>
        /// Método responsável por efetuar a conexão com o dispositivo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonConectar_Click(object sender, EventArgs e)
        {
            if (serialPort.IsOpen == true)
            {
                return;
            }

            serialPort.PortName = comboBoxSelectPortaCom.Items[comboBoxSelectPortaCom.SelectedIndex].ToString();
            serialPort.BaudRate = Convert.ToInt32(comboBoxSelectBaudRate.Items[comboBoxSelectBaudRate.SelectedIndex].ToString()); ;

            try
            {
                serialPort.Open();
                this.comboBoxSelectPortaCom.Enabled = false;
                this.comboBoxSelectBaudRate.Enabled = false;
                this.buttonConectar.Enabled = false;
                this.buttonDesconectar.Enabled = true;
                this.groupBoxMove.Enabled = true;
                this.groupBoxDistanciaDianteira.Enabled = true;
                this.groupBoxDistanciaTraseira.Enabled = true;
                this.groupBoxVelocidade.Enabled = true;
                this.textBoxDisplayInfo.Enabled = true;

                this.populateTextBoxDisplayInfo("Conectado");

                PackageSend packageSend = new PackageSend();
                packageSend.Active = Util.SYSTEM_ACTIVE;
                this.sendCommandSerialPort(packageSend.ToString());
                this.populateTextBoxDisplayInfo(packageSend.ToString());
            }
            catch (Exception)
            {

            }
        }
        /// <summary>
        /// Método responsável por mover o dispositivo para trás.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonMoveTras_Click(object sender, EventArgs e)
        {
            PackageSend packageSend = new PackageSend();
            packageSend.Active = Util.SYSTEM_ACTIVE;
            packageSend.RodaDianteiraEsquerda = Util.ROTATE_BACKWARD;
            packageSend.RodaDianteiraDireita = Util.ROTATE_BACKWARD;
            packageSend.RodaTraseiraEsquerda = Util.ROTATE_BACKWARD;
            packageSend.RodaTraseiraDireita = Util.ROTATE_BACKWARD;

            this.sendCommandSerialPort(packageSend.ToString());
            this.populateTextBoxDisplayInfo(packageSend.ToString());
        }
        /// <summary>
        /// Método responsável por fechar a conexão com o dispositivo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>void</returns>
        private void buttonDesconectar_Click(object sender, EventArgs e)
        {
            if (serialPort.IsOpen == false)
            {
                return;
            }

            try
            {
                PackageSend packageSend = new PackageSend();
                packageSend.Active = Util.SYSTEM_DESACTIVE;
                this.sendCommandSerialPort(packageSend.ToString());
                this.populateTextBoxDisplayInfo(packageSend.ToString());

                this.serialPort.Close();

                this.comboBoxSelectPortaCom.Enabled = true;
                this.comboBoxSelectBaudRate.Enabled = true;
                this.buttonConectar.Enabled = true;
                this.buttonDesconectar.Enabled = false;
                this.groupBoxMove.Enabled = false;
                this.groupBoxDistanciaDianteira.Enabled = false;
                this.groupBoxDistanciaTraseira.Enabled = false;
                this.groupBoxVelocidade.Enabled = false;
                this.textBoxDisplayInfo.Enabled = false;

                this.populateTextBoxDisplayInfo("Desconectado");
            }
            catch (Exception)
            {

            }
        }