220 likes | 390 Views
RFID App Development James Peternel Software Engineer Lead. Overview. Developing an RFID application in C# VS 2005 Basic functions and event handlers Focus on IF61 reader. Create Basic Project in C#. Select Windows Application. RFID References. Add RFID class references to your project.
E N D
Overview • Developing an RFID application in C# VS 2005 • Basic functions and event handlers • Focus on IF61 reader
Create Basic Project in C# • Select Windows Application
RFID References • Add RFID class references to your project
RFID References • using Intermec.DataCollection.RFID;
Now lets add the basic features to your app • Create reader object • Add Event Handlers • Add Tag Handlers
Create RFID Object • LocalHost • string tConnection = "TCP://" + "127.0.0.1" + ":2189"; • Defaults brdr = new BRIReader(null, tConnection); • With Options • Read buffer size • Event buffer size BRIReader.LoggerOptionsAdv LogOp = new BRIReader.LoggerOptionsAdv(); LogOp.LogFilePath = ".\\IDLClassDebugLog.txt"; LogOp.ShowNonPrintableChars = true; brdr = new BRIReader(this, tConnection, 22000, 2000,LogOp);
Create Event Handlers private int AddEventHandlers() { //********************************************************************* // Add the event handler to handle the tag events and trigger pulls. // Not all of these are used but added as samples of what are available. //********************************************************************* try { this.brdr.EventHandlerRadio += new Radio_EventHandlerAdv(brdr_EventHandlerRadio); this.brdr.EventHandlerTag += new Tag_EventHandlerAdv(brdr_EventHandlerTag); this.brdr.EventHandlerGPIO += new GPIO_EventHandlerAdv(Form1_EventHandlerGPIO); } catch { return -1; } return 0; }
Tag Event Handler this.brdr.StartReadingTags(null, "COUNT ANT", BRIReader.TagReportOptions.EVENT); void brdr_EventHandlerTag(object sender, EVTADV_Tag_EventArgs EvtArgs) { //********************************************************************* // This function process any tag that is returned as an event. // This function is in use when you send a READ with REPORT=EVENT //********************************************************************* bool bStatus = false; RspCount = 1; RspMsgList[1] = EvtArgs.DataString.ToString(); bStatus = CheckIfTagIDIsInDBase(RspMsgList[1]); }
Polling For Tags (Report=No) this.brdr.StartReadingTags(null, "COUNT ANT", BRIReader.TagReportOptions.POLL); bStatus = brdr.PollTags(); foreach (Tag tt in brdr.Tags) { RspCount++; RspMsgList[RspCount] = tt.ToString(); if (tt.TagFields.ItemCount > 0) { foreach (TagField tf in tt.TagFields.FieldArray) { RspMsgList[RspCount] += " "; RspMsgList[RspCount] += tf.ToString(); } } }
Add GPIO Event Handler void Form1_EventHandlerGPIO(object sender, EVTADV_GPIO_EventArgs EvtArgs) { //process gpio trigger events if (EvtArgs.TriggerNameString.Equals("ENTER_ON")) { //your code here } else if (EvtArgs.TriggerNameString.Equals("EXIT_ON")) { //your code here } }
How to Install App on IF61 • Create .zip file with your .exe and any dll files. • Create userapp.conf file • AUTOSTART=false • RUNAFTERINSTALL=false • CMDLINE=./ConsoleApplication2.exe • Add userapp.conf file to the .zip file • For Java you will need to add full path information
IF61: Network Configuration Menu • Select Common link
IF61: Network Configuration->Common • Add Syslog Destination (IP or localhost)
IF61: Network->Services • Make sure you have FTP server enabled
IF61: Edgeware Applications • Go to Edgeware Applications and select Application Control link
IF61: Edgeware Applications-> Application Control • Check the Redirect output from user applications to the system log box
IF61: Edgeware Applications -> Install User Application • Select .zip or .tar file to upload
IF61: Edgeware Applications -> Application Control • To run your application just click ACTION
IF61: Edgeware Applications -> Application Control • To update your application, click Uninstall and then install the new zip file
Run app on IF61 • Can monitor your application using an app such as KLog.exe or TcpipWin32.exe, both shareware, use at your own risk. • Make sure you kill your firewall. It may block this.