Click here to Skip to main content
6,629,885 members and growing! (22,770 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » Howto     Intermediate License: The Code Project Open License (CPOL)

Use Psion Teklogix 753x SDKs to Read/Write RFID Tags

By Babak Ansari

Work with the PtxRfidNet.dll SDKs to read/write RFID tags and Farsi language in hand-helds.
C# (C# 1.0, C# 2.0, C# 3.0), Win Mobile (PocketPC 2002, WinMobile2003), .NET CF, Dev
Version:11 (See All)
Posted:2 Feb 2009
Views:5,609
Bookmarked:9 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
4 votes for this article.
Popularity: 2.74 Rating: 4.56 out of 5

1

2
1 vote, 25.0%
3
1 vote, 25.0%
4
2 votes, 50.0%
5

Introduction

The goal of this article is to illustrate the use of Psion Teklogix provided libraries to read/write RFID Tags using 753x hand-held devices. The provided sample is intended to be easy to use, and hopefully a proper kick-start to use the device. It also includes a library (PDAFarsiLib) to make Farsi (Persian) language texts appear properly on the device. You can find more information about the language library from Mohamed Abdel-Monem's article. You can also find a very comprehensive support from the manufacturer company as you will.

Prerequisites

In order to use the Psion Tecklogix provided SDKs to work with the device, you should have at least the following prerequisites in place:

ActiveSync must be installed

Connect the device to the PC while installing the ActiveSync setup.

Setup the PsionTeklogixCE420\RfidDeviceManager CAB file on the device

Installing RfidDeviceManager.cab would place the required libraries on the device to let your .NET application use the provided SDKs.

Using the Code

Use the .NET PtxRfidNet.dll SDK library to program the device. (Note: As stated in the Prerequisites step above, RfidDeviceManager.cab should be installed on the device and the PtxRfid.dll library should exist on the device.) To read or write Tags using the Psion Teklogix 753x device, an instance of DeviceInterface must be constructed and the proper readers selected.

On the Smart Device project, create an instance of the DeviceInterface class and use it to find the readers on the device:

DeviceInterface DevInt = new DeviceInterface();

Find the proper reader (or all the readers) in the list:

ReaderId[] _readers = DevInt.CreateReader(readerId);

Used the above readers (_readers) to read/write and work with the device.

Write the RFID Tag

Tag IDs are in Hex format, and they should be 24 characters in length. In order to write a hex number like “absdefg0123456789”, it should be written to an array of 12 bytes length and each byte holding a four bits hex number. So, byte[0] holds “ab” which is 171. To construct the proper byte array from the UID string:

byte[] bUID = new byte[12];
for (int i = 0, j = 0; i < UID.Length; i = i + 2, j++)
{
    bUID[j] = byte.Parse(UID.Substring(i, 2), 
                   System.Globalization.NumberStyles.HexNumber);
}

Construct an EpcClass1Gen2 Tag and set its UID to the byte array constructed above:

Tag rfidTag = new Tag(TagType.EpcClass1Gen2);
rfidTag.Uid = new TagUid(bUID, 96);

Use the WriteUid API from the selected reader to write the UID on the Tag:

WriteTagUidParams param = new WriteTagUidParams();
_reader.WriteUid(param, rfidTag);

Asynchronous RFID Tag Read

Handle the AsynchronousDataDelegate event to read the RFID tags placed in front of the device.

ReadTagParams t = new ReadTagParams(ReadModes.Triggered, 2000);
_reader.StartAsynchronousRead(t);
_reader.AsynchronousDataEvent += 
   new AsynchronousDataDelegate(reader_AsynchronousDataEvent);

When the RFID read triggers on the device, the following event would raise, and you can add the read UIDs to a ListBox as follows:

void reader_AsynchronousDataEvent(object source, AsynchronousDataEventArgs e)
{
    if (e.tagData.Format == TagDataFormats.UnparsedRaw)
    {
        foreach (Tag id in e.tagData.TagList)
        {
            string tagUidStr = "";
            foreach (byte tagUid in id.Uid.Data)
            {
                tagUidStr += string.Format("{0:x2}", tagUid);
            }
            if (getListBoxItem(lstFoundTags, tagUidStr) < 0)
            {
                setListBoxItem(lstFoundTags, tagUidStr);
                _readCount++;
            }
        }
    }
}

Points of Interest

Hopefully, it wasn't too painful to read, and can be useful for someone. I found a very welcoming support from the company as well. Thanks to the Psion Teklogix support team.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Babak Ansari


Member
Software development experience since 1993

Skills
- Programming Languages: C# .NET, Delphi, C++, Java and VB
- Development Methodologies (SDLC): RUP, Scrum and XP
- Database: SQL server, Oracle, Apollo database and MS Access.

Educations & Certificates
- Microsoft® Certified Professional (MCP)
- Sun® Certified Java2 Programmer
- B.S. in computer science
Occupation: Software Developer (Senior)
Location: Canada Canada

Other popular Mobile Development articles:

  • Writing Your Own GPS Applications: Part 2
    In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
  • Writing Your Own GPS Applications: Part I
    What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
  • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
    A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
  • iPhone UI in Windows Mobile
    It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
  • Pocket 1945 - A C# .NET CF Shooter
    An article on Pocket PC game development
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
  (Refresh) 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 2 Feb 2009
Editor: Smitha Vijayan
Copyright 2009 by Babak Ansari
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project