Example #1
11
        //initialize our Phidgets RFID reader and hook the event handlers
        private void Form1_Load(object sender, EventArgs e)
        {
            rfid = new RFID();

            rfid.Attach += new AttachEventHandler(rfid_Attach);
            rfid.Detach += new DetachEventHandler(rfid_Detach);
            rfid.Error += new ErrorEventHandler(rfid_Error);

            rfid.Tag += new TagEventHandler(rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);

            foreach (String proto in System.Enum.GetNames(typeof(RFID.RFIDTagProtocol)))
            {
                writeProtoCmb.Items.Add(proto);
            }
            writeProtoCmb.SelectedIndex = 0;

            //Disabled controls until Phidget is attached
            antennaChk.Enabled = false;
            ledChk.Enabled = false;
            output0Chk.Enabled = false;
            output1chk.Enabled = false;

            openCmdLine(rfid);
        }
Example #2
1
 //RFID
 //de standaard waarden van de RFID reader
 public void RFIDInitialize()
 {
     rfid = new RFID();
     rfid.open();
     rfid.waitForAttachment();
     rfid.Attach += new AttachEventHandler(rfid_Attach);
     rfid.Detach += new DetachEventHandler(rfid_Detach);
     rfid.Tag += new TagEventHandler(rfid_Tag);
     rfid.Antenna = true;
     rfid.LED = true;
     LBL_RFID.ForeColor = Color.Transparent;
     LBL_RFID.BackColor = Color.Lime;
 }
Example #3
1
        //constructor
        /// <summary>
        /// This is the constructor for this class and creates an RFIDHandler object that has mainly two methods that must be
        /// used in the forms. Both methods must be used ie. the Phidget must be opened and closed. 
        /// </summary>
        public PhidgetHandler()
        {
            try
            {
                myRFIDReader = new RFID();
                myRFIDReader.Attach += new AttachEventHandler(ShowWhoIsAttached);
                myRFIDReader.Detach += new DetachEventHandler(ShowWhoIsDetached);
                myRFIDReader.Tag += new TagEventHandler(ProcessThisTag);
            }
            catch (PhidgetException) {

                currentStatus = "error at start-up";
            }
        }
Example #4
1
 public void testRFIDReader(string serial, int speed)
 {
     RFID RFIDReader = new RFID();
     try
     {
         RFIDReader.openSerialPort(serial, speed);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         RFIDReader.closeSerialPort(serial);
     }
 }
 public FormRfidTest(RFID rfid)
 {
     this.rfid = rfid;
     InitializeComponent();
     lastRFIDTag = "";
     TagCtr = 0;
 }
Example #6
0
        public RfidMonitor(RFID rfid, ILoggerDisplay display)
        {
            _rfid = rfid;
            _display = display;

            _rfid.CardIDReceived += RfidCardIdReceived;
        }
 public PhidgetRFIDModule(RFID rfid) : base(rfid)
 {
     this.Antenna = rfid.Antenna;
     this.LED = rfid.LED;
     this.Outputs = rfid.outputs.Count;
     this.DigitalOutPuts = new bool[this.Outputs];
     // External LED
     this.DigitalOutPuts[0] = rfid.outputs[0];
     // External +5v
     this.DigitalOutPuts[1] = rfid.outputs[1];
 }
 public ToegangsAppForm()
 {
     InitializeComponent();
     rfid = new RFID();
     rfid.Attach += new AttachEventHandler(rfid_Attach);
     rfid.Detach += new DetachEventHandler(rfid_Detach);
     rfid.Tag += new TagEventHandler(rfid_Tag);
     rfid.TagLost += new TagEventHandler(rfid_TagLost);
     rfid.open();
     // initialiseren van de rfid functies en hier een event aan koppelen
 }
        // EVENTS
        /// <summary>
        /// This event will start when the application opens
        /// It creates the object RFID, which we will need for out scanner
        /// We also declare some actions for when the scanner
        /// got attached, detached or when a card is scanned.
        /// This Method will refresh the listview, where you can see who is at the event.
        /// </summary>
        private void Form1_Load(object sender, EventArgs e)
        {
            rfid = new RFID();

            rfid.Attach += new AttachEventHandler(rfid_Attach);
            rfid.Detach += new DetachEventHandler(rfid_Detach);

            rfid.Tag += new TagEventHandler(rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);
            rfid.open();
        }
Example #10
0
        //initialize our Phidgets RFID reader and hook the event handlers
        private void Form1_Load(object sender, EventArgs e)
        {
            rfid = new RFID();

            rfid.Attach += new AttachEventHandler(rfid_Attach);
            rfid.Detach += new DetachEventHandler(rfid_Detach);
            rfid.Error += new ErrorEventHandler(rfid_Error);

            rfid.Tag += new TagEventHandler(rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);

            //Disabled controls until Phidget is attached
            antennaChk.Enabled = false;
            ledChk.Enabled = false;
            output0Chk.Enabled = false;
            output1chk.Enabled = false;

            openCmdLine(rfid);
        }
Example #11
0
 public void Start()
 {
     try
     {
         Console.WriteLine("Trying to connect to RFIDscanner...");
         rfid = new RFID();
         rfid.Error += new ErrorEventHandler(rfid_Error);
         rfid.Tag += new TagEventHandler(rfid_Tag);
         rfid.open();
         rfid.waitForAttachment();
         rfid.Antenna = true;
         rfid.LED = true;
         Console.WriteLine("Connected");
     }
     catch (PhidgetException ex)
     {
         Console.WriteLine(ex.Description);
     }
 }
Example #12
0
        void rfid_CardIDReceived(RFID sender, string ID)
        {
            if (_rfidEnabled)
            {
                char_Display.Clear();

                if (string.Compare(ID, "4D0055D104") == 0)
                {
                    char_Display.PrintString("Welcome back sir :)");
                    multicolorLed.TurnGreen();

                    ClearTimer();
                }
                else
                {
                    char_Display.PrintString("Who are you?!");
                    multicolorLed.TurnWhite();
                }
            }
        }
Example #13
0
 public static void Start()
 {
     try
     {
         rfid = new RFID();
         tag = string.Empty;
         rfid.Error += rfid_Error;
         rfid.Tag += rfid_Tag;
         rfid.TagLost += rfid_TagLost;
         rfid.open();
         rfid.waitForAttachment();
         rfid.Antenna = true;
         rfid.LED = true;
         started = true;
     }
     catch (PhidgetException ex)
     {
         Console.WriteLine(ex.Description);
     }
 }
Example #14
0
        public Restaurant()
        {
            InitializeComponent();
            databseHelper = new DatabaseHelper();

            chineseList = new List <Chinese>();
            italianList = new List <Italian>();
            persianList = new List <Persian>();

            ListStallName = new List <ClassRestaurant>();

            gpChinese.Visible        = false;
            gpeItaliano.Visible      = false;
            gpPersian.Visible        = false;
            Gpbreakfasts.Visible     = false;
            gpDrinks.Visible         = false;
            gpeDetailsClient.Visible = false;
            gpeDetailsInfo.Enabled   = false;


            tempcountPersian       = 0;
            tempcountItalian       = 0;
            tempcountChine         = 0;
            totalPriceSelectedFood = 0;
            moneyClient            = "";
            saverfid = "";

            try
            {
                rfid             = new RFID();
                rfid.Attach     += new AttachEventHandler(ShowWhoIsAttached);
                rfid.Detach     += new DetachEventHandler(ShowWhoIsDetached);
                rfid.Tag        += new TagEventHandler(ProcessThisTag);
                lbl_Message.Text = "waiting for attachment";
                rfid.Tag        += new TagEventHandler(ProcessTagTransaction);
            }
            catch (PhidgetException)
            {
                MessageBox.Show("error at start-up.");
            }
        }
Example #15
0
        static void Main(string[] args)
        {
            try
            {
                RFID rfid = new RFID(); //Declare an RFID object

                //initialize our Phidgets RFID reader and hook the event handlers
                rfid.Attach += new AttachEventHandler(rfid_Attach);
                rfid.Detach += new DetachEventHandler(rfid_Detach);
                rfid.Error  += new ErrorEventHandler(rfid_Error);

                rfid.Tag     += new TagEventHandler(rfid_Tag);
                rfid.TagLost += new TagEventHandler(rfid_TagLost);
                rfid.open();

                //Wait for a Phidget RFID to be attached before doing anything with
                //the object
                Console.WriteLine("waiting for attachment...");
                rfid.waitForAttachment();

                //turn on the antenna and the led to show everything is working
                rfid.Antenna = true;
                rfid.LED     = true;

                //keep waiting and outputting events until keyboard input is entered
                Console.WriteLine("Press any key to end...");
                Console.Read();

                //turn off the led
                rfid.LED = false;

                //close the phidget and dispose of the object
                rfid.close();
                rfid = null;
                Console.WriteLine("ok");
            }
            catch (PhidgetException ex)
            {
                Console.WriteLine(ex.Description);
            }
        }
Example #16
0
        public Form1()
        {
            try
            {
                InitializeComponent();

                rfid      = new RFID();
                rfid.Tag += new TagEventHandler(ProcessThisTag);
                if (Convert.ToInt32(tbScore.Text) > 0)
                {
                    score = Convert.ToInt32(tbScore.Text);
                }
                score     = 0;
                team_name = tb_team_name.Text;
                result    = tbWinOrLose.Text;
            }
            catch (PhidgetException)
            {
                MessageBox.Show("error at start-up.");
            }
        }
Example #17
0
        public Form1()
        {
            InitializeComponent();
            connection = new MySqlConnection("server=studmysql01.fhict.local;" +
                                             "database=dbi393800;" +
                                             "user id=dbi393800;" +
                                             "password=ralia12345;");

            myRFIDReader = new RFID();

            try
            {
                myRFIDReader      = new RFID();
                myRFIDReader.Tag += new RFIDTagEventHandler(this.ProcessThisTag);
                myRFIDReader.Open();
            }
            catch (PhidgetException)
            {
                MessageBox.Show("error at start-up.");
            }
        }
Example #18
0
 /// <summary>
 /// Calls to UpdateListBoxAndCategory() once the form has finished loading
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MaterialSystem_Load(object sender, EventArgs e)
 {
     btnRemoveMaterial.Enabled = btnMaterialAdd.Enabled = _user.Permission == PermissionType.Administrator;
     UpdateListBoxAndCategory();
     if (_event.StartDate > DateTime.Now && _event.EndDate < DateTime.Now)
     {
         dtpStart.Value = dtpStart.MinDate = dtpEnd.MinDate = DateTime.Today;
         dtpEnd.Value   = dtpEnd.MaxDate = dtpStart.MaxDate = _event.EndDate;
     }
     else
     {
         dtpStart.Value = dtpStart.MinDate = dtpEnd.MinDate = _event.StartDate;
         dtpEnd.Value   = dtpEnd.MaxDate = dtpStart.MaxDate = _event.EndDate;
     }
     _rfid          = new RFID();
     _rfid.Attach  += rfid_Attach;
     _rfid.Detach  += rfid_Detach;
     _rfid.Tag     += rfid_Tag;
     _rfid.TagLost += rfid_TagLost;
     openCmdLine(_rfid);
 }
Example #19
0
        public Form1()
        {
            InitializeComponent();
            try
            {
                rfid          = new RFID();
                rfid.Attach  += Rfid_Attach;
                rfid.Detach  += Rfid_Detach;
                rfid.Tag     += Rfid_Tag;
                rfid.TagLost += Rfid_TagLost;

                rfid.Open();
            }
            catch (PhidgetException)
            {
                MessageBox.Show("Error");
            }

            dh = new DataHelper();
            dh.connection.Open();
        }
Example #20
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            lblStatus.Text        = "";
            lb_visitorStatus.Text = "";
            lblVisitorName.Text   = "";


            try
            {
                Rfid = new RFID();

                Rfid.Attach += new AttachEventHandler(AttachMethod);
                Rfid.Tag    += new RFIDTagEventHandler(VisitorCheckedStatus);

                Rfid.Open();
            }
            catch (DllNotFoundException ex)
            {
                MessageBox.Show("There is somthing wrong with the RFID !!!");
            }
        }
Example #21
0
        //attach event handler..populate the details fields as well as display the attached status.  enable the checkboxes to change
        //the values of the attributes of the RFID reader such as enable or disable the antenna and onboard led.
        void rfid_Attach(object sender, AttachEventArgs e)
        {
            RFID attached = (RFID)sender;

            //attachedTxt.Text = e.Device.Attached.ToString();
            attachedTxt.Text = attached.Attached.ToString();
            nameTxt.Text     = attached.Name;
            serialTxt.Text   = attached.SerialNumber.ToString();
            versionTxt.Text  = attached.Version.ToString();
            outputsTxt.Text  = attached.outputs.Count.ToString();

            if (rfid.outputs.Count > 0)
            {
                antennaChk.Checked = true;
                rfid.Antenna       = true;
                antennaChk.Enabled = true;
                ledChk.Enabled     = true;
                output0Chk.Enabled = true;
                output1chk.Enabled = true;
            }
        }
Example #22
0
        //detach event handler...clear all the fields, display the attached status, and disable the checkboxes.
        void rfid_Detach(object sender, DetachEventArgs e)
        {
            RFID detached = (RFID)sender;

            // attachedTxt.Text = detached.Attached.ToString();
            // nameTxt.Text = "";
            //serialTxt.Text = "";
            //versionTxt.Text = "";
            // outputsTxt.Text = "";

            this.Bounds = new Rectangle(this.Location, new Size(298, 433));
            // writeBox.Visible = false;

            if (rfid.outputs.Count > 0)
            {
                antennaChk.Enabled = false;
                // ledChk.Enabled = false;
                // output0Chk.Enabled = false;
                // output1chk.Enabled = false;
            }
        }
Example #23
0
 public Form1()
 {
     InitializeComponent();
     try
     {
         Reader = new RFID();
         //Reader.Attach += new AttachEventHandler(ReaderAttached);
         Reader.Tag += new TagEventHandler(Scan);
         Reader.open();
         Reader.waitForAttachment(3000);
         Reader.Antenna = true;
         Reader.LED     = true;
     }
     catch (PhidgetException)
     {
         MessageBox.Show("RFID reader not found. \nExiting program.");
         Environment.Exit(1);
     }
     data = new DatabaseConnection();
     lbFreeSites.DataSource = data.ListSites();
 }
        //Event Handlers
        private void Toegangscontroleform_Load(object sender, EventArgs e)
        {
            try
            {
                RFID rfid = new RFID();
                rfid.Attach += new AttachEventHandler(rfid_Attach);
                rfid.Detach += new DetachEventHandler(rfid_Detach);
                rfid.Error  += new ErrorEventHandler(rfid_Error);

                rfid.Tag     += new TagEventHandler(rfid_Tag);
                rfid.TagLost += new TagEventHandler(rfid_TagLost);
                rfid.open();

                labelRFID.Text = "wachtend op RFID scanner... U kunt altijd handmatig inchecken.";
                rfid.waitForAttachment(3000);
            }
            catch (PhidgetException ex)
            {
                MessageBox.Show(ex.Description);
            }
        }
Example #25
0
 public Form1()
 {
     InitializeComponent();
     FC  = new Form1Camp();
     FCH = new Form1CheckingIn();
     FSH = new Form1Shop();
     FL  = new FormLending();
     try
     {
         myRFIDReader = new RFID();
     }
     catch (PhidgetException) { MessageBox.Show("error at start-up."); }
     try
     {
         myRFIDReader.open();
         myRFIDReader.waitForAttachment(3000);
         MessageBox.Show("an RFID-reader is found and opened.");
         myRFIDReader.Antenna = true;
         myRFIDReader.LED     = true;
     }
     catch (PhidgetException) { MessageBox.Show("no RFID-reader opened."); }
 }
Example #26
0
        public void AddSensorToAgent(string typeSensor, string nom, AAgent agent)
        {
            GameObject sensor = new GameObject();

            sensor.transform.parent   = agent.transform;
            sensor.transform.position = agent.transform.position;

            if (typeSensor == "Lidar")
            {
                Lidar lidar = Lidar.CreateComponent(sensor, nom);
                agent.Sensors.Add(lidar);
                agent.AddLidarListner(lidar);
            }
            if (typeSensor == "RFID")
            {
                RFID rfid = RFID.CreateComponent(sensor, nom);
                rfid.RfidTag = RFID_Tags.Agent;

                agent.Sensors.Add(rfid);
                agent.AddRFIDListner(rfid);
            }
        }
Example #27
0
        public void Initialize()
        {
            try
            {
                //Declare an RFID object
                m_rfid = new RFID();

                //initialize our Phidgets RFID reader and hook the event handlers
                m_rfid.Attach  += new AttachEventHandler(RFID_Attached);
                m_rfid.Detach  += new DetachEventHandler(RFID_Detached);
                m_rfid.Error   += new ErrorEventHandler(RFID_Error);
                m_rfid.Tag     += new TagEventHandler(RFID_Tag_Found);
                m_rfid.TagLost += new TagEventHandler(RFID_Tag_Lost);

                //Open RFID
                m_rfid.open();
            }
            catch (PhidgetException ex)
            {
                MessageBox.Show(ex.Description);
            }
        }
Example #28
0
        public Form1()
        {
            InitializeComponent();
            label1.Visible   = false;
            label2.Visible   = false;
            moneylbl.Visible = false;

            try
            {
                Reader = new RFID();
                Reader.open();
                Reader.waitForAttachment(3000);
                Reader.Antenna = true;
                Reader.LED     = true;
                Reader.Tag    += new TagEventHandler(Leaving);
            }
            catch (PhidgetException)
            {
                MessageBox.Show("RFID reader not found. \nExiting program.");
                Environment.Exit(1);
            }
        }
Example #29
0
        public Form1()
        {
            InitializeComponent();
            workingRFID = 0;
            this.pnlCheckout.Enabled = false;
            this.btnCancel.Enabled   = true;
            try
            {
                dbh = new DBHelper();
                List <String> names = dbh.RetrieveStoreNames();
                this.cmbxShopNames.Items.AddRange(names.ToArray());
            }
            catch
            {
                this.LogMessage("Could not connect to the db. Press the button SUBMIT to try again");
            }
            try
            {
                myRFIDReader = new RFID();
                openRFID();
                myRFIDReader.Tag += new TagEventHandler(ProcessThisTag);
            }
            catch (PhidgetException) { this.LogMessage("error at start-up."); }
            this.LogMessage("Hello, please choose your shop on the left first");
            this.tbBalance.Text = balance.ToString();

            this.tbShopCode.ForeColor = Color.Gray;
            this.tbShopCode.Text      = ACCODEPLACEHOLDER;

            this.tbShopCode.GotFocus  += new EventHandler(RemoveText);
            this.tbShopCode.LostFocus += new EventHandler(AddText);

            tbPrice.Text = "0";

            //quantity = 1;
            actions       = new Stack <HistoryProduct>();
            undoneActions = new Stack <HistoryProduct>();
            // do all the stuff to display the products etc
        }
Example #30
0
        private void HNC8RfidDataTableUpdataHandler(object sender, PLC.HNC8PLCRFIDEvent e)
        {
            if (groupBoxSeleRFID.Visible)
            {
                RFID m_rfid = (RFID)sender;
                if (m_rfid.RFIDserial == RFIDserial)
                {
                    switch (e.EventType)
                    {
                    case -1:    //离线
                        RFIDconneted = false;
                        break;

                    case 0:    //通信正常
                        RFIDconneted = true;
                        break;

                    case 100:    //读写状态更新
//                             ThreaSetLaBText(labelStadeText, e.Event);
                        break;

                    case 200:
                        if (groupBoxSeleRFID.Visible && dataGridViewRFIDReadMessage.Visible)
                        {
                            DataSource      = m_rfid.RFIDReadDataDataTable;
                            timer_UpData_OK = true;
                        }
                        break;

                    case 300:
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Example #31
0
        RFID rfid;         //Declare an RFID object

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
            Resolution.Init(ref graphics);
            Content.RootDirectory = "Content";

            Resolution.SetDesiredResolution(1280, 720);
            Resolution.SetScreenResolution(1280, 720, true);

            m_Messages = new ToastBuddy(this, "ArialBlack24", UpperRight, Resolution.TransformationMatrix);
            Components.Add(m_Messages);

            //initialize our Phidgets RFID reader and hook the event handlers
            rfid         = new RFID();
            rfid.Attach += new AttachEventHandler(rfid_Attach);
            rfid.Detach += new DetachEventHandler(rfid_Detach);
            rfid.Error  += new ErrorEventHandler(rfid_Error);

            rfid.Tag     += new TagEventHandler(rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);
            rfid.open();
        }
 public Form1()
 {
     InitializeComponent();
     try
     {
         myRfidReader      = new RFID();
         myRfidReader.Tag += new TagEventHandler(RfidReaderTag);
     }
     catch (PhidgetException e)
     {
         MessageBox.Show(e.Message);
     }
     ReadChip();
     bar        = new BarApp();
     connection = new DataHelper();
     order      = new Order();
     connection.connect();
     bar.GetAllDrinks();
     bar.GetAllSnacks();
     getAllSnackFromDb();
     getAllDrinksFromDb();
     toPay = false;
 }
Example #33
0
        void rfid_CardIDReceived(RFID sender, string ID)
        {
            if (sdCard.IsCardInserted && sdCard.IsCardMounted)
            {
                Debug.Print("Write Started: " + DateTime.Now);
                led2.TurnBlue();
                FileStream sdstream = new FileStream(sdCard.GetStorageDevice().RootDirectory + @"\hello.txt", FileMode.Create);
                byte[] data = System.Text.Encoding.UTF8.GetBytes(ID);
                for (int i = 0; i < 10000; i++)
                {
                    sdstream.Write(data, 0, data.Length);
                }
                Debug.Print("Write Finished/Flush Started: " + DateTime.Now);
                sdstream.Flush();
                new Microsoft.SPOT.IO.VolumeInfo(sdCard.GetStorageDevice().RootDirectory).FlushAll();
                sdstream.Close();
                sdstream.Dispose();

                data = null;
                led2.TurnOff();
                Debug.Print("Flush Finished: " + DateTime.Now);
            }
        }
Example #34
0
        public Form1()
        {
            InitializeComponent();
            plCheckOut.Visible = false;
            FormBorderStyle    = FormBorderStyle.FixedDialog;
            // Set the start position of the form to the center of the screen.
            StartPosition = FormStartPosition.CenterScreen;
            //database connection
            string dbConnectionInfo;

            dbConnectionInfo = "server=studmysql01.fhict.local;user id=dbi393800;database=dbi393800;password=ralia12345;";
            connection       = new MySqlConnection(dbConnectionInfo);
            #region Open connection MySql and RFID initialization
            try
            {
                connection.Open();
                RFIDreader          = new RFID();
                RFIDreader.Attach  += RFIDReaderAttach;
                RFIDreader.Detach  += RFIDReaderDetach;
                RFIDreader.Tag     += this.ShowInfoOnTagDetected;
                RFIDreader.TagLost += this.TagLost;
            }
            catch (PhidgetException)
            {
                MessageBox.Show("Error appeared while trying to read RFID");
                label6.ForeColor = System.Drawing.Color.Red;
            }
            catch (MySqlException msq)
            {
                MessageBox.Show("Could not connect to database, error message: " + msq.Message);
            }
            finally
            {
                connection.Close();
            }
            #endregion
        }
Example #35
0
        //initialize our Phidgets RFID reader and hook the event handlers
        private void Form1_Load(object sender, EventArgs e)
        {
            rfid = new RFID();
            f.Show();
            rfid.Attach += new AttachEventHandler(rfid_Attach);
            rfid.Attach += new AttachEventHandler(f.rfid_Attach);

            rfid.Detach += new DetachEventHandler(rfid_Detach);
            rfid.Detach += new DetachEventHandler(f.rfid_Detach);

            rfid.Error += new ErrorEventHandler(rfid_Error);

            rfid.Tag     += new TagEventHandler(rfid_Tag);
            rfid.Tag     += new TagEventHandler(f.rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);
            rfid.open();
            //Disabled controls until Phidget is attached
            antennaChk.Enabled = false;
            ledChk.Enabled     = false;
            output0Chk.Enabled = false;
            output1chk.Enabled = false;

            openCmdLine(rfid);
        }
Example #36
0
        public Form2()
        {
            InitializeComponent();
            try { dh = new DataHelper(); dh.connection.Open(); }
            catch (Exception e) { MessageBox.Show("Connection with database failed: " + e.Message); }
            try { customer = dh.GetCustomerInfo(); }
            catch (Exception e3) { MessageBox.Show(e3.Message); }
            this.ShowInfo();
            try
            {
                rfid          = new RFID();
                rfid.Attach  += Rfid_Attach;
                rfid.Detach  += Rfid_Detach;
                rfid.Tag     += Rfid_Tag;
                rfid.TagLost += Rfid_TagLost;

                rfid.Open();
            }
            catch (PhidgetException)
            {
                MessageBox.Show("Error");
            }
            dh.connection.Close();
        }
Example #37
0
        //initialize our Phidgets RFID reader and hook the event handlers
        private void Form1_Load(object sender, EventArgs e)
        {
            rfid          = new RFID();
            rfid.Attach  += new AttachEventHandler(rfid_Attach);
            rfid.Detach  += new DetachEventHandler(rfid_Detach);
            rfid.Error   += new ErrorEventHandler(rfid_Error);
            rfid.Tag     += new TagEventHandler(rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);
            //Disabled controls until Phidget is attached
            antennaChk.Enabled = false;
            ledChk.Enabled     = false;
            output0Chk.Enabled = false;
            output1chk.Enabled = false;
            openCmdLine(rfid);

            //Generate Food!
            food.Name    = "Apple";
            food.Tag     = "1000e328f3";
            foodDBArr[0] = food;

            food.Name    = "Bannana";
            food.Tag     = "1000fa9b29";
            foodDBArr[1] = food;

            food.Name    = "Cauliflower";
            food.Tag     = "110057e4b5";
            foodDBArr[2] = food;

            food.Name    = "Dates";
            food.Tag     = "1000fa9b18";
            foodDBArr[3] = food;

            food.Name    = "Eggs";
            food.Tag     = "1000e31d55";
            foodDBArr[4] = food;
        }
Example #38
0
        private void GetRFIDList(HttpContext context, int pageIndex, int pageSize, string keyword)
        {
            var           bll         = new RFID();
            int           totalRecord = 0;
            StringBuilder sqlWhere    = null;
            ParamsHelper  parms       = null;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(1000);
                }
                parms = new ParamsHelper();
                sqlWhere.Append("and (r.TID like @Keyword or r.EPC like @Keyword) ");
                var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50);
                parm.Value = "%" + keyword + "%";
                parms.Add(parm);
            }

            var list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());

            context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}"));
        }
Example #39
0
        //attach event handler..populate the details fields as well as display the attached status.  enable the checkboxes to change
        //the values of the attributes of the RFID reader such as enable or disable the antenna and onboard led.
        void rfid_Attach(object sender, AttachEventArgs e)
        {
            //phidgetInfoBox1.FillPhidgetInfo((Phidget)sender);
            //readBox.Visible = true;

            RFID attachedDevice = (RFID)sender;

            //switch (attachedDevice.DeviceID) {
            //case DeviceID.PN_1024:
            //	writeBox.Visible = true;
            //	break;
            //case DeviceID.PN_1023:
            //	writeBox.Visible = false;
            //	break;
            //}

            //antennaChk.Visible = true;
            //keyboardCheckBox.Visible = true;
            //antennaChk.Checked = true;
            try {
                rfid.AntennaEnabled = true;
            }
            catch (PhidgetException ex) { errorBox.addMessage("Error enabling antenna: " + ex.Message); }
        }
Example #40
0
        //---------------------------------------------------------------------------
        private void btRead_Click(object sender, RoutedEventArgs e)
        {
            string sPlateID = m_tbRFNo.Text.ToUpper();

            fn_ResetDataClear();

            //JUNG/201215
            if (sPlateID.Substring(0, 1) == "P" && sPlateID.Length == 5)
            {
                UserFunction.fn_WriteLog("[Manual] Request RF Info.: " + sPlateID);

                //P,5글자의 경우 RFID Read Skip 후 REST API(요청:이은지)
                REST.fn_ReqRFInfo(sPlateID);
            }
            else
            {
                UserFunction.fn_WriteLog("[Manual] RFID Read Click");

                fn_ResetDataClear();
                RFID.fn_ReqRead();
            }

            btRead.IsEnabled = false;
        }
Example #41
0
        public Form1()
        {
            InitializeComponent();
            AssignHouseRects();


            try
            {
                // Creating RFID reader and adding the events needed
                ConnectedRFIDReader         = new RFID();
                ConnectedRFIDReader.Attach += new AttachEventHandler(IsAttached);
                ConnectedRFIDReader.Detach += new DetachEventHandler(IsDetached);
                ConnectedRFIDReader.Tag    += new TagEventHandler(ProcessThisTag);
            }
            catch (PhidgetException)
            {
                MessageBox.Show("error at start-up.");
            }
            // running readchip
            connectionDB      = new DBhelper();
            tempCampHostList  = connectionDB.AllCampHost();
            assignOtherGuests = false;
            readchip();
        }
Example #42
0
        public EntranceAPP()
        {
            connecting = new DBhelper();
            entran     = new Entrance();
            c          = new Client("s", "c", 777777, 1);
            InitializeComponent();
            connecting.connect();

            try
            {
                // Creating RFID reader and adding the events needed
                myRFIDReader         = new RFID();
                myRFIDReader.Attach += new AttachEventHandler(ShowWhoIsAttached);
                myRFIDReader.Detach += new DetachEventHandler(ShowWhoIsDetached);
                myRFIDReader.Tag    += new TagEventHandler(ProcessThisTag);
            }
            catch (PhidgetException)
            {
                MessageBox.Show("error at start-up.");
            }

            // running readchip
            readchip();
        }
        public FormToegangsControle()
        {
            InitializeComponent();

            MessageBox.Show("Klik op OK en plug daarna pas de RFID-lezer in de computer.", "Melding", MessageBoxButtons.OK, MessageBoxIcon.Information);

            RFID rfid = new RFID();
            try
            {

                //initialize our Phidgets RFID reader and hook the event handlers
                rfid.Attach += new AttachEventHandler(rfid_Attach);

                rfid.Tag += new TagEventHandler(rfid_Tag);
                rfid.TagLost += new TagEventHandler(rfid_TagLost);
                rfid.open();

                //Wait for a Phidget RFID to be attached before doing anything with
                //the object
                Console.WriteLine("waiting for attachment...");
                rfid.waitForAttachment();

                //turn on the antenna and the led to show everything is working
                rfid.Antenna = true;
                rfid.LED = true;

                //turn off the led
                rfid.LED = false;

            }
            catch (PhidgetException ex)
            {

                Console.WriteLine(ex.Description);
            }
        }
Example #44
0
        //attach event handler..populate the details fields as well as display the attached status.  enable the checkboxes to change
        //the values of the attributes of the RFID reader such as enable or disable the antenna and onboard led.
        void rfid_Attach(object sender, AttachEventArgs e)
        {
            RFID attached = (RFID)sender;

            //attachedTxt.Text = e.Device.Attached.ToString();
            //attachedTxt.Text = attached.Attached.ToString();
            //nameTxt.Text = attached.Name;
            //serialTxt.Text = attached.SerialNumber.ToString();
            //versionTxt.Text = attached.Version.ToString();
            //outputsTxt.Text = attached.outputs.Count.ToString();

            switch (attached.ID)
            {
            case Phidget.PhidgetID.RFID_2OUTPUT_READ_WRITE:
                this.Bounds = new Rectangle(this.Location, new Size(298, 545));
                //writeBox.Visible = true;
                break;

            case Phidget.PhidgetID.RFID:
            case Phidget.PhidgetID.RFID_2OUTPUT:
            default:
                this.Bounds = new Rectangle(this.Location, new Size(298, 433));
                //writeBox.Visible = false;
                break;
            }

            if (rfid.outputs.Count > 0)
            {
                antennaChk.Checked = true;
                rfid.Antenna       = true;
                antennaChk.Enabled = true;
                // ledChk.Enabled = true;
                // output0Chk.Enabled = true;
                // output1chk.Enabled = true;
            }
        }
Example #45
0
        void rfid_CardIDReceived(RFID sender, string ID)
        {
            _led7rVal++;
            if (_led7rVal >= 8) {
                _led7rVal = 0;
            }

            led7r.TurnLightOn(_led7rVal, true);
        }
Example #46
0
 public RFIDAdapter(RFID target)
 {
     _target = target;
 }
        /// <summary>
        /// 解析IOLink数据并维持缓存
        /// </summary>
        /// <param name="curBuff"></param>
        private void DealIOLinkData(byte[] curBuff)
        {
            if (curBuff.Length > 6593)
            {
                try
                {
                    if (Enumerable.SequenceEqual(IOLinkRecorBuff, curBuff))
                    {
                    }
                    else
                    {
                        IOLinkData.ClearAll();
                        IOLinkRecorBuff = curBuff;
                        int index = 0;
                        for (int i = 0; i < 8; i++)
                        {
                            RFID mRFID = new RFID();
                            mRFID.StationName     = "RFIDStation" + (i + 1);
                            mRFID.VendorName      = Encoding.Default.GetString(curBuff.Skip(index + 0).Take(64).ToArray()).Replace("\0", "");
                            mRFID.ProductName     = Encoding.Default.GetString(curBuff.Skip(index + 64).Take(64).ToArray()).Replace("\0", "");
                            mRFID.SerialNumber    = Encoding.Default.GetString(curBuff.Skip(index + 128).Take(16).ToArray()).Replace("\0", "");
                            mRFID.HardwareVersion = Encoding.Default.GetString(curBuff.Skip(index + 144).Take(64).ToArray()).Replace("\0", "");
                            mRFID.FirmwareVersion = Encoding.Default.GetString(curBuff.Skip(index + 208).Take(64).ToArray()).Replace("\0", "");
                            mRFID.DeviceStatus    = curBuff[index + 272].ToString();
                            mRFID.Mode            = curBuff[index + 273] == 0x80 ? "Easy Mode" : "Expert Mode";
                            mRFID.MemoryArea      = curBuff[index + 274] == 0x80 ? "UID" : "User Memory";
                            mRFID.NumberOfBytes   = curBuff[index + 275].ToString();
                            mRFID.StartAddress    = BitConverter.ToUInt16(curBuff, index + 276).ToString();
                            mRFID.AutoStart       = curBuff[index + 278] == 0x80 ? "On" : "Off";
                            mRFID.TagType         = curBuff[index + 279].ToString();
                            IOLinkData.RFIDList.Add(mRFID);

                            R200 mR200 = new R200();
                            mR200.VendorName          = Encoding.Default.GetString(curBuff.Skip(index + 280).Take(64).ToArray()).Replace("\0", "");
                            mR200.ProductName         = Encoding.Default.GetString(curBuff.Skip(index + 344).Take(64).ToArray()).Replace("\0", "");
                            mR200.SerialNumber        = Encoding.Default.GetString(curBuff.Skip(index + 408).Take(16).ToArray()).Replace("\0", "");
                            mR200.HardwareVersion     = Encoding.Default.GetString(curBuff.Skip(index + 424).Take(64).ToArray()).Replace("\0", "");
                            mR200.FirmwareVersion     = Encoding.Default.GetString(curBuff.Skip(index + 488).Take(64).ToArray()).Replace("\0", "");
                            mR200.DeviceStatus        = curBuff[index + 552].ToString();
                            mR200.TemperatureIndicate = curBuff[index + 553].ToString();
                            mR200.OperationHours      = BitConverter.ToUInt32(curBuff, index + 554).ToString();
                            IOLinkData.R200List.Add(mR200);
                            index += 800;
                        }
                        index = 6400;
                        for (int i = 0; i < 4; i++)
                        {
                            ICE mICE = new ICE();
                            mICE.OrderID         = Encoding.Default.GetString(curBuff.Skip(index + 0).Take(20).ToArray()).Replace("\0", "");
                            mICE.SerialNumber    = Encoding.Default.GetString(curBuff.Skip(index + 20).Take(16).ToArray()).Replace("\0", "");
                            mICE.HardwareVersion = BitConverter.ToUInt16(curBuff, (index + 36)).ToString();
                            mICE.SoftwareVersion = BitConverter.ToUInt32(curBuff, (index + 38)).ToString();
                            mICE.IMVersion       = curBuff[index + 42].ToString() + "." + curBuff[index + 43].ToString();
                            IOLinkData.ICEList.Add(mICE);
                            index += 50;
                        }
                        //Update DiagnoseTable
                        DBOperator.DBOperator.UpdateDiagnoseTable();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogFile.Trace, ex.Message);
                }
            }
        }
 private void EntraceControl_Load(object sender, EventArgs e)
 {
     _rfid = new RFID();
     _rfid.Attach += rfid_Attach;
     _rfid.Detach += rfid_Detach;
     _rfid.Tag += rfid_Tag;
     _rfid.TagLost += rfid_TagLost;
     openCmdLine(_rfid);
 }
 /// <summary>
 /// Calls to UpdateListBoxAndCategory() once the form has finished loading
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MaterialSystem_Load(object sender, EventArgs e)
 {
     btnRemoveMaterial.Enabled = btnMaterialAdd.Enabled = _user.Permission == PermissionType.Administrator;
     UpdateListBoxAndCategory();
     _rfid = new RFID();
     _rfid.Attach += rfid_Attach;
     _rfid.Detach += rfid_Detach;
     _rfid.Tag += rfid_Tag;
     _rfid.TagLost += rfid_TagLost;
     openCmdLine(_rfid);
 }
Example #50
0
 void rfid_CardIDBadChecksum(RFID sender, string ID)
 {
     Debug.Print("bad rfid checksum ");
 }
        private void rfidClosePhidgetHardware()
        {
            //turn off the led
            rfid.LED = false;

            //close the phidget and dispose of the object
            rfid.Attach -= new AttachEventHandler(rfid_Attach);
            rfid.Detach -= new DetachEventHandler(rfid_Detach);
            rfid.Tag -= new TagEventHandler(rfid_Tag);
            rfid.TagLost -= new TagEventHandler(rfid_TagLost);
            rfid.Error -= new Phidgets.Events.ErrorEventHandler(rfid_Error);

            rfid.close();
            rfid = null;
        }
Example #52
0
 void rfid_CardIDReceived(RFID sender, string ID)
 {
     Debug.Print("mem: " + Debug.GC(false));
     Debug.Print("RFID: " + ID);
     BumpLed7r();
     _nd2_1.WriteLine("hello!");
     BumpLed7r();
 }
Example #53
0
 void RfidCardIdReceived(RFID sender, string id)
 {
     _display.ShowMessage("Card:" + id, 10, CardDetailsYPosition);
     Status.PostStatus("RFID:" + id);
 }
        private void rfidInitPhidgetHardware()
        {
            try
            {
                string t = Environment.UserName;

                rfid = new RFID();

                //initialize our Phidgets RFID reader and hook the event handlers
                rfid.Attach += new AttachEventHandler(rfid_Attach);
                rfid.Detach += new DetachEventHandler(rfid_Detach);
                rfid.Error += new Phidgets.Events.ErrorEventHandler(rfid_Error);
                rfid.Tag += new TagEventHandler(rfid_Tag);
                rfid.TagLost += new TagEventHandler(rfid_TagLost);
                rfid.open();

                //Wait for a Phidget RFID to be attached before doing anything with 
                //the object
                Console.WriteLine("waiting for attachment...");
                rfid.waitForAttachment();

                //turn on the antenna and the led to show everything is working
                rfid.Antenna = true;
                rfid.LED = true;
            }
            catch (PhidgetException ex)
            {
                Console.WriteLine(ex.Description);
            }
        }
 private void MiddlePage_SetActive(object sender, System.ComponentModel.CancelEventArgs e)
 {
     SetWizardButtons(WizardButtons.Back);
     string port = (string)RegistryAccess.Primary.GetValue("Port");
     r = new RFID(port);
     r.IncomingRfid += new RfidRead(r_IncomingRfid);
     this.Disposed += new EventHandler(MiddlePage_Disposed);
     this.WizardBack += new WizardPageEventHandler(MiddlePage_WizardBack);
     this.WizardFinish += new CancelEventHandler(MiddlePage_WizardFinish);
     this.WizardNext += new WizardPageEventHandler(MiddlePage_WizardNext);
 }
Example #56
0
 /// <summary>
 /// Calls to UpdateListBoxAndCategory() once the form has finished loading
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MaterialSystem_Load(object sender, EventArgs e)
 {
     btnRemoveMaterial.Enabled = btnMaterialAdd.Enabled = _user.Permission == PermissionType.Administrator;
     UpdateListBoxAndCategory();
     if (_event.StartDate > DateTime.Now && _event.EndDate < DateTime.Now)
     {
         dtpStart.Value = dtpStart.MinDate = dtpEnd.MinDate = DateTime.Today;
         dtpEnd.Value = dtpEnd.MaxDate = dtpStart.MaxDate = _event.EndDate;
     }
     else
     {
         dtpStart.Value = dtpStart.MinDate = dtpEnd.MinDate = _event.StartDate;
         dtpEnd.Value = dtpEnd.MaxDate = dtpStart.MaxDate = _event.EndDate;
     }
     _rfid = new RFID();
     _rfid.Attach += rfid_Attach;
     _rfid.Detach += rfid_Detach;
     _rfid.Tag += rfid_Tag;
     _rfid.TagLost += rfid_TagLost;
     openCmdLine(_rfid);
 }