Class RfidScanner<T extends RfidTag>
java.lang.Object
com.tccc.kos.ext.freestyle.service.rfid.RfidScanner<T>
- Direct Known Subclasses:
FreestyleCartridgeScanner
Identifies the positions on an antenna that should be scanned
to generate add/remove events. This scanner tracks the tag
read from pass to pass and if a tag appears, an add event will
be generated. If a tag is no longer visible, a remove event
will be generated. This effectively converts tag scanning into
an event stream based on tag visibility.
An antenna may be used in multiple scanners, including using the same positions. This will cause the position to be read multiple times, once per scanner.
- Version:
- 2023-10-13
-
Constructor Summary
ConstructorsConstructorDescriptionRfidScanner
(RfidAntenna antenna, RfidTagFactory<T> factory) Create a scanner for the specified positions on the specified antenna. -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(RfidTagListener<T> listener) Add a tag listener to the scanner.addPosition
(int pos, Object userData) Add a position to the scanner.void
enablePosition
(int pos, boolean enabled) Enable/disable an rfid position.int
Return the number of times the scanner has been run.int
Return the number of reads performed when verifying a missing tag.void
removeListener
(RfidTagListener<T> listener) Remove a tag listener from the scanner.removePosition
(int pos) Remove a position from the scanner.boolean
scanPosition
(RfidPositionInfo<?> posInfo) Called for each position just before scanning it.void
setScanCount
(int scanCount) void
setVerifyReadCount
(int verifyReadCount) Set the number of reads to perform to verify a tag is missing.
-
Constructor Details
-
RfidScanner
Create a scanner for the specified positions on the specified antenna. TheRfidTagFactory
is used to convert RFID data from the physical tag to a logicalRfidTag
object. The factory can implement multipleRfidReadDescriptor
which will all be evaluated per tag read (typically resulting in multiple physical reads per position). This allows a high degree of control over what tags are ultimately accepted and generated by this scanner.- Parameters:
antenna
- the antenna to scanfactory
- the factory for generating tags
-
-
Method Details
-
addPosition
Add a position to the scanner.- Parameters:
pos
- the position on the antennauserData
- user data for the position- Returns:
- the newly created
RfidScannerPosition
object
-
removePosition
Remove a position from the scanner.- Parameters:
pos
- the position on the antenna- Returns:
- the
RfidScannerPosition
that was removed
-
enablePosition
public void enablePosition(int pos, boolean enabled) Enable/disable an rfid position. When disabled, the position will behave as if there are no tags available on subsequent reads, resulting in a remove tag event.- Parameters:
pos
- the position on the antennaenabled
- if true, enable the position, otherwise disable it
-
addListener
Add a tag listener to the scanner.- Parameters:
listener
- the listener to add
-
removeListener
Remove a tag listener from the scanner.- Parameters:
listener
- the listener to remove
-
getVerifyReadCount
public int getVerifyReadCount()Return the number of reads performed when verifying a missing tag. -
setVerifyReadCount
public void setVerifyReadCount(int verifyReadCount) Set the number of reads to perform to verify a tag is missing. This mitigates issues with spurious read failures during normal scanning as it ensures the tag is really gone before generating a remove event. -
getScanCount
public int getScanCount()Return the number of times the scanner has been run. -
scanPosition
Called for each position just before scanning it. Returning true will cause the scan to be performed normally. Returning false will cause the position to be skipped. This is equivalent to scanning the position and finding no tags in that it will generate remove events if a tag was previously scanned. Override as needed to implement scan policy.- Parameters:
posInfo
- information associated with the position to be scanned
-
getAntenna
-
setScanCount
public void setScanCount(int scanCount)
-