Ejemplo n.º 1
0
 static void connect()
 {
     reader.InitOnCom(2);
     if (reader.Connect() == "Connected")
     {
         reader.AcquireMode = "Global Scroll";
         connected          = true;
     }
 }
Ejemplo n.º 2
0
        public void connect_reader(object sender, System.EventArgs e)
        {
            String result;

            try
            {
                if (meReaderInterface == ComInterface.enumTCPIP)
                {
                    mReader.InitOnNetwork("127.0.0.1", 22);
                }
                else
                {
                    mReader.InitOnCom();
                }

                txtLogger.Info("Start connect to reader: {}:{}", m_reader_ip, m_reader_port);
                result = mReader.Connect();
                if (mReader.IsConnected)
                {
                    if (meReaderInterface == ComInterface.enumTCPIP)
                    {
                        if (!mReader.Login("alien", "password"))
                        {
                            txtLogger.Error("connect to reader: {}:{} failed with alien and password", m_reader_ip, m_reader_port);
                            mReader.Disconnect();
                            return;
                        }
                    }

                    txtLogger.Info("connect to reader: {}:{}", m_reader_ip, m_reader_port);

                    // to make it faster and not to lose any tag
                    mReader.AutoMode = "On";

                    // TODO: 其他参数设置
                }
            }
            catch (Exception ex)
            {
                txtLogger.Error("Exception in btnConnect_Click(): " + ex.Message);
            }
        }
        private void MainWindow_Load(object sender, EventArgs e)
        {
            //Fitting Screen
            this.Location = new Point(0, 0);
            this.Size     = Screen.PrimaryScreen.WorkingArea.Size;

            //Fitting Stream -> PictureBoxes
            this.Controls.Add(input_cam);
            this.input_cam.SizeMode = PictureBoxSizeMode.StretchImage;
            this.Controls.Add(output_cam);
            this.output_cam.SizeMode = PictureBoxSizeMode.StretchImage;
            this.logoPB.SizeMode     = PictureBoxSizeMode.StretchImage;


            /*RFID Reader Inits*/
            mReader          = new clsReader();
            mReaderInterface = ComInterface.enumTCPIP;
            mReader.Disconnect();

            try
            {
                if (mReaderInterface == ComInterface.enumTCPIP)
                {
                    mReader.InitOnNetwork("192.168.1.100", 23);
                }
                else
                {
                    mReader.InitOnCom();
                }

                string result = mReader.Connect();

                if (mReader.IsConnected)
                {
                    if (mReaderInterface == ComInterface.enumTCPIP)
                    {
                        this.Cursor = Cursors.Arrow;
                        if (!mReader.Login("alien", "password"))
                        {
                            mReader.Disconnect();
                            return;
                        }
                    }
                    mReader.AutoMode = "On";
                }
                //Stream Inits
                input_mjpeg             = new MjpegDecoder();
                input_mjpeg.FrameReady += input_mjpeg_frameReady;

                output_mjpeg             = new MjpegDecoder();
                output_mjpeg.FrameReady += output_mjpeg_frameReady;

                add_cam();

                //Timers
                antennaTimer1.Enabled = true;
                antennaTimer2.Enabled = true;
            }
            catch
            {
                inputInfoPanel.BackColor = Color.Red;
            }

            //Motion Detection Variables Inits
            fic = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            foreach (FilterInfo item in fic)
            {
                metroComboBox1.Items.Add(item.Name);
            }
            metroComboBox1.SelectedIndex = 0;
            detector    = new MotionDetector(new TwoFramesDifferenceDetector(), new MotionBorderHighlighting());
            detector_ks = 0; // Init value
        }