public class YRfidReader extends YFunction
| Modifier and Type | Class and Description |
|---|---|
static interface |
YRfidReader.TimedReportCallback
TimedReportCallback for RfidReader
|
static interface |
YRfidReader.UpdateCallback
Deprecated UpdateCallback for RfidReader
|
static interface |
YRfidReader.YEventCallback
Specialized event Callback for RfidReader
|
| Modifier and Type | Field and Description |
|---|---|
protected YRfidReader.YEventCallback |
_eventCallback |
protected int |
_eventPos |
protected int |
_eventStamp |
protected boolean |
_isFirstCb |
protected int |
_nTags |
protected int |
_prevCbPos |
protected int |
_refreshRate |
protected YRfidReader.UpdateCallback |
_valueCallbackRfidReader |
static int |
NTAGS_INVALID
invalid nTags value
|
static int |
REFRESHRATE_INVALID
invalid refreshRate value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID| Modifier | Constructor and Description |
|---|---|
protected |
YRfidReader(String func) |
protected |
YRfidReader(YAPIContext ctx,
String func) |
| Modifier and Type | Method and Description |
|---|---|
int |
_chkerror(String tagId,
byte[] json,
YRfidStatus status) |
int |
_internalEventHandler(String cbVal) |
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
static YRfidReader |
FindRfidReader(String func)
Retrieves a RFID reader for a given identifier.
|
static YRfidReader |
FindRfidReaderInContext(YAPIContext yctx,
String func)
Retrieves a RFID reader for a given identifier in a YAPI context.
|
static YRfidReader |
FirstRfidReader()
Starts the enumeration of RFID readers currently accessible.
|
static YRfidReader |
FirstRfidReaderInContext(YAPIContext yctx)
Starts the enumeration of RFID readers currently accessible.
|
String |
get_lastEvents()
Returns a string with last tag arrival/removal events observed.
|
int |
get_nTags()
Returns the number of RFID tags currently detected.
|
int |
get_refreshRate()
Returns the tag list refresh rate, measured in Hz.
|
ArrayList<String> |
get_tagIdList()
Returns the list of RFID tags currently detected by the reader.
|
YRfidTagInfo |
get_tagInfo(String tagId,
YRfidStatus status)
Returns a description of the properties of an existing RFID tag.
|
ArrayList<Boolean> |
get_tagLockState(String tagId,
int firstBlock,
int nBlocks,
YRfidOptions options,
YRfidStatus status)
Reads the locked state for RFID tag memory data blocks.
|
ArrayList<Boolean> |
get_tagSpecialBlocks(String tagId,
int firstBlock,
int nBlocks,
YRfidOptions options,
YRfidStatus status)
Tells which block of a RFID tag memory are special and cannot be used
to store user data.
|
int |
getNTags()
Returns the number of RFID tags currently detected.
|
int |
getRefreshRate()
Returns the tag list refresh rate, measured in Hz.
|
YRfidReader |
nextRfidReader()
Continues the enumeration of RFID readers started using yFirstRfidReader().
|
int |
registerEventCallback(YRfidReader.YEventCallback callback)
Registers a callback function to be called each time that an RFID tag appears or
disappears.
|
int |
registerValueCallback(YRfidReader.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
reset() |
int |
set_refreshRate(int newval)
Changes the present tag list refresh rate, measured in Hz.
|
int |
setRefreshRate(int newval)
Changes the present tag list refresh rate, measured in Hz.
|
int |
tagGetAFI(String tagId,
YRfidOptions options,
YRfidStatus status)
Reads an RFID tag AFI byte (ISO 15693 only).
|
int |
tagGetDSFID(String tagId,
YRfidOptions options,
YRfidStatus status)
Reads an RFID tag DSFID byte (ISO 15693 only).
|
int |
tagLockAFI(String tagId,
YRfidOptions options,
YRfidStatus status)
Locks the RFID tag AFI byte (ISO 15693 only).
|
int |
tagLockBlocks(String tagId,
int firstBlock,
int nBlocks,
YRfidOptions options,
YRfidStatus status)
Changes an RFID tag configuration to prevents any further write to
the selected blocks.
|
int |
tagLockDSFID(String tagId,
YRfidOptions options,
YRfidStatus status)
Locks the RFID tag DSFID byte (ISO 15693 only).
|
ArrayList<Integer> |
tagReadArray(String tagId,
int firstBlock,
int nBytes,
YRfidOptions options,
YRfidStatus status)
Reads data from an RFID tag memory, as a byte list.
|
byte[] |
tagReadBin(String tagId,
int firstBlock,
int nBytes,
YRfidOptions options,
YRfidStatus status)
Reads data from an RFID tag memory, as a binary buffer.
|
String |
tagReadHex(String tagId,
int firstBlock,
int nBytes,
YRfidOptions options,
YRfidStatus status)
Reads data from an RFID tag memory, as an hexadecimal string.
|
String |
tagReadStr(String tagId,
int firstBlock,
int nChars,
YRfidOptions options,
YRfidStatus status)
Reads data from an RFID tag memory, as a text string.
|
int |
tagSetAFI(String tagId,
int afi,
YRfidOptions options,
YRfidStatus status)
Changes an RFID tag AFI byte (ISO 15693 only).
|
int |
tagSetDSFID(String tagId,
int dsfid,
YRfidOptions options,
YRfidStatus status)
Changes an RFID tag DSFID byte (ISO 15693 only).
|
int |
tagWriteArray(String tagId,
int firstBlock,
ArrayList<Integer> byteList,
YRfidOptions options,
YRfidStatus status)
Writes data provided as a list of bytes to an RFID tag memory.
|
int |
tagWriteBin(String tagId,
int firstBlock,
byte[] buff,
YRfidOptions options,
YRfidStatus status)
Writes data provided as a binary buffer to an RFID tag memory.
|
int |
tagWriteHex(String tagId,
int firstBlock,
String hexString,
YRfidOptions options,
YRfidStatus status)
Writes data provided as an hexadecimal string to an RFID tag memory.
|
int |
tagWriteStr(String tagId,
int firstBlock,
String text,
YRfidOptions options,
YRfidStatus status)
Writes data provided as an ASCII string to an RFID tag memory.
|
_AddToCache, _clearDataStreamCache, _decode_json_int, _decode_json_string, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _is_valid_pass, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, _uploadEx, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_serialNumber, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, isReadOnly, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setLogicalName, setUserData, toString, unmuteValueCallbacks, userDatapublic static final int NTAGS_INVALID
public static final int REFRESHRATE_INVALID
protected int _nTags
protected int _refreshRate
protected YRfidReader.UpdateCallback _valueCallbackRfidReader
protected YRfidReader.YEventCallback _eventCallback
protected boolean _isFirstCb
protected int _prevCbPos
protected int _eventPos
protected int _eventStamp
protected YRfidReader(YAPIContext ctx, String func)
func - : functionidprotected YRfidReader(String func)
func - : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val)
throws Exception
_parseAttr in class YFunctionExceptionpublic int get_nTags()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getNTags()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_refreshRate()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getRefreshRate()
throws YAPI_Exception
YAPI_Exception - on errorpublic int set_refreshRate(int newval)
throws YAPI_Exception
newval - : an integer corresponding to the present tag list refresh rate, measured in HzYAPI_Exception - on errorpublic int setRefreshRate(int newval)
throws YAPI_Exception
newval - : an integer corresponding to the present tag list refresh rate, measured in HzYAPI_Exception - on errorpublic static YRfidReader FindRfidReader(String func)
func - : a string that uniquely characterizes the RFID reader, for instance
MyDevice.rfidReader.public static YRfidReader FindRfidReaderInContext(YAPIContext yctx, String func)
yctx - : a YAPI contextfunc - : a string that uniquely characterizes the RFID reader, for instance
MyDevice.rfidReader.public int registerValueCallback(YRfidReader.UpdateCallback callback)
callback - : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback in class YFunctionpublic int _chkerror(String tagId, byte[] json, YRfidStatus status) throws YAPI_Exception
YAPI_Exceptionpublic int reset()
throws YAPI_Exception
YAPI_Exceptionpublic ArrayList<String> get_tagIdList() throws YAPI_Exception
YAPI_Exception - on errorpublic YRfidTagInfo get_tagInfo(String tagId, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to checkstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
When it happens, you can get more information from the status object.public int tagLockBlocks(String tagId, int firstBlock, int nBlocks, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : first block to locknBlocks - : number of blocks to lockoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public ArrayList<Boolean> get_tagLockState(String tagId, int firstBlock, int nBlocks, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : number of the first block to checknBlocks - : number of blocks to checkoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public ArrayList<Boolean> get_tagSpecialBlocks(String tagId, int firstBlock, int nBlocks, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : number of the first block to checknBlocks - : number of blocks to checkoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public String tagReadHex(String tagId, int firstBlock, int nBytes, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where read should startnBytes - : total number of bytes to readoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public byte[] tagReadBin(String tagId, int firstBlock, int nBytes, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where read should startnBytes - : total number of bytes to readoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public ArrayList<Integer> tagReadArray(String tagId, int firstBlock, int nBytes, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where read should startnBytes - : total number of bytes to readoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public String tagReadStr(String tagId, int firstBlock, int nChars, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where read should startnChars - : total number of characters to readoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagWriteBin(String tagId, int firstBlock, byte[] buff, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where write should startbuff - : the binary buffer to writeoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagWriteArray(String tagId, int firstBlock, ArrayList<Integer> byteList, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where write should startbyteList - : a list of byte to writeoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagWriteHex(String tagId, int firstBlock, String hexString, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where write should starthexString - : a string of hexadecimal byte codes to writeoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagWriteStr(String tagId, int firstBlock, String text, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usefirstBlock - : block number where write should starttext - : the text string to writeoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagGetAFI(String tagId, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to useoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagSetAFI(String tagId, int afi, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to useafi - : the AFI value to write (0...255)options - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagLockAFI(String tagId, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to useoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagGetDSFID(String tagId, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to useoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagSetDSFID(String tagId, int dsfid, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to usedsfid - : the DSFID value to write (0...255)options - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public int tagLockDSFID(String tagId, YRfidOptions options, YRfidStatus status) throws YAPI_Exception
tagId - : identifier of the tag to useoptions - : an YRfidOptions object with the optional
command execution parameters, such as security key
if requiredstatus - : an RfidStatus object that will contain
the detailled status of the operationYAPI_Exception - on error
happens, you can get more information from the status object.public String get_lastEvents() throws YAPI_Exception
YAPI_Exception - on errorpublic int registerEventCallback(YRfidReader.YEventCallback callback) throws YAPI_Exception
callback - : the callback function to call, or a null pointer.
The callback function should take four arguments:
the YRfidReader object that emitted the event, the
UTC timestamp of the event, a character string describing
the type of event ("+" or "-") and a character string with the
RFID tag identifier.YAPI_Exception - on errorpublic int _internalEventHandler(String cbVal) throws YAPI_Exception
YAPI_Exceptionpublic YRfidReader nextRfidReader()
public static YRfidReader FirstRfidReader()
public static YRfidReader FirstRfidReaderInContext(YAPIContext yctx)
yctx - : a YAPI context.Copyright © 2026. All rights reserved.