Ejemplo n.º 1
0
        private void GetTagId()
        {
            List <string> listUsbDevicePath = CLReader.GetUsbHidDeviceList();

            if (listUsbDevicePath.Count > 0)
            {
                ConnIDs = listUsbDevicePath[0];
                if (CLReader.CreateUsbConn(ConnIDs, Handle, RFIDPrg))
                {
                    // MessageBox.Show("Connected");
                    // btnGetTagId .Text = "Ok";
                    eReadType eRType = new eReadType();
                    eRType     = eReadType.Single;
                    antennaNum = eAntennaNo._1;

                    int TID = 0;
                    TID = CLReader._Tag6C.GetEPC_TID(ConnIDs, antennaNum, eRType);
                    System.Threading.Thread.Sleep(1000);
                    if (TID != 0)
                    {
                        //  MessageBox.Show(TID.ToString());
                    }
                }
                else
                {
                    MessageBox.Show("Not connected");
                }
            }
            else
            {
                MessageBox.Show("No USB connections Found");
            }
            CLReader.CloseConn(ConnIDs);
            CLReader.CloseAllConnect();
        }
Ejemplo n.º 2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            ConnectType type = ConnectType.USB;

            switch (selectType.SelectedIndex)
            {
            case 0:
                MessageBox.Show("Please Select Connection Type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;

            case 2:
                type = ConnectType.WiFi;
                break;
            }
            eAntennaNo antNum = 0;

            if (chkAntenna1.Checked)
            {
                antNum |= eAntennaNo._1;
            }
            if (chkAntenna2.Checked)
            {
                antNum |= eAntennaNo._2;
            }
            if (chkAntenna3.Checked)
            {
                antNum |= eAntennaNo._3;
            }
            if (chkAntenna4.Checked)
            {
                antNum |= eAntennaNo._4;
            }
            int interval = Convert.ToInt32(txtTime.Value);

            Reader = GetReader(txtReaderType.SelectedIndex, interval, antNum);
            if (Reader == null)
            {
                return;
            }
            if (Reader.Connect(type))
            {
                txtConnection.Text = "Connected Successfully";
                Connect            = true;
                Log("Connected");
            }
            else
            {
                txtConnection.Text = "Connection Faild!";
                Log("Faild to connect");
            }
        }
Ejemplo n.º 3
0
        private IReader GetReader(int selectedIndex, int interval, eAntennaNo antNum)
        {
            IReader reader = null;

            switch (selectedIndex)
            {
            case 0:
                MessageBox.Show("Please Select Reader Type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case 1:
                reader = new Hopeland(interval, antNum, Handle);
                break;
            }
            return(reader);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 初始化天线
 /// </summary>
 /// <param name="AntennaCount">天线的数量</param>
 /// <returns></returns>
 public int GeteAntennaNo(int AntennaCount)
 {
     for (int i = 0; i < AntennaCount; i++)
     {
         antNUM += AntennaTagList[i];
         if (i == 0)
         {
             antNo = (eAntennaNo)AntennaTagList[i];
         }
         else
         {
             antNo = antNo | (eAntennaNo)AntennaTagList[i];
         }
     }
     return(antNUM);
 }
Ejemplo n.º 5
0
        private void btnConnectUSB_Click(object sender, EventArgs e)
        {
            List <string> listUsbDevicePath = CLReader.GetUsbHidDeviceList();

            comboBox1.DataSource = listUsbDevicePath;
            int i = listUsbDevicePath.Count;

            textBox3.Text = i.ToString();

            if (listUsbDevicePath.Count > 0)
            {
                ConnIDs = listUsbDevicePath[0];
                if (CLReader.CreateUsbConn(ConnIDs, Handle, RFIDPrg))
                {
                    MessageBox.Show("Connected");
                    eReadType eRType = new eReadType();
                    eRType     = eReadType.Inventory;
                    antennaNum = eAntennaNo._1;

                    int TID = 0;
                    TID = CLReader._Tag6C.GetEPC_TID(ConnIDs, antennaNum, eRType);
                    if (TID != 0)
                    {
                        MessageBox.Show("Data Read");
                    }
                }
                else
                {
                    MessageBox.Show("Not connected");
                }
            }
            else
            {
                MessageBox.Show("No USB connections Found");
            }

            CLReader.CloseConn(ConnIDs);
            CLReader.CloseAllConnect();

            btnReturnButton.Visible = true;
            //this.Close();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 开始读卡
        /// </summary>
        public void StartReadEpc(bool IsTid = false)
        {
            this.readType = (eReadType)singleOrWhile;
            //var st = CLReader._Tag6C.GetEPC(ConnID, this.antNo, readType);
            antNo = antNo | (eAntennaNo)15;
            var st2 = -1;

            if (IsTid)
            {
                CLReader._Config.Stop(ConnID);
                st2 = CLReader._Tag6C.GetEPC_TID(ConnID, antNo, readType);
            }
            else
            {
                ClouReaderAPI.CLReader.RFID_OPTION.StopReader(ConnID);
                st2 = CLReader._Tag6C.GetEPC(ConnID, antNo, readType);
            }

            CLReader.DIC_CONNECT[ConnID].ProcessCount = 0;
            IsStartRead = true;
        }
Ejemplo n.º 7
0
        public void AddNewStudent()
        {
            txtName.ReadOnly                   = false;
            txtClass.ReadOnly                  = false;
            txtRollNos.ReadOnly                = false;
            txtClassTeacher.ReadOnly           = false;
            txtClassTeacherContactNos.ReadOnly = false;
            txtGuardianName.ReadOnly           = false;
            txtGuardiancontactNumber.ReadOnly  = false;
            txtHomeAddress.ReadOnly            = false;
            txtSiblingInformation.ReadOnly     = false;
            txtJoinedSchoolDate.ReadOnly       = false;
            txtBloodGroup.ReadOnly             = false;
            txtWarnings.ReadOnly               = false;
            txtNotes.ReadOnly                  = false;
            txtEntryTime.ReadOnly              = false;
            txtExitTime.ReadOnly               = false;
            txtDate.ReadOnly                   = false;
            txtLastNotedLocation.ReadOnly      = false;
            txtAttendenceInDays.ReadOnly       = false;
            txtGender.ReadOnly                 = false;
            txtAadharNos.ReadOnly              = false;

            panel3.Visible        = false;
            btnSaveNExit.Visible  = true;
            isAddingNewStudent    = true;
            GetRFID_panel.Visible = true;

            if (GetRFID_panel.Visible == true)
            {
                #region READRFID

                //Show RFID reading first.
                GetRFID_panel.Width  = 800;
                GetRFID_panel.Height = 800;

                //Disable exit button and background.
                btnExitButton.Visible = false;

                ProgramCLUSB  RFIDPrg           = new ProgramCLUSB();
                List <string> listUsbDevicePath = new List <string>();

                string     ConnIDs    = "";
                eAntennaNo antennaNum = eAntennaNo._1;
                eReadType  eRType     = eReadType.Single;


                try
                {
                    listUsbDevicePath = CLReader.GetUsbHidDeviceList();
                }
                catch (Exception eee)
                {
                    MessageBox.Show(eee.ToString());
                }



                if (listUsbDevicePath.Count > 0)
                {
                    ConnIDs = listUsbDevicePath[0];

                    if (CLReader.CreateUsbConn(ConnIDs, Handle, RFIDPrg))
                    {
                        MessageBox.Show("Connected");


                        int TID = 0;

                        TID = CLReader._Tag6C.GetEPC_TID(ConnIDs, antennaNum, eRType);


                        if (TID > 0)
                        {
                            MessageBox.Show("Data Read");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Not connected");
                    }
                }
                else
                {
                    MessageBox.Show("No USB connections Found");
                }


                scanID.Text = "ID of Tag =" + TagRead;

                CLReader.CloseConn(ConnIDs);
                CLReader.CloseAllConnect();
                btnExitButton.Visible = true;
                txtStudentId.Text     = TagRead;



                btnSaveNExit.Visible = true;
                btnSaveNExit.Enabled = true;
            }


            #endregion
        }
Ejemplo n.º 8
0
 public HopeLandLogger(eAntennaNo antNum)
 {
     AntNum     = antNum;
     ReadedTags = new Dictionary <string, TagModel>();
 }
Ejemplo n.º 9
0
 public Hopeland(int checkIntervalSecond, eAntennaNo antNum, IntPtr handle)
 {
     CheckIntervalSecond = checkIntervalSecond;
     Log    = new HopeLandLogger(antNum);
     Handle = handle;
 }