Class RFidHelper
java.lang.Object
com.opensourcewithslu.inputdevices.RFidHelper
The RFIDHelper class is for interacting with an RFID scanner.
-
Constructor Summary
ConstructorDescriptionRFidHelper
(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 TypeMethodDescriptionWhen called, this method waits for any RFID card/fob to be scanned.void
Resets the RFID scanner.void
writeToCard
(Object data) Writes data to an RFID fob.
-
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
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
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.
-