Overview
The RFID Module provides access to functionality of the device's RFID reader, if so equipped. Limited device support. This module is not included with the default RhoElements/RhoStudio installers; it must be downloaded and installed separately (SEE REMARKS).
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, in some cases, indicate parameters which will be retrieved.
Name | Description | Default Value |
---|---|---|
enumerate | Returns a list of RFID readers present on the device, and their respective capabilities via enumRFIDEvent. For the supported devices, this method will return the number of RFID readers in the device as 1. | |
connect | Creates connection to the default RFID reader. By default, the plug-in attempts to connect to the RFID Reader whenever the plug-in is loaded. | |
disconnect | Disconnects the current RFID connection and flushes all properties of the "rfid" module,except for the events. | |
stop | Soft trigger to stop a runnning inventory or locateTag operation. All the pending tag reports are discarded. | |
performInventory | Performs an inventory operation on the RFID reader which is started and stopped according to the trigger settings done by the application. By default, performInventory starts an inventory operation immediately and there is no default stop trigger. So, an explicit "stop" call must be made operation. Tags will be reported as part of the TagData Array in the tagEvent's JSON object. When the property "invMemBank" is set(to either Reserved/EPC/TID/User) prior to calling performInventory, the corresponding memory-bank's data shall also be read for the tags being inventoried. For the inventoried tags, additional fields may 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 a RFID operation like performInventory, locateTag, readTag and other Access operations. The plug-in returns an error string describing that it is busy and it can perform other RFID operations only when the inventory is stopped. | |
locateTag | Configures the locateTag operation which will look for a specific Tag ID on a specific antennaID, and will keep reporting tagEvents if the tag is found along with relative distance (In a scale of 0-100, 100 being the closest) to help locate the requested tag. Also if the beepOnRead is enabled (Default state), the beep frequency varies proportionate to the relative distance (Geiger counter). The tagLocationing algorithms can use only one antenna to locate a tagID. Thus, antennaSelected cannot take the take default value 0, but 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","reportTrigger" are not relevant here, the tag field settings "enableTagAntennaID", "enableTagRssi", etc are still 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 will be used to filter out tags to perform the operation. If tagID is empty and useAccessFilter is false (i.e the default value),the kill operation will be attempted on all the 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. It is used to sort out the subset of tags to participate in the next RFID operations. Multiple preFilters may be added, limited by the RFID reader. Each of them 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, 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 read operation will be performed on all the tags in field of view. | |
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. 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 write operation will be attempted on all the tags in field of view | |
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). At least one of Session or TagPopulation parameters must be properly set before calling this method. When state-aware singulation is desired, performStateAwareSingulation is to be set to true and the configured values for SL flag and Inventory state will be 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. Note that all antennae share the same singulation settings. | |
getRFParams | gets the current RF Mode, Transmit power parameter for the currently selected antenna. The result is return in rfParamsEvent. The property antennaSelected cannot take default value(0) because the RF Params are returned only for one antennaID. | |
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 | |
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 listed in this section indicate parameters, or attributes which can be set.
Name | Possible Values | Description | Default Value |
---|---|---|---|
antennaSelected:[Value] | 0-N | Index of the antenna being selected for the subsequent data or configuration operations. A '0' indicates all antennas to be selected. | 0(ALL) |
beepOnRead:[Value] | true, false, 1, 0 | Specifies if the device should beep whenever application receives a tag. | true |
enableTagAccessStatus:[Value] | true, false, 1, 0 | Enable/Disable the access status field in the tag reports. Contains valid values for Read/Write/Lock/Kill operations | false |
enableTagAntennaID:[Value] | true, false, 1, 0 | Enable/Disable the antenna ID field in the tag reports | false |
enableTagCRC:[Value] | true, false, 1, 0 | Enable/Disable the CRC field in the tag reports | false |
enableTagXPC:[Value] | true, false, 1, 0 | Enable/Disable the XPC field in the tag reports | false |
enableTagPC:[Value] | true, false, 1, 0 | Enable/Disable the PC field in the tag reports | false |
enableTagRSSI:[Value] | true, false, 1, 0 | Enable/Disable the RSSI data field in tag reports | false |
enableTagSeenCount:[Value] | true, false, 1, 0 | Enable/Disable the SeenCount field in tag reports | false |
enableTagUTCTimeStamp:[Value] | true, false, 1, 0 | Enable/Disable the UTCTimeStamp data field in tag reports | false |
invMemBank:[Value] | None, Reserved, EPC, TID, User | Specifies if 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 | Match criteria to be used for filtering using 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 |
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, the tags will henceforth be singulated based on the configured inventory states/SL flags rather than the reader defaults. Besides, 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, the tags are singulated based on the 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) shall be affected when the current state-Aware pre-filter is applied. This property will be 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 unselect matching tags / non-matching tags when the current pre-filter is applied. | SELECT_NOT_UNSELECT |
preFilterBitCount:[Value] | Number of applicable bits in the filterHexPattern | Specifies 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 | Specifies the offset into the memory bank (position) applicable to a subsequent call to addFilter() | 32 |
preFilterHexPattern:[Value] | Hex Pattern | Specifies a hex pattern to apply in a subsequent call to addFilter() | N/A |
preFilterID:[Value] | unsigned integer | Specifies the ID of the filter to apply in a subsequent call to addFilter()`or deleteFilter() | N/A |
preFilterMemBank:[Value] | Reserved, EPC, TID, User | Specifies 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 | This property controls the reporting of tags from the plug-in. Setting this property to N indicate to the plug-in that it should report tags on seeing N tags. 0 indicates to report tags only at the end of inventory. | 1 |
reportUniqueTags:[Value] | true, false, 1, 0 | Specifies to report only unique tags | true |
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 | Specifies 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 | Specifies 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 | Select an RFID Tag ID to perform further operations on | N/A |
tagKillPassword:[Value] | hex kill password | sets the password to use when calling the killTag method | N/A |
tagMemBank:[Value] | Reserved, EPC, TID, User | sets the memory bank to access within the currently selected tag. | EPC |
tagPassword:[Value] | hex password | Sets the access password to use when accessing the currently selected tag. | 00000000 |
tagPatternAByteOffset:[Value] | Offset from the start of the memory bank in bytes | Specifies the offset into the memory bank (position) | 4 |
tagPatternAHexMask:[Value] | Hex Mask | Specifies the mask for above pattern | N/A |
tagPatternAHexPattern:[Value] | Hex Pattern | Specifies a hex pattern to be used for comparing memory bank data | N/A |
tagPatternAMemBank:[Value] | Reserved, EPC, TID, User | Specifies the memory bank for the tag pattern A | EPC |
tagPatternBByteOffset:[Value] | Offset from the start of the memory bank in bytes | Specifies the offset into the memory bank (position) | 4 |
tagPatternBHexMask:[Value] | Hex Mask | Specifies the mask for above pattern | N/A |
tagPatternBHexPattern:[Value] | Hex Pattern | Specifies a hex pattern to be used for comparing memory bank data | N/A |
tagPatternBMemBank:[Value] | Reserved, EPC, TID, User | Specifies 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. | 0 (all) |
tagWriteData:[Value] | hex data | sets the data to write in the tagWrite method | N/A |
transmitPower:[Value] | power in dbm derived from min, max and step values provided in the enumRFIDevent | Specifies the transmit power to be used in a subsequent call to setTransmitPower | N/A |
useAccessFilter:[Value] | true, false, 1, 0 | Specifies 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 only one) along with their respective capabilities
ID | Name | Description |
---|---|---|
1 | numberOfDevices | returns total number of device enumerated, returns 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
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 where exactly error was generated |
2 | errorCode | standard RFID API error code or a 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. |
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.
ID | Name | Description |
---|
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
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:
- RFID Plug-in for RhoElements 2.2 SP1 - download 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
By default the plug-in, when loaded, is already connected to RFID Module. In order to disconnect, one may use disconnect() method call on the rfid object. After a successful disconnection, the connect() method may 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 successfully set prior to making the call.
Waiting for 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. The disconnect() method also gives an operationCompleteEvent back to the application. It is important that the application register for operationCompleteEvent and further method calls will have to 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 equalling 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 "Plugin 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. |
HTML/JavaScript Examples
This example starts an inventory using HTTP Meta Tags and tags are sent to a JavaScript function "TagHandler".
<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>
This example runs inventory as long as trigger button is pressed. By default, the plug-in reports unique tags to tagEvent callback in JSON format and beeps for every unique tag encountered. By default, only one tagID is reported per the JSON tagReport. Besides, this JSON contains only the field tagID.
<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>
This example performs inventory with start and stop triggers configured. Here all the tag-reads are reported to tagEvent callback with 5 reports per callback. Besides, the tagSeenCount and the UTCTtimestamp at which tag was first seen is also reported. Note:It will still beep for only unique tags read.
<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>
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>
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>
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>
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>
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>
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>
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>