Overview
The RFID Module provides access to functionality of the device's RFID reader, if so equipped.
Supported with the following readers and Android versions:
See "Version Compatibility" for the full list of supported Zebra peripherals.
The RFID module is not included with the standard EB installation, and might require a separate download and installation. See Remarks section for more information.
Syntax
rfid (Module) <META> Syntax |
---|
<META HTTP-Equiv="rfid" content="[parameter / method]"> |
<META HTTP-Equiv="rfid" content="tagEvent:url('[jsFunction | url]')"> |
Rfid JavaScript Object Syntax: |
---|
By default the JavaScript object 'rfid' will exist on the current page and can be used to interact directly with the RFID. |
To invoke RFID methods via JavaScript use the following syntax: rfid.method(); e.g. rfid.enumerate(); |
To Set RFID parameters via JavaScript use the following syntax: rfid.parameter = 'value'; remembering to enclose your value in quotes where appropriate. e.g. rfid.antennaSelected = 'value'; |
To set RFID return events via JavaScript, use the following syntax: rfid.event = JavaScript Function; e.g. rfid.enumRFIDEvent = 'doFunction(%json)';
|
To set multiple EMML parameters / events on a single line use the following syntax: rfid.setEMML("[Your EMML Tags]"); e.g. rfid.setEMML("antennaSelected:value;enumRFIDEvent:url('JavaScript:doFunction(%json)');enumerate"); |
Methods
Items listed in the table below indicate methods or parameters with values available for retrieval.
Platform Key: -Android -Windows Mobile/CE
Name/Platform(s) | Description |
---|---|
enumerate | Returns the number of RFID readers present on the device. Always is '1' for serial devices; could be greater for Bluetooth depending on the number of paired devices. |
connect | Creates a connection to the default RFID reader; attempts to connect whenever the plug-in is loaded. On Android, works only after using the enumerate callback(). |
disconnect | Disconnects the current RFID connection and flushes all properties of the "RFID" module except events. |
stop | Stops a softTrigger from running inventory or locateTag operation; all pending tag reports are discarded. |
performInventory | Performs an inventory operation on the RFID reader, which is started and stopped according to the trigger settings implemented by the app. By default, starts an inventory operation immediately. There is no default stop trigger; an explicit "stop" call must be made. Tags are reported as part of the TagData Array in the tagEvent's JSON object. When the property "invMemBank" is set (to either Reserved, EPC, TID or User) prior to calling performInventory, the corresponding memory-bank's data also is read for the tags being inventoried. For inventoried tags, additional fields can be reported as part of tagEvent JSON by setting to true properties such as enableTagCRC, enableTagPC, enableTagSeenCount, enableTagRSSI, enableTagAntennaID, etc. As long as inventory operation is running, the plug-in cannot process those meta tags that could initiate an RFID operation such as performInventory, locateTag, readTag and other Access operations. The plug-in returns an error string indicating that it is busy and can perform other RFID operations only when the inventory is stopped. If inventory is running, the device user must stop the inventory operation before quitting the EB app. |
locateTag | Configures the locateTag operation, which looks for a specific Tag ID on a specific antennaID and keeps reporting tagEvents if the tag is found along with relative distance (on a scale of 0&nsash;100, 100 being the closest) to help locate the requested tag. If beepOnRead is enabled (default), the beep frequency varies in proportion to the relative distance (Geiger counter). The tagLocationing algorithms can use only one antenna to locate a tagID. Thus, antennaSelected cannot take the default value '0' but takes one of the antenna IDs supported by the device. As with performInventory, the start and stop trigger settings can autonomously invoke and stop the locateTag operation. Please note that while the properties reportUniqueTags and reportTrigger are not relevant here, the tag field settings enableTagAntennaID, enableTagRssi, etc. are applicable. |
killTag | Kills the currently selected tag referenced by tagID, or kills tags that match the filter criteria. Requires tagKillPassword. tagID property is ignored if useAccessFilter property is set to true. If useAccessFilter is set to true, then tagPatternA, tagPatternB and matchPattern is used to filter out tags to perform the operation. If tagID is empty and useAccessFilter is false (default value), the kill operation is attempted on all tags in the field of view. |
getRadioPowerState | Returns a boolean value (1 or 0) representing the radio power state via radioPowerStateEvent. |
addPreFilter | Adds a pre-configured filter to the currently selected antenna. Used to sort out the subset of tags to participate in the next RFID operations. Multiple preFilters can be added, limited by the RFID reader. Each should be referenced by a unique value (which should be assigned to preFilterID property) before calling addPreFilter method. |
deletePreFilter | Deletes a pre-filter of the index set by preFilterID property. |
clearPreFilters | Deletes ALL preFilters |
radioPowerStateOn | Sets the radio power of the RFID module on |
radioPowerStateOff | Sets the radio power of the RFID module off |
tagRead | Reads from a tag or a set of tags (defined by Access filter) using the pre-configured read Parameters. The tag data is returned via a tagEvent. The read data is available in tagData.memoryBankData field of the JSON object passed to tagEvent handler. The tagID property is ignored if useAccessFilter property is set to true. If useAccessFilter is set to true, tagPatternA, tagPatternB and matchPattern are used to filter out tags to perform the operation. If the tagID is empty and useAccessFilter is false, the read operation is performed on all tags in field of view. The useAccessFilter property is not supported on Android. |
tagWrite | Writes data to a tag or a set of tags (defined by Access filter) using the pre-configured Write parameters. The tagID property is ignored if useAccessFilter property is set to true, and tagPatternA, tagPatternB and matchPattern are used to filter out tags to perform the operation. If the tagID is empty and useAccessFilter is false, the write operation is attempted on all the tags in field of view. The useAccessFilter property is not supported on Android. |
setTagID | Writes a pre-configured new tag ID to the currently selected tag. |
setTagAccessPassword | Writes a pre-configured new tag access password to the currently selected tag. |
setTagKillPassword | Writes a pre-configured new kill password to the currently selected tag. |
setSingulation | Sets the pre-configured singulation parameters on all the antenna(e). Before calling this method, either Session or TagPopulation parameters must be properly set. When state-aware singulation is desired, performStateAwareSingulation is to be set to true and the configured values for SL flag and Inventory state are matched during singulation of tags. |
getSingulation | Requests the current singulation parameters (session and tag population) for the antenna(e). The result is returned in a singulationEvent. All antennae share the same singulation settings. |
getRFParams | Gets the current RF Mode and Transmit Power parameters for the currently selected antenna. Result is returned in rfParamsEvent. Property antennaSelected cannot take default value (0) because RF parameters are returned only for one antennaID. Android returns only the Transmit Power parameter. |
tagLock | Locks a tag (or tags) according to the lockPrivilege and lockField, requires tagPassword. The tagID property is ignored if useAccessFilter property is set to true. If useAccessFilter is set to true, then tagPatternA, tagPatternB and matchPattern will be used to filter out tags to perform the operation. If the tagID is empty and useAccessFilter is false, the lock operation will be attempted on all the tags in field of view. |
getRFModeInfo | Gets the RF mode information for the given RFMode index. The result is returned in a rfModeInfoEvent. |
setRFParams | Sets the RF mode and / or transmit power of a selected antenna. Android sets only the Transmit Power parameter. |
getLastAccessResult | gets the result of the last access operation in the lastAccessResultEvent. The result consists of numbers of tags on which the last access operation succeeded and failed. Note that this method can give valid results only after a operationCompleteEvent is received indicating that the last operation has ended. |
Parameters
Items in this section indicate parameters or attributes that can be configured.
Platform Key: -Android -Windows Mobile/CE
Events
Values are returned to the caller in RhoElements via Events. Most modules contain events and those returned from this module are given below along with the event parameters. Events can cause a navigation to a new URL or a JavaScript function on the page to be invoked. Each event will in most cases have a number of parameters associated with it which will either be strings or JavaScript arrays. Event parameters can be accessed either directly or via JSON objects.
enumRFIDEvent
Enumerates the RFID readers present on the device (normally limited to one) along with their respective capabilities. On Android devices, return values are labeled "ID, Name and Address." Android returns only ReaderID, ReaderName and ReaderAddress properties.
ID | Name | Description ("Address" on Android) |
---|---|---|
1 | numberOfDevices | returns total number of device enumerated (always 1) |
2 | readerID | ID assigned to reader |
3 | firmwareVersion | Firmware version of the reader |
4 | modelName | Model FX, MC |
5 | numberOfAntennas | Antennas supported/connected by/to reader |
6 | numberOfPreFilters | Total number of pre-filters available |
7 | countryCode | region configured |
8 | communicationStandard | country/region frequency band standards |
9 | transmitPowerMin | Minimum transmit power supported by reader 500dbm |
10 | transmitPowerMax | Maximum transmit power supported by reader 3000dbm |
11 | transmitPowerStep | Transmit power can be set in multiple of value - step |
12 | numberOfRFModes | Number of supported RFModes |
13 | stateAwareSingulationSupported | Indicates whether Inventory State Aware Singulation is supported by the Reader. |
rfParamsEvent
Returns RF Parameter values Transmit Power and RF Mode of a selected antenna. Android returns only the Transmit Power property.
ID | Name | Description |
---|---|---|
1 | transmitPower | radiated power in db |
2 | RFMode | RF Mode Table Index |
rfModeInfoEvent
Returns the RF Characteristics for a particular RF Mode. This parameter is NOT supported on Android.
ID | Name | Description |
---|---|---|
1 | modeIdentifier | Refer to EPC-Global's definition |
2 | divideRatio | Refer to EPC-Global's definition |
3 | bdrValue | Refer to EPC-Global's definition |
4 | modulation | Refer to EPC-Global's definition |
5 | forwardLinkModulationType | Refer to EPC-Global's definition |
6 | pieValue | Refer to EPC-Global's definition |
7 | minTariValue | Refer to EPC-Global's definition |
8 | maxTariValue | Refer to EPC-Global's definition |
9 | stepTariValue | Refer to EPC-Global's definition |
10 | spectralMaskIndicator | Refer to EPC-Global's definition |
11 | epcHAGTCConformance | Refer to EPC-Global's definition |
tagEvent
Returns received RFID tag data from N tags, where N = reportTrigger. Typically methods like performInventory, tagLocate, readTag/writeTag/lockTag/killTag (performed on one or more tags) generate tagEvents with necessary data.
ID | Name | Description |
---|---|---|
1 | TagData (tagID, PC, tagSeenCount, memoryBankData, XPC, CRC, antennaID, RSSI, accessStatus, relativeDistance, firstSeenTimeStamp) | Tag data array with various parameter of read tag TagData[1..N]. |
radioPowerStateEvent
Returns 1 if the radio is ON and 0 if the radio is off. This parameter is NOT supported on Android.
ID | Name | Description |
---|---|---|
1 | powerState | Radio is on/off |
statusEvent
Returns any error conditions where required
ID | Name | Description |
---|---|---|
1 | method | Name of method from which error was generated. |
2 | errorCode | Standard RFID API error code or plug-in specific error code. Plug-in error code description: 2000 - One of the relevant parameters is invalid or missing 2001 - Plug-in Busy 2002 - Failed to create a plug-in thread 2003 - Plug-in cannot process properties or methods unless connected 2004 - InvalidUsageException (Android only) 2005 - OperationFailureException (Android only) 1000 - Any status event (i.e.) handheld trigger event, reader disconnection event, etc.) (Android only) |
3 | vendorMessage | Additional Error Info if any |
singulationEvent
Returns singulation values. This parameter is NOT supported on Android.
ID | Name | Description |
---|---|---|
1 | singulationSession | Indicates the session in which the antenna singulates. |
2 | singulationTagPopulation | Indicates the tag-population that the reader considers is in an antenna's field of view. |
3 | performStateAwareSingulation | Indicates whether the antennas perform stateAware-singulation. |
4 | singulationSLFlag | Indicates which SL bit(asserted or deasserted) will be matched during singulation. |
5 | singulationInventoryState | Indicates which inventory state [A or B] will be matched during the singulation. |
operationCompleteEvent
Indicates the currently running operation (Inventory/Access/Locationing) is complete and there are no more tags to report. This parameter is NOT supported on Android.
lastAccessResultEvent
Returns results of the last Access operation. This parameter is NOT supported on Android.
ID | Name | Description |
---|---|---|
1 | tagsSucceeded | Number of tags on which the access operation succeeded. |
2 | tagsFailed | Number of tags on which the access operation failed. |
Remarks
- On devices running Android,
rfid.connect
can be called only after theenumRFIDevent
callback is received by callingrfid.enumerate
. - An EB app can connect only to one reader at one time. If a different reader is desired, the app must disconnect from the currently connected reader before connecting to a new one.
- An RFID reader can connect to only one app at one time. If a different RFID reader app is desired, the device user must either quit the previous app, or instruct the app to disconnect from the reader.
- If inventory is running, the device user must stop the inventory operation before quitting the EB app.
Installation
The RFID plug-in package for RhoElements 2.2 SP1 is not is not part of the default installation, but is available as a separate download from the Zebra Technologies Support site.
RFID plug-in resources:
- The RFID Plug-in for RhoElements 2.2 SP1 download, available from the from Zebra support site, includes release notes, installation instructions and a sample app.
Config.xml setting
Once the plug-in is installed, modify the <PreloadLegacyActiveX> parameter in the app's Config.xml
file as follows:
<PreloadLegacyActiveX value="1"/>
General
When loaded, the plug-in by default is already connected to RFID module. To disconnect, use the disconnect()
method call on the RFID object. After successfully disconnecting, the connect()
method can be used to make a new connection to the RFID module. For a plug-in method to be successfully invoked, all of its associated non-default properties must be set prior to making the call.
Waiting for operationCompleteEvent
This parameter is NOT supported on Android. When RhoElements finishes execution of a plug-in method call, the corresponding RFID operation might not have been completed or might have just been started. Specifically, for performInventory, tagLocate, tag access operations (readTag/writeTag/lockTag/killTag) using an access-filter or performed on all tags, the corresponding method call just initiates the corresponding RFID operation. These operations generate Tag reports, and once all the reports are sent to the application, the plug-in sends a operationCompleteEvent. The disconnect()
method also gives an operationCompleteEvent back to the application. It is important that the application register for operationCompleteEvent, and further method calls must be made only after the reception of this event.
Handling the TagEvent
TagEvent should be assigned to a Callback that handles the tag-reports arising out of Inventory/Locationing/Read/Write/Lock/Kill operations. Every tagEvent callback should usually result in JSON TagData Array object of length equal to the reportTrigger property set. However, in the contingency that the RFID operation has ended and the plug-in hasn't accumulated reportTrigger number of tagData objects, then the pending tags are all sent to the tagEvent callback.
Access Operation Status Codes
For an access operation performed by using an access filter or an access operation performed on all tags, the status code only indicates that the operation has been successfully started. Setting enableTagAccessStatus to true generates Tag reports with the tagID and status of the access operation on the corresponding tagID. However, for a single tag access operation, the statusEvent indicates the result of the access operation for the given tagID.
Handling the operationCompleteEvent
This parameter is NOT supported on Android. When RhoElements finishes execution of a plug-in method call, the corresponding RFID operation may not have been completed, rather it may have just been started. Specifically, for performInventory, tagLocate, tag access operations (readTag/writeTag/lockTag/killTag) using access-filter or performed on all tags, the corresponding method call just initiates the corresponding RFID operation. These operations generate Tag-reports, and once all the reports are completely sent to the application, the plug-in sends a operationCompleteEvent.
Plug-in Busy
The Plug-in can perform only one RFID protocol operation (Inventory/Read/Write/Locate/Kill) at a time. Trying to invoke a new operation when an existing one is still running, will generate a "Plug-in Busy" error. Irrespective whether stop method is called or not, the plug-in is ready to initiate a new operation only after it sends the operationCompleteEvent. Trying to start a new operation before the event is received will return a "Plugin Busy error".
Deleting Pre-filters
Once a pre-filter is added with a particular ID, the same ID should be used to reference it when deleting it.
Tag Locating
Tag Locating can be performed only a particular antennaID.
Access Operations On All Visible Tags
One can perform an access operation on all tags in the field of view by setting rfid.tagID to an empty string("")
Access Filters
Access-filter can take up to tag-patterns. By default, match pattern used is Pattern-A alone and settings for tagPattern B are not considered unless specified by the appropriate matchPattern.
Requirements
RhoElements Version | 2.2 SP1 - Additional Download Required or above |
---|---|
Supported Devices | MC 3190Z, MC 9190Z |
Minimum Requirements | Hardware for reading RFID Tags |
Persistence | Not Persistent - Changes to this module will not persist when navigating to a new page. |
Examples
The HTML/JavaScript code samples below demonstrate how to implement some of this API's basic features.
Start Inventory
This example starts an inventory using HTTP meta tags sent to a JavaScript "TagHandler" function.
<META HTTP-Equiv="rfid" content="statusEvent:url('javascript:statusHandler(%json)')">
<META HTTP-Equiv="rfid" content="tagEvent:url('javascript:TagHandler(%json)')">
<META HTTP-Equiv="rfid" content="performInventory">
<script>
// Function to handle a tagReport containing only tagID field
function TagHandler(tagReportJSON){
objGeneric.Log("TagID read:"+tagReportJSON.TagData[0].tagID,3);
}
</script>
Continuous Inventory
This example runs inventory as long as trigger button is pressed. By default, the plug-in reports unique tags to tje tagEvent callback in JSON format and beeps for every unique tag encountered. By default, only one tagID is reported per the JSON tagReport. This JSON contains only the tagID field.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
objGeneric.InvokeMETAFunction("OnTrigger", "javascript:doTrigger('%s')");
rfid.statusEvent = "statusHandler(%json)";
function doTrigger(state){
if(state == 0){
rfid.stop();
}
else{
rfid.tagEvent = "TagHandler(%json)";
rfid.performInventory();
}
}
// Function to handle a tagReport containing only tagID field
function TagHandler(tagReportJSON){
objGeneric.Log("TagID read:"+tagReportJSON.TagData[0].tagID,3);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Inventory Start/Stop
This example performs inventory with start and stop triggers configured. Here all the tag-reads are reported to tagEvent callback with five reports per callback. The tagSeenCount and the UTCTtimestamp at which tag was first seen also are reported. Note: This code beeps only when reading unique tags.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
rfid.statusEvent = "statusHandler(%json)";
function performAdvancedInventory1(){
rfid.tagEvent = "TagHandlerAdvanced1(%json)";
rfid.reportUniqueTags = false;
rfid.reportTrigger = 5;
rfid.enableTagSeenCount = true;
rfid.enableTagUTCTimeStamp = true;
rfid.startTriggerType = "triggerPress";
rfid.stopTriggerType = "duration";
rfid.stopDuration = 10000;// Duration in milliseconds.
rfid.performInventory();
}
// Function to handle tagReports containing tagID, seenCount and firstSeenTimeStamp fields.
function TagHandlerAdvanced1(tagReportJSON){
objGeneric.Log("TagID :"+tagReportJSON.TagData[0].tagID+" Seen Count: "+tagReportJSON.TagData[0].tagSeenCount+" First seen Timestamp:"+tagReportJSON.TagData[0].firstSeenTimeStamp,3);
objGeneric.Log("TagID :"+tagReportJSON.TagData[1].tagID+" Seen Count: "+tagReportJSON.TagData[1].tagSeenCount+" First seen Timestamp:"+tagReportJSON.TagData[1].firstSeenTimeStamp,3);
objGeneric.Log("TagID :"+tagReportJSON.TagData[2].tagID+" Seen Count: "+tagReportJSON.TagData[2].tagSeenCount+" First seen Timestamp:"+tagReportJSON.TagData[2].firstSeenTimeStamp,3);
objGeneric.Log("TagID :"+tagReportJSON.TagData[3].tagID+" Seen Count: "+tagReportJSON.TagData[3].tagSeenCount+" First seen Timestamp:"+tagReportJSON.TagData[3].firstSeenTimeStamp,3);
objGeneric.Log("TagID :"+tagReportJSON.TagData[4].tagID+" Seen Count: "+tagReportJSON.TagData[4].tagSeenCount+" First seen Timestamp:"+tagReportJSON.TagData[4].firstSeenTimeStamp,3);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Read Reserved Memory
This example performs inventory and reads the reserved memory bank of all tags inventoried. The tags are selected to match a particular pre-filter pattern (EPC starts with "9742"). The tagEvent handler extracts both tagID and memoryBankData fields. Inventory is stopped after 10 tag-reads are observed.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
rfid.statusEvent = "statusHandler(%json)";
function performAdvancedInventory2(){
rfid.tagEvent = "TagHandlerAdvanced2(%json)";
rfid.stopTriggerType = "tagObservation";
rfid.stopObservationCount = 10;
rfid.preFilterID = 1;
rfid.preFilterMemBank = "EPC";
rfid.preFilterBitOffset = 32;
rfid.preFilterHexPattern = "9742";
rfid.preFilterBitCount = 16;
rfid.addPreFilter();
rfid.invMemBank = "Reserved";
rfid.performInventory();
}
// Function to handle tagReports containing tagID, seenCount and firstSeenTimeStamp fields.
function TagHandlerAdvanced2(tagReportJSON){
objGeneric.Log("TagID :"+tagReportJSON.TagData[0].tagID+" Reserved MemoryBank Data: "+tagReportJSON.TagData[0].memoryBankData,1);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Get/Set Parameters
This example gets the capabilities of the local RFID module and configures the antenna's RF and Singulation parameters. The application should register JavaScript callbacks for the enumRFIDEvent and rfParamsEvent events.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
rfid.statusEvent = "statusHandler(%json)";
function EnumerateRFIDModule(){
rfid.enumRFIDEvent = "enumerateRFIDHandler(%json)";
objGeneric.Log("In EnumerateRFIDModule :",3);
rfid.enumerate();
ConfigureRFIDModule();
}
function enumerateRFIDHandler(enumRFIDJSON){
objGeneric.Log("Number of Devices:"+enumRFIDJSON.numberOfDevices,3);
objGeneric.Log("Reader ID:"+enumRFIDJSON.readerID,3);
objGeneric.Log("Firmware version:"+enumRFIDJSON.firmwareVersion,3);
objGeneric.Log("Model Name:"+enumRFIDJSON.modelName,3);
objGeneric.Log("Number of Antennas:"+enumRFIDJSON.numberOfAntennas,3);
objGeneric.Log("Number of Prefilters:"+enumRFIDJSON.numberOfPreFilters,3);
objGeneric.Log("Country code:"+enumRFIDJSON.countryCode,3);
objGeneric.Log("Communication standard:"+enumRFIDJSON.communicationStandard,3);
objGeneric.Log("Minimum Transmit Power:"+enumRFIDJSON.transmitPowerMin,3);
objGeneric.Log("Maximum Transmit Power:"+enumRFIDJSON.transmitPowerMax,3);
objGeneric.Log("Step Transmit Power:"+enumRFIDJSON.transmitPowerStep,3);
objGeneric.Log("Supported RF Modes:"+enumRFIDJSON.numberOfRFModes,3);
objGeneric.Log("State Aware Singulation:"+enumRFIDJSON.stateAwareSingulationSupported,3);
}
function ConfigureRFIDModule(){
rfid.singulationEvent = "getSingulationHandler(%json)";
rfid.rfParamsEvent = "getRFParamsHandler(%json)";
rfid.singulationSession = "1";
rfid.singulationTagPopulation = "100";
rfid.RFMode = "4"; // Mode table Index
rfid.transmitPower = "25.20"; // Transmit Power in dbM
rfid.setSingulation(); // Applies on both the antennas.
rfid.setRFParams();
rfid.antennaSelected = 1; // To verify if the settings have indeed been applied.
rfid.getSingulation();
rfid.getRFParams();
}
function getRFParamsHandler(RFParamsJSON){
objGeneric.Log("RFMode of Antenna 1:"+RFParamsJSON.RFMode,3);
objGeneric.Log("Transmit Power of Antenna 1:"+RFParamsJSON.transmitPower,3);
}
function getSingulationHandler(singulationJSON){
objGeneric.Log("Session of Antenna 1:"+singulationJSON.singulationSession,3);
objGeneric.Log("Tag Population of Antenna 1:"+singulationJSON.singulationTagPopulation,3);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Tag Locationing
This example performs TagLocationing operation and reports the real-time relative distance information of the tag being located.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
rfid.statusEvent = "statusHandler(%json)";
function TagLocationing(){
rfid.tagEvent = "TagLocateHandler(%json)";
rfid.antennaSelected = 1;
rfid.tagID = "97427423111111111111111111111111111111111111111111111111";
rfid.locateTag();
setTimeout("stopRunningLocate()",10000);
}
function stopRunningLocate(){
rfid.stop();
}
function TagLocateHandler(tagReportJSON){
objGeneric.Log("TagID :"+tagReportJSON.TagData[0].tagID+" Relative Distance: "+tagReportJSON.TagData[0].relativeDistance,1);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Read tagID
This example performs Read operation on a particular tagID.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
rfid.statusEvent = "statusHandler(%json)";
function readSingleTag(){
rfid.tagID = "97427423111111111111111111111111111111111111111111111111";
rfid.tagEvent = "TagMemBankHandler(%json)";
rfid.tagByteOffset = 4;
rfid.tagMemBank = "Reserved";
rfid.tagReadSize = 4;
rfid.tagRead();
}
function TagMemBankHandler(tagReportJSON){
objGeneric.Log("TagID :"+tagReportJSON.TagData[0].tagID+" Access Password: "+tagReportJSON.TagData[0].memoryBankData,1);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Read tagPattern
This example performs Read operation on all tags that match a particular tagPattern (access-filter). Reads User memory bank of all tags whose EPC start with "9742".
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
rfid.statusEvent = "statusHandler(%json)";
function testReadMultipleTags(){
var selectedTagPattern = "9742";
var hexMaskStr = "";var i =0;
for(i =0;i < selectedTagPattern.length;i++)
hexMaskStr += "F";
rfid.useAccessFilter = true;
rfid.matchPattern = "A";
rfid.tagPatternAMemBank = "EPC";
rfid.tagPatternAByteOffset = 4;
rfid.tagPatternAHexPattern = selectedTagPattern;
rfid.tagPatternAHexMask = hexMaskStr.toString();
hexMaskStr = "";
for(i=0;i < selectedTagPattern.length;i++)
hexMaskStr += "F";
rfid.tagByteOffset = 0;
rfid.tagMemBank = "User";
rfid.tagReadSize = 0;
rfid.tagEvent = "TagMemBankHandler(%json)";
rfid.tagRead();
}
function TagMemBankHandler(tagReportJSON){
objGeneric.Log("TagID :"+tagReportJSON.TagData[0].tagID+" User Memory Data: "+tagReportJSON.TagData[0].memoryBankData,1);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
State-aware Pre-filters
This example shows the usage of State aware pre-filters and operationCompleteEvent. This function tries to search for a tag whose EPC starts with "56780000"
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
var tagCount = 0;
function testStateAwarePreFilter(){
rfid.tagEvent = "TagHandler(%json)";
rfid.statusEvent = "statusHandler(%json)";
rfid.operationCompleteEvent = "operCompleteHandler()";
rfid.performStateAwareSingulation = true;
rfid.singulationSLFlag = "SL_ASSERTED";
rfid.singulationInventoryState = "INV_B";
rfid.setSingulation();
rfid.preFilterID = 0;
rfid.preFilterHexPattern = "0000";
rfid.preFilterMemBank = "EPC";
rfid.preFilterBitOffset = 48;
rfid.preFilterStateAwareAction = "INV_B_NOT_INV_A";
rfid.preFilterTarget = "INV_S0";
rfid.addPreFilter();
rfid.preFilterID = 1;
rfid.preFilterHexPattern = "5678";
rfid.preFilterBitOffset = 32;
rfid.preFilterStateAwareAction = "ASRT_SL_NOT_DSRT_SL";
rfid.preFilterTarget = "SL";
rfid.addPreFilter();
rfid.reportUniqueTags = false;
rfid.beepOnRead = true;
rfid.stopTriggerType = "tagObservation";
rfid.stopObservationCount = 10;
rfid.performInventory();
}
function operCompleteHandler(){
alert('Operation Complete. Total tags received:'+tagCount.toString());
}
function TagHandler(tagReportJSON){
tagCount += tagReportJSON.TagData.length;
objGeneric.Log("TagID :"+tagReportJSON.TagData[0].tagID,1);
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>
Use getLastAccessResult
This example shows the usage of getLastAccessResult method. At the completion of a multiple tag Write operation, the latter method is called to find out how many tags the operation succeeded and failed.
<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
var tagCount = 0;
function writeMultipleTags(){
rfid.tagEvent = "TagAccessStatusFieldHandler(%json)";
rfid.statusEvent = "statusHandler(%json)";
rfid.operationCompleteEvent = "operCompleteHandler()";
rfid.lastAccessResultEvent = "lastAccessResultHandler(%json)";
clear();
var hexMaskStr = "";var i =0;
for(i =0;i<8;i++)
hexMaskStr += "F";
rfid.enableTagAccessStatus = true;
rfid.useAccessFilter = true;
rfid.tagPatternAMemBank = "Reserved";
rfid.tagPatternAByteOffset = 4;
rfid.tagPatternAHexPattern = "FFFFFFFF";
rfid.tagPatternAHexMask = hexMaskStr.toString();
rfid.tagByteOffset = 4;
rfid.tagMemBank = "EPC";
rfid.tagWriteData = "EEEEAAAA";
rfid.tagWrite();
}
function TagAccessStatusFieldHandler(tagReportJSON){
objGeneric.Log("TagID:"tagReportJSON.TagData[0].tagID+" Access Status "+tagReportJSON.TagData[0].accessStatus);
}
function operCompleteHandler(){
rfid.getLastAccessResult();
}
function lastAccessResultHandler(accessResultJSON){
alert("Success: "+accessResultJSON.tagsSucceeded.toString()+" Failures: "+accessResultJSON.tagsFailed.toString());
}
function statusHandler(statusJSON){
objGeneric.Log("Status:"+statusJSON.method+' '+statusJSON.errorCode,1);
}
</script>