Class RFidHelper

java.lang.Object
com.opensourcewithslu.inputdevices.RFidHelper

public class RFidHelper extends Object
The RFIDHelper class is for interacting with an RFID scanner.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RFidHelper(com.pi4j.io.spi.SpiConfig config, int reset, com.pi4j.context.Context pi4jContext)
    The RFidHelper constructor WITH the reset pin as a parameter.
    RFidHelper(com.pi4j.io.spi.SpiConfig config, com.pi4j.context.Context pi4jContext)
    The RFidHelper constructor WITHOUT the reset pin as a parameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    When called, this method waits for any RFID card/fob to be scanned.
    void
    Resets the RFID scanner.
    void
    Writes data to an RFID fob.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RFidHelper

      public RFidHelper(com.pi4j.io.spi.SpiConfig config, int reset, com.pi4j.context.Context pi4jContext)
      The RFidHelper constructor WITH the reset pin as a parameter.
      Parameters:
      config - A Pi4J SPIConfig object which holds the SPI address and SPI Baud rate for RFID scanner.
      reset - Defines the reset pin for the RFID scanner.
      pi4jContext - The Pi4J context object.
    • RFidHelper

      public RFidHelper(com.pi4j.io.spi.SpiConfig config, com.pi4j.context.Context pi4jContext)
      The RFidHelper constructor WITHOUT the reset pin as a parameter.
      Parameters:
      config - A Pi4J SPIConfig object which holds the SPI address and SPI Baud rate for RFID scanner.
      pi4jContext - The Pi4J context object.
  • Method Details

    • writeToCard

      public void writeToCard(Object data)
      Writes data to an RFID fob. This is the data that is returned when the fob is scanned by the scanner.
      Parameters:
      data - Data to be written to an RFID fob. Typically, a string identifying the holder of the fob such as an identification number.
    • readFromCard

      public Object readFromCard()
      When called, this method waits for any RFID card/fob to be scanned. The data from the card is returned.
      Returns:
      The data read from the card/fob.
    • resetScanner

      public void resetScanner()
      Resets the RFID scanner.