Example #1
0
 public void PortAc()
 {
     SeriPort.Open();
     SeriPort.DiscardInBuffer();
     StopWatch.Start();
     SeriPortAcildi?.Invoke(SeriPort, EventArgs.Empty);
 }
Example #2
0
 private void btnKes_Click(object sender, EventArgs e)
 {
     if (SeriPort.IsOpen == true)
     {
         SeriPort.Close();
     }
 }
Example #3
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (SeriPort.IsOpen == true)
     {
         SeriPort.Close();
     }
 }
Example #4
0
 private void btnGonder_Click(object sender, EventArgs e)
 {
     if (SeriPort.IsOpen == true)
     {
         if (chbCR.Checked == true && chbLF.Checked == false)
         {
             SeriPort.Write(rtbGonder.Text + "\r");
         }
         else if (chbCR.Checked == false && chbLF.Checked == true)
         {
             SeriPort.Write(rtbGonder.Text + "\n");
         }
         else if (chbCR.Checked == true && chbLF.Checked == true)
         {
             SeriPort.Write(rtbGonder.Text + "\r\n");
         }
         else
         {
             SeriPort.Write(rtbGonder.Text);
         }
     }
     else
     {
         MessageBox.Show("No Connection");
     }
 }
 private void frmMain_Load(object sender, EventArgs e)
 {
     cmbPortName.Items.AddRange(SeriPort.getPortNames());
     lstMessages.Items.Add("!AIVDM,1,1,1,B,8>h8nkP0Glr=<hFI0D6??wvlFR06EuOwgwl?wnSwe7wvlOw?sAwwnSGmwvh0,0*17");
     //maritec message 4
     lstMessages.Items.Add("!AIVDM,1,1,,A,400TcdiuiT7VDR>3nIfr6>i00000,0*78");
     tmrMessage.Interval = 500;
     tmrMessage.Start();
 }
Example #6
0
 private void SeriPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         Gelen = SeriPort.ReadLine();
         this.Invoke(new EventHandler(DisplayText));
     }
     catch (Exception er)
     {
         MessageBox.Show("Error:" + er.Message);
     }
 }
Example #7
0
 private void btnBaglan_Click(object sender, EventArgs e)
 {
     if (SeriPort.IsOpen == false)
     {
         if (cbComPort.Text == "")
         {
             return;
         }
         SeriPort.PortName = cbComPort.Text;
         SeriPort.BaudRate = Convert.ToInt32(cbBaud.Text);
         try
         {
             SeriPort.Open();
         }
         catch (Exception er)
         {
             MessageBox.Show("Error:" + er.Message);
         }
     }
     else
     {
         rtbEkran.Text = "seriport already open";
     }
 }
Example #8
0
 public void PortArabellekTemizle() => SeriPort.DiscardInBuffer();
Example #9
0
 public void PortKapat()
 {
     StopWatch.Stop();
     SeriPort.Close();
     SeriPortKapandi?.Invoke(SeriPort, EventArgs.Empty);
 }
 private void cmbPortName_SelectedIndexChanged(object sender, EventArgs e)
 {
     sp = new SeriPort(cmbPortName.Text, 38400, 8);
 }