Exemple #1
0
        void select()
        {
            try
            {
                if (dataGridView1.CurrentRow != null)
                {
                    string   ip    = dataGridView1.CurrentRow.Cells["RadarIP"].Value.ToString();
                    NsrRadar radar = _radars[ip];
                    radar.Connect();
                    _radarSelected = radar;

                    if (radar != null)
                    {
                        rvs_PARAM_STATUS state = new rvs_PARAM_STATUS();
                        if (radar.GetStatus(ref state))
                        {
                            textBox1.Text = "0x" + state.addr.ToString("x2");
                            textBox2.Text = state.heart.time.ToString();
                            textBox3.Text = state.bee.IsOpen.ToString();
                            textBox4.Text = state.radarVerInfo.FirmwareVersion;
                            textBox5.Text = state.radarVerInfo.AlgorithmVersion;
                            textBox6.Text = state.radarVerInfo.FpgaVersion;
                            textBox7.Clear();
                            for (int i = 0; i < radar.PtsAlarmAreaVertices.Length; i++)
                            {
                                textBox7.AppendText(i.ToString("D2"));
                                textBox7.AppendText(" , ");
                                textBox7.AppendText(radar.PtsAlarmAreaVertices[i].ToString());
                                textBox7.AppendText("\r\n");
                            }
                        }
                        else
                        {
                            textBox1.Clear();
                            textBox2.Clear();
                            textBox3.Clear();
                            textBox4.Clear();
                            textBox5.Clear();
                            textBox6.Clear();
                            textBox7.Clear();
                            MessageBox.Show("Query failure)");
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #2
0
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     try
     {
         IPAddress ip    = IPAddress.Parse(textBox12.Text);
         int       port  = int.Parse(textBox10.Text);
         NsrRadar  radar = NsrSdk.Instance.CreateRadar(ip.ToString(), port);
         radar.Connect();
         _radars[radar.Ip] = radar;
         UpdateRadars();
         radar.GetFilterCoordinate();
         textBox7.Text = radar.GetFilterCoordinate().ToString();
         MessageBox.Show("Succes!", "Radar ready to using!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #3
0
        private void RadarBroadcast(NsrRadar radar, ref RVS_PARAM_BROADCAST info)
        {
            if (radar.Ip == "192.168.61.123" && radar.Online == false)
            {
                try
                {
                    radar.Connect();
                }
                catch (Exception)
                {
                }
            }
            if (_radars.ContainsKey(radar.Ip))
            {
                return;
            }

            _radars[radar.Ip] = radar;

            this.BeginInvoke(new Action(() =>
            {
                UpdateRadars();
            }));
        }