org.fosstrak.hal.util
Class RFIDTools

java.lang.Object
  extended by org.fosstrak.hal.util.RFIDTools
All Implemented Interfaces:
java.lang.Cloneable

public class RFIDTools
extends java.lang.Object
implements java.lang.Cloneable

This class is an abstraction for the RFID tags. A tag has a serial number and depending on the application data memory.

Copyright: Copyright (c) 2002

Version:
1.0
Author:
Matthias Lampe, lampe@acm.org, Harald Vogt, vogt@inf.ethz.ch, Philip Pfister, philip.pfister@hsr.ch, Stefan Kuenzle, stefan.kuenzle@hsr.ch

Field Summary
static int ISO_15693
          Tag-it HF-i or other ISO 15693 compliant transponders
static int SERIAL_NR_SIZE
          size of serial number
static int TAG_IT_HF
          Tag-it HF
 
Constructor Summary
RFIDTools(byte[] snr, int offset, int type, int dsfID)
          creates a RFIDTag with the gifen parameter
 
Method Summary
 java.lang.Object clone()
          clones the RFID tag.
 boolean equals(java.lang.Object tag)
          checks tags
static java.lang.String getChar(byte[] data)
           
static java.lang.String getData(byte[] data)
           
static java.lang.String getDataWithSpace(byte[] data)
           
static java.lang.String getDataWithSpaceLength(byte[] data, int l)
           
 java.lang.String getSerial()
          gets the serial number of the tag as a String in hex format.
static java.lang.String getSerialFromByteArray(byte[] snr, int offset)
           
 java.lang.String getSerialWithSpace()
          gets the serial number of the tag as a String where each byte is in hex format and separated by a space.
 byte[] getSNR()
          gets the serial number
 int hashCode()
          gets the hash code of the serial number
 boolean hasSNR(byte[] data)
          checks the serial number
 boolean hasSNR(byte[] data, int offset, int length)
          checks the serial number
static java.lang.String hexByte(int b)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SERIAL_NR_SIZE

public static final int SERIAL_NR_SIZE
size of serial number

See Also:
Constant Field Values

TAG_IT_HF

public static final int TAG_IT_HF
Tag-it HF

See Also:
Constant Field Values

ISO_15693

public static final int ISO_15693
Tag-it HF-i or other ISO 15693 compliant transponders

See Also:
Constant Field Values
Constructor Detail

RFIDTools

public RFIDTools(byte[] snr,
                 int offset,
                 int type,
                 int dsfID)
creates a RFIDTag with the gifen parameter

Parameters:
snr - serial number of the transponder
offset - offset of the serial number
type - transponder type
dsfID - data storage family identifier
Method Detail

hexByte

public static java.lang.String hexByte(int b)

getData

public static java.lang.String getData(byte[] data)

getDataWithSpace

public static java.lang.String getDataWithSpace(byte[] data)

getDataWithSpaceLength

public static java.lang.String getDataWithSpaceLength(byte[] data,
                                                      int l)

getChar

public static java.lang.String getChar(byte[] data)

getSerialFromByteArray

public static java.lang.String getSerialFromByteArray(byte[] snr,
                                                      int offset)

getSNR

public byte[] getSNR()
gets the serial number

Returns:
the serial number of the tag as a array of byte.

getSerialWithSpace

public java.lang.String getSerialWithSpace()
gets the serial number of the tag as a String where each byte is in hex format and separated by a space.

Returns:
the serial number of the tag as a String.

getSerial

public java.lang.String getSerial()
gets the serial number of the tag as a String in hex format.

Returns:
the serial number of the tag as a String.

hasSNR

public boolean hasSNR(byte[] data)
checks the serial number

Parameters:
data - to compared serial number
Returns:
if boath serial numbers are equal TRUE else FALSE

hasSNR

public boolean hasSNR(byte[] data,
                      int offset,
                      int length)
checks the serial number

Parameters:
data - to compared serial number
offset - start position
length - lebgth of serial number
Returns:
if boath serial numbers are equal TRUE else FALSE

clone

public java.lang.Object clone()
clones the RFID tag.

Overrides:
clone in class java.lang.Object
Returns:
the deep copy of the RFID tag.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String

equals

public boolean equals(java.lang.Object tag)
checks tags

Overrides:
equals in class java.lang.Object
Parameters:
tag - tag to compare
Returns:
if boath serial numbers are equal TRUE else FALSE

hashCode

public int hashCode()
gets the hash code of the serial number

Overrides:
hashCode in class java.lang.Object
Returns:
hash code


Copyright © 2008. All Rights Reserved.