Class RFIDPacket

java.lang.Object
  extended by RFIDPacket

public class RFIDPacket
extends java.lang.Object

Stores all information contained in RFID reader packets. Provides methods to manipulate data and format properly for other objects.


Field Summary
private  int checkSumLsb
          LRC - A cumulative Exclusive OR(XOR) operation on all the bytes.
private  int checkSumMsb
          Ones complement of checkSumLSB.
private  int command
          Specifies action to be taken by the reader Length of 1 Byte.
private  int commandFlag
          Specifies action to be taken by the reader Length of 1 Byte.
private  int[] data
          Contains the command data.
private  int length
          Describes length of the packet.
 
Constructor Summary
RFIDPacket(int[] dataBuffer)
          Creates a new RFIDPacket Object
RFIDPacket(int cmdFlag, int cmd)
          Creates a new RFIDPacket Object
 
Method Summary
private  void calcCheckSum()
          Calculates and sets the block character check (BCC) checksum.
private  byte encodeUnsigned(int num)
          Encodes the given integer into an equivilant unsigned byte represented in two's complement form.
 int getTagID()
          Returns the tag identification number from the packet.
 void printOut()
          Prints out packet information.
private  void setLength()
          Calculates and sets the packet length.
 byte[] toArray()
          Converts the packet information to a sendable array of bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

private int length
Describes length of the packet. Length of number is 2 Bytes, LSB first MSB second


commandFlag

private int commandFlag
Specifies action to be taken by the reader Length of 1 Byte.


command

private int command
Specifies action to be taken by the reader Length of 1 Byte.


data

private int[] data
Contains the command data. Variable in length from 0 to XX Bytes.


checkSumLsb

private int checkSumLsb
LRC - A cumulative Exclusive OR(XOR) operation on all the bytes.


checkSumMsb

private int checkSumMsb
Ones complement of checkSumLSB.

Constructor Detail

RFIDPacket

public RFIDPacket(int cmdFlag,
                  int cmd)
Creates a new RFIDPacket Object

Parameters:
cmdFlag - Specifies action to be taken by the reader or the action that was recently performed by the reader.
cmd - Specifies action to be taken by the reader or the action that was recently performed by the reader.

RFIDPacket

public RFIDPacket(int[] dataBuffer)
Creates a new RFIDPacket Object

Parameters:
array - dataBuffer to manipulate
Method Detail

printOut

public void printOut()
Prints out packet information.


calcCheckSum

private void calcCheckSum()
Calculates and sets the block character check (BCC) checksum.


setLength

private void setLength()
Calculates and sets the packet length.


toArray

public byte[] toArray()
Converts the packet information to a sendable array of bytes.

Returns:
The byte array to be sent to the reader.

encodeUnsigned

private byte encodeUnsigned(int num)
Encodes the given integer into an equivilant unsigned byte represented in two's complement form.

Parameters:
num - The integer to be encoded
Returns:
The encoded byte.

getTagID

public int getTagID()
Returns the tag identification number from the packet.

Returns:
The tag ID number or -1 if no tag ID exists.