RFID Module

RhoElements 2.x API

Overview

The RFID Module provides access to functionality of the device's RFID reader, if so equipped.

Limited device support. This module is supported only on Zebra MC3190-Z and MC9190-Z RFID reader devices, and is not included with the standard installation. Use of the RFID module might therefore 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 this section indicate methods or parameters available for retrieval.

Name Description Default Value
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.
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. Values apply to all platforms (Android and Windows Mobile/CE) unless otherwise noted.

Name Possible Values Description Default Value
antennaSelected:[Value] 0-N Index of the antenna being selected for the subsequent data or configuration operations. A value of '0' (default) selects all antennae. 0(ALL)
beepOnRead:[Value] true, false, 1, 0 Used to specify whether the device should beep whenever application receives a tag. true
enableTagAccessStatus:[Value] true, false, 1, 0 Used to enable and disable the access status field in the tag reports. Contains valid values for Read, Write, Lock and Kill operations. false
enableTagAntennaID:[Value] true, false, 1, 0 Used to enable and disable the antenna ID field in the tag reports. false
enableTagCRC:[Value] true, false, 1, 0 Used to enable and disable the CRC field in the tag reports. false
enableTagXPC:[Value] true, false, 1, 0 Used to enable and disable the XPC field in the tag reports. false
enableTagPC:[Value] true, false, 1, 0 Used to enable and disable the PC field in the tag reports. false
enableTagRSSI:[Value] true, false, 1, 0 Used to enable and disable the RSSI data field in tag reports. false
enableTagSeenCount:[Value] true, false, 1, 0 Used to enable and disable the SeenCount field in tag reports. false
enableTagUTCTimeStamp:[Value] true, false, 1, 0 Used to enable and disable the UTCTimeStamp data field in tag reports. false
invMemBank:[Value] None, Reserved, EPC, TID, User Used to specify whether any memory bank is to be read during an inventory. None
lockField:[Value] killPassword, accessPassword, EPC, TID, User Sets the data field to be used for tagLock operation. None
lockPrivilege:[Value] lock, unlock, permanentLock, permanentUnlock sets the lock privilege to be used for tagLock operation None
matchPattern:[Value] A_AND_B, NOTA_AND_B, NOTA_AND_NOTB, A_AND_NOTB, A Used to match criteria used for filtering with tag-patterns A and B. A
newTagID:[Value] hex password Sets a new tag ID to be assigned to the currently selected tag in the setTagID method. N/A
tagoffset:[Value] integer Sets the word offset into the selected memory bank to use for the next access of the currently selected tag. 0
newAccessPassword:[Value] hex password Sets a new tag access password to be assigned to the currently selected tag in the setTagAccessPassword method N/A
newKillPassword:[Value] hex password Sets a new tag kill password to be assigned to the currently selected tag in the setTagKillPassword method. N/A
performStateAwareSingulation:[Value] true, false, 1, 0 If set to true, are singulated based on the configured inventory states/SL flags (rather than reader defaults). The subsequently added pre-filters should indicate the desired inventory state/SL flags of the matching / non-matching tags. If this property is set to false, tags are singulated based on reader defaults. false
preFilterStateAwareAction:[Value] INV_A_NOT_INV_B, ASRT_SL_NOT_DSRT_SL, INV_A,ASRT_SL, NOT_INV_B, NOT_DSRT_SL, INV_A2BB2A_NOT_INV_A, NEG_SL_NOT_ASRT_SL, INV_B_NOT_INV_A, DSRT_SL_NOT_ASRT_SL, INV_B, DSRT_SL, NOT_INV_A, NOT_ASRT_SL, NOT_INV_A2BB2A, NOT_NEG_SL Sets the State-aware Action(s) for the current pre-filter's matching and/or non-matching tags. This property is considered only when performStateAwareSingulation is true. All actions indicating asserting/de-asserting SL flags are valid only when preFilterTarget is SL. All actions indicating changes to the inventoried states(i.e A/B) are valid only when preFilterTarget is INV_S0/INV_S1/INV_S2/INV_S3. N/A
preFilterTarget:[Value] SL, INV_S0, INV_S1, INV_S2, INV_S3 Indicates which flag (i.e SL/INV_S0/INV_S1/INV_S2/INV_S3) is affected when the current state-aware pre-filter is applied. This property is considered only when performStateAwareSingulation is true. N/A
preFilterStateUnawareAction:[Value] SELECT_NOT_UNSELECT, SELECT, NOT_UNSELECT, UNSELECT, UNSELECT_NOT_SELECT, NOT_SELECT Sets the state-unaware Action for the current pre-filter's matching and/or non-matching tags. This property is considered only when performStateAwareSingulation is false. This determines whether to select and/or deselect matching tags/non-matching tags when the current pre-filter is applied. SELECT_NOT_UNSELECT
preFilterBitCount:[Value] Number of applicable bits in the filterHexPattern Used to specify the number of bits within the preFilterHexPattern to match in a subsequent call to addFilter(). N/A
preFilterBitOffset:[Value] Offset from the start of the memory bank in bits Used to specify the offset into the memory bank (position) applicable to a subsequent call to addFilter(). 32
preFilterHexPattern:[Value] Hex Pattern Used to specify a hex pattern to apply in a subsequent call to addFilter(). N/A
preFilterID:[Value] unsigned integer Used to specify the ID of the filter to apply in a subsequent call to addFilter() or deleteFilter(). N/A
preFilterMemBank:[Value] Reserved, EPC, TID, User Used to specify the memory bank to apply in a subsequent call to addFilter(). EPC
startPeriod:[Value] milliseconds Sets the repeat period for a subsequent inventory. N/A
reportTrigger:[Value] 0-N (integer) Controls the reporting of tags from the plug-in. Setting this property to 'N' causes the plug-in to report tags after seeing 'N' (number of) tags. A setting of '0' causes tags to be reported only at the end of inventory. 1
reportUniqueTags:[Value] true, false, 1, 0 Used to report only unique tags. true
readerID:[Value] Based on reader ID returned by enumRFIDevent callback. Sets the ID of the reader to be called before rfid.connect. If value is not set, default value is used. Supported on Android devices only. RFID1
DPOState:[Value] true, false, 1, 0 Used to enable/disable device power optimization. Supported only on Android devices with RFD8500 Bluetooth reader.
transport:[Value] Bluetooth, serial Used to select (by calling the rfid.enumerate method) the physical or wireless medium over which acquired data will travel. If not set, takes default value. Supported only on Android devices. serial
RFMode:[Value] One of the supported RF Modes listed in the capabilities (see enumRFIDEvent) Sets the RFMode of the currently selected antenna(e). N/A
singulationSession:[Value] 0-3 Sets the singulation session parameter. N/A
singulationTagPopulation:[Value] unsigned short integer Sets the singulation tag population parameter. N/A
singulationInventoryState:[Value] INV_A, INV_B Indicates the inventory state [A or B] to be matched during the singulation. N/A
singulationSLFlag:[Value] SL_ASSERTED, SL_DEASSERTED Indicates the SL bit [asserted or deasserted] to be matched during the singulation. N/A
startTriggerType:[Value] immediate, triggerPress, triggerRelease, periodicStart Used to specify the start triggers allowed for performInventory and tagLocate methods. immediate
stopDuration:[Value] milliseconds Sets the duration of a inventory or locateTag. N/A
stopObservationCount:[Value] unsigned integer Stops the inventory or locateTag after "n" tags are found. N/A
stopTriggerType:[Value] triggerPress, triggerRelease, duration, tagObservation. Android devices also support the "immediate" stop trigger. Used to specify the stop-triggers allowed for performInventory and tagLocate methods. N/A
tagByteOffset:[Value] unsigned integer Sets the offset into the selected memory bank to use for the next access of the currently selected tag. 0
tagID:[Value] Tag ID in hex Used to specify an RFID Tag ID on which to perform further operations N/A
tagKillPassword:[Value] hex kill password Used to specify a password to use when calling the killTag method. N/A
tagMemBank:[Value] Reserved, EPC, TID, User Used to set the memory bank from which to access the currently selected tag. EPC
tagPassword:[Value] hex password Used to specify the access password to use when accessing the currently selected tag. 00000000
tagPatternAByteOffset:[Value] Offset (in bytes) from the start of the memory bank Used to specify the offset into the memory bank (position). 4
tagPatternAHexMask:[Value] Hex Mask Used to specify the mask for above pattern<. td=""> N/A
tagPatternAHexPattern:[Value] Hex Pattern Used to specify a hex pattern to be used for comparing memory bank data. N/A
tagPatternAMemBank:[Value] Reserved, EPC, TID, User Used to specify the memory bank for the tag pattern A. EPC
tagPatternBByteOffset:[Value] Offset from the start of the memory bank in bytes Used to specify the offset into the memory bank (position). 4
tagPatternBHexMask:[Value] Hex Mask Used to specify the mask for above pattern. N/A
tagPatternBHexPattern:[Value] Hex Pattern Used to specify a hex pattern to be used for comparing memory bank data. N/A
tagPatternBMemBank:[Value] Reserved, EPC, TID, User Used to specify the memory bank for the tag pattern B. EPC
tagReadSize:[Value] 0 (all) - N bytes Sets the number of bytes to read in the tagRead method. On Android, sets the number of words to read in the tagRead method. 0 (all)
tagWriteData:[Value] hex data Sets the data to write in the tagWrite method. On Android, the length of data should be multiple words (2 bytes). N/A
useSoftTrigger:[Value] true, false, 1, 0 Enables programmatic start/stop of a scan, the equivalent of a hardware trigger or button. Supported only on devices running Android. false
transmitPower:[Value] power in dbm derived from min, max and step values provided in the enumRFIDevent Used to specify the transmit power to be used in a subsequent call to setTransmitPower. N/A
useAccessFilter:[Value] true, false, 1, 0 Used to specify whether to use the access filter in tag access operations. false

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

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

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.

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.

lastAccessResultEvent

Returns results of the last Access operation.

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

  1. On devices running Android, rfid.connect can be called only after the enumRFIDevent callback is received by calling rfid.enumerate.
  2. An Enterprise Browser application can connect to only 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.
  3. An RFID reader can connect to only one application at one time. If a different RFID reader app is desired, the device user must either quit the previous application, or instruct the app to disconnect from the reader.

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:

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

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

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 DevicesMC 3190Z, MC 9190Z
Minimum RequirementsHardware for reading RFID Tags
PersistenceNot 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>