frame
Class RFIDFrame

java.lang.Object
  extended by frame.RFIDFrame
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
RtoTFrame, TtoRFrame

public abstract class RFIDFrame
extends java.lang.Object
implements java.lang.Cloneable

Root class of all frame types.


Nested Class Summary
static class RFIDFrame.FrameType
          These definitions are used to support RFIDChannel's logging.
 
Field Summary
protected static int CRC_SIZE
           
protected  BitMemory data
          These are the bits of the frame.
protected  boolean hasCRC
           
protected  boolean isCorrupted
           
 
Constructor Summary
protected RFIDFrame(int bitsize, RFIDFrame.FrameType t)
          The constructor can be called only by a derived class - don't try to new one of these, new one of the subclasses.
 
Method Summary
 RFIDFrame clone()
          Overridden clone function, to create new data instance variable.
 RFIDFrame dup()
          Wrapper to clone frame, catching possible exceptions.
 void flipBit(int b)
          Fliips a single bit of the frame.
 int getSize()
          Returns the size of the frame, in bits (not including preamble).
 RFIDFrame.FrameType getType()
          This is an oracle method that reliably returns the type of a frame, even a corrupted one.
 boolean hasCRC()
          Returns true if the frame's class has been configured with a CRC field, false otherwise.
 boolean isCollision()
          Returns true if the frame represents a collision; false otherwise.
 boolean isCorrupted()
          Returns true only if (a) the frame's class has CRC enabled AND a bit error has occured in this frame, or (b) a collision has occurred.
 void markCorrupted()
          IF the frame's class carries a CRC, mark it as corrupted.
 java.lang.String toString(java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isCorrupted

protected boolean isCorrupted

hasCRC

protected boolean hasCRC

data

protected BitMemory data
These are the bits of the frame. Note that we don't store them all -- we keep neither the preamble nor the CRC (even if one is being used).


CRC_SIZE

protected static final int CRC_SIZE
See Also:
Constant Field Values
Constructor Detail

RFIDFrame

protected RFIDFrame(int bitsize,
                    RFIDFrame.FrameType t)
The constructor can be called only by a derived class - don't try to new one of these, new one of the subclasses.

Method Detail

getSize

public int getSize()
Returns the size of the frame, in bits (not including preamble). Size includes CRC, if the frame's class has been configured to carry one.


getType

public RFIDFrame.FrameType getType()
This is an oracle method that reliably returns the type of a frame, even a corrupted one. It s a utility to help the simulator with logging.

Your reader implementation cannot use this for making decisions. (You could potentially use it for debugging, but it isn't something an actual reader could do.)


isCollision

public boolean isCollision()
Returns true if the frame represents a collision; false otherwise. Works for both frames with and without CRCs.

It's okay to use this function in making decisions in you reader.


isCorrupted

public boolean isCorrupted()
Returns true only if (a) the frame's class has CRC enabled AND a bit error has occured in this frame, or (b) a collision has occurred.


markCorrupted

public void markCorrupted()
IF the frame's class carries a CRC, mark it as corrupted. Otherwise, do nothing.


flipBit

public void flipBit(int b)
Fliips a single bit of the frame. Bit flipping should be used only by frames without CRCs


hasCRC

public boolean hasCRC()
Returns true if the frame's class has been configured with a CRC field, false otherwise.


toString

public java.lang.String toString(java.lang.String prefix)

dup

public RFIDFrame dup()
Wrapper to clone frame, catching possible exceptions.


clone

public RFIDFrame clone()
                throws java.lang.CloneNotSupportedException
Overridden clone function, to create new data instance variable.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException