RSM Module

RhoElements 2.x API

Overview

The RSM Module is used to configure and retrieve attribute settings of a remote scanner connected to the device via cable or Bluetooth. When used for retrieval, navigation to a URL and/or calls to JavaScript functions are executed immediately. See Remarks section for a list of readable/configurable scanner attributes.

This API is not supported on Android.

Syntax

rsm (Module) <META> Syntax

<META HTTP-Equiv="RSM" content="[parameter]">

Rsm JavaScript Object Syntax:
By default the JavaScript Object 'rsm' will exist on the current page and can be used to interact directly with the rsm.
To Invoke rsm methods via JavaScript use the following syntax: rsm.method();

e.g. rsm.markForRetrievalModelNumber();

To Set rsm parameters via JavaScript use the following syntax: rsm.parameter = 'value'; remembering to enclose your value in quotes where appropriate.

e.g. rsm.bluetoothAuthentication = 'value';

To Set rsm return events via JavaScript use the following syntax: rsm.event = JavaScript Function;

e.g. rsm.rsmGetEvent = 'doFunction(%json)';

To set multiple EMML parameters / events on a single line use the following syntax: rsm.setEMML("[Your EMML Tags]");

e.g. rsm.setEMML("bluetoothAuthentication:value;rsmGetEvent:url('JavaScript:doFunction(%json)');markForRetrievalModelNumber");

Methods

Items listed in this section indicate methods or, in some cases, indicate parameters which will be retrieved.

NameDescriptionDefault Value
markForRetrievalModelNumber Marks the ModelNumber to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalSerialNumber Marks the SerialNumber to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalDateOfManufacture Marks the DateOfManufacture to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalDateOfService Marks the DateOfService to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothAddress Marks the BluetoothAddress to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalFirmwareVersion Marks the FirmwareVersion to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalDeviceClass Marks the DeviceClass to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBatteryStatus Marks the BatteryStatus to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBatteryCapacity Marks the BatteryCapacity to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBatteryId Marks the BatteryID to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothAuthentication Marks the BluetoothAuthentication to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothEncryption Marks the BluetoothEncryption to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothPinCode Marks the BluetoothPINCode to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothPinCodeType Marks the BluetoothPINCodeType to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothReconnectAttemptsMarks the BluetoothReconnectAttempts to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothBeepOnReconnectAttempt Marks the BluetoothBeepOnReconnectAttempt to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothHidAutoReconnect Marks the BluetoothHIDAutoReconnect to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothFriendlyName Marks the BluetoothFriendlyName to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothInquiryMode Marks the BluetoothInquiryMode to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalBluetoothAutoReconnect Marks the BluetoothAutoReconnect to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalForceSavePairingBarcode Marks the ForceSavePairingBarcode to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalLowBatteryIndication Marks the LowBatteryIndication to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalLowBatteryIndicationCycle Marks the LowBatteryIndicationCycle to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalScanLineWidth Marks the ScanLineWidth to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalGoodScansDelay Marks the GoodScansDelay to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalDecodeFeedback Marks the DecodeFeedback to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalIgnoreCode128Usps Marks the IgnoreCode128USPS to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalScanTriggerWakeup Marks the ScanTriggerWakeup to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalMems Marks the Mems to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalProximityEnable Marks the ProximityEnable to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalProximityContinuous Marks the ProximityContinuous to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalProximityDistance Marks the ProximityDistance to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalPagingEnable Marks the PagingEnable to be returned when RSMGetEvent is next called. See Remarks. N/A
markForRetrievalPagingBeepSequence Marks the PagingBeepSequence to be returned when RSMGetEvent is next called. See Remarks. N/A
bluetoothDisconnectInstructs the Bluetooth scanner to disconnect from its associated device.Device Dependant
bluetoothUnpairInstructs the bluetooth scanner to unpair from its associated device. Allows the scanner to be associated with a different deviceDevice Dependant

Parameters

Items listed in this section indicate parameters, or attributes which can be set.

NamePossible ValuesDescriptionDefault Value
bluetoothAuthentication:[Value] See RemarksSets the BluetoothAuthentication of the connected BT Scanner to the stated value.Device Dependant
bluetoothEncryption:[Value] See RemarksSets the BluetoothEncryption of the connected BT Scanner to the stated value.Device Dependant
bluetoothPinCode:[Value] See RemarksSets the BluetoothPINCode of the connected BT Scanner to the stated value.Device Dependant
bluetoothPinCodeType:[Value] See RemarksSets the BluetoothPINCodeType of the connected BT Scanner to the stated value.Device Dependant
bluetoothReconnectAttempts:[Value] See RemarksSets the BluetoothReconnectAttempts of the connected BT Scanner to the stated value.Device Dependant
bluetoothBeepOnReconnectAttempt:[Value] See RemarksSets the BluetoothBeepOnReconnectAttempt of the connected BT Scanner to the stated value.Device Dependant
bluetoothHidAutoReconnect:[Value] See RemarksSets the BluetoothHIDAutoReconnect of the connected BT Scanner to the stated value.Device Dependant
bluetoothFriendlyName:[Value] See RemarksSets the BluetoothFriendlyName of the connected BT Scanner to the stated value.Device Dependant
bluetoothInquiryMode:[Value] See RemarksSets the BluetoothInquiryMode of the connected BT Scanner to the stated value.Device Dependant
bluetoothAutoReconnect:[Value] See RemarksSets the BluetoothAutoReconnect of the connected BT Scanner to the stated value.Device Dependant
forceSavePairingBarcode:[Value] See RemarksSets the ForceSavePairingBarcode of the connected BT Scanner to the stated value.Device Dependant
lowBatteryIndication:[Value] See RemarksSets the LowBatteryIndication of the connected BT Scanner to the stated value.Device Dependant
lowBatteryIndicationCycle:[Value] See RemarksSets the LowBatteryIndicationCycle of the connected BT Scanner to the stated value.Device Dependant
scanLineWidth:[Value] See RemarksSets the ScanLineWidth of the connected BT Scanner to the stated value.Device Dependant
goodScansDelay:[Value] See RemarksSets the GoodScansDelay of the connected BT Scanner to the stated value.Device Dependant
decodeFeedback:[Value] See RemarksSets the DecodeFeedback of the connected BT Scanner to the stated value.Device Dependant
ignoreCode128Usps:[Value] See RemarksSets the IgnoreCode128USPS of the connected BT Scanner to the stated value.Device Dependant
scanTriggerWakeup:[Value] See RemarksSets the ScanTriggerWakeup of the connected BT Scanner to the stated value.Device Dependant
mems:[Value] See RemarksSets the Mems of the connected BT Scanner to the stated value. See remarksDevice Dependant
proximityEnable:[Value] See RemarksSets the ProximityEnable of the connected BT Scanner to the stated value. See remarks.Device Dependant
proximityContinuous:[Value] See RemarksSets the ProximityContinuous of the connected BT Scanner to the stated value.Device Dependant
proximityDistance:[Value] See RemarksSets the ProximityDistance of the connected BT Scanner to the stated value.Device Dependant
pagingEnable:[Value] See RemarksSets the PagingEnable of the connected BT Scanner to the stated value.Device Dependant
pagingBeepSequence:[Value] See RemarksSets the PagingBeepSequence of the connected BT Scanner to the stated value.Device Dependant
pagingActivate:[Value] See RemarksSets the PagingActivate of the connected BT Scanner to the stated value.Device Dependant

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.


rsmGetEvent

IDNameDescription
1attributeArrayArray of attribute values. The attributes returned in this array are those registered for by calls to markForRetrievalXXX prior to calling RSMGetEvent. The table in the remarks section gives the possible values associated with each attribute, if an attribute is not supported then 'Unsupported Attribute' will be returned in that attribute's array position.

Multi Instance

When multiple RhoElememts applications are running the following considerations should be made: Only the foreground RhoElements application is given access to the device scanner, when an application is sent to the background its state will be saved and it will automatically relinquish control of the Scanner. When brought back to the foreground, an application previously using the scanner will have its previous configuration (eg. selected decoders) reapplied to the scanner automatically.

Remarks

The following is a mapping between Attributes, their possible values and whether they are read / write:




Attribute                      Access  Associated Value

modelNumber                      R     The model number    
serialNumber                     R     The serial number    
dateOfManufacture                R     Date of manufacture as DDMMYY    
dateOfService                    R     Date of service as DDMMYY    
bluetoothAddress                 R     Bluetooth address as FF:FF:FF:FF:FF:FF where FF is a hex number.    
firmwareVersion                  R     Scanner's operating system version.    
deviceClass                      R     The device class of the system    
batteryStatus                    R     Indicates the status us the scanner's battery, 'Unknown', 'Full', 
                                       'Medium', 'Empty', 'Charging-FullRate', 'Charging-HalfRate', 
                                       'Charging-Trickle' or 'Discharging'    
batteryCapacity                  R     Remaining capacity of the battery, integer in the range '0' to 
                                       '100'.  'Unknown' if unable to determine, e.g. if no battery in the scanner.    
batteryID                        R     'Simple', 'Double', 'Cabled', 'Unknown'    
bluetoothAuthentication          RW    'True' if authentication is required, else 'False'    
bluetoothEncryption              RW    True' if encryption is required, else 'False'    
bluetoothPinCode                 RW    Up to 5 character PIN code used for Bluetooth authentication    
bluetoothPinCodeType             RW    'PromptUser' to prompt the user for the PIN code or 'UseStored' to 
                                       use the code stored in memory.    
bluetoothReconnectAttempts       RW    How long the scanner tries to re-establish connection if it goes 
                                       out of range, in seconds.  This value must be a multiple of 5
                                       and in the range 30 to 60 seconds.
bluetoothBeepOnReconnectAttempt  RW    When 'True' scanner will emit 5 beeps every 5 seconds whilst 
                                       re-connection in progress, else 'False'    
bluetoothHidAutoReconnect        RW    'NeverReconnect', 'ReconnectOnData' or 'ReconnectImmediately'    
bluetoothFriendlyName            RW    Friendly Bluetooth name, e.g. 'MyBTScanner'    
bluetoothInquiryMode             RW    'General' to use a general inquiry mode, else 'Limited'    
bluetoothAutoReconnect           RW    Bluetooth reconnection scheme: 
                                         'None' - No scheme
                                         'OnPower' - when powered on
                                         'OnOutofRange' - when device goes out of range
                                         'OnPowerOutofRange' - when powered on or when device goes out
                                         of range.    
forceSavePairingBarcode          RW    Force saving the barcode assigned to the device to which the scanner has
                                       been paired.  'Enabled' or 'Disabled'
bluetoothDisconnect              W     Command scanner to disconnect from its connected device.
bluetoothUnpair                  W     Command scanner to unpair from its paired device.  Allows scanner to associate
                                       with a different device.
lowBatteryIndication             RW    Low battery indication 'Enabled' or 'Disabled'    
lowBatteryIndicationCycle        RW    Low battery indication cycle time, in seconds 
                                       ('10', '20', '30', '40' or '50').   
scanLineWidth                    RW    The laser scan line width, 'Wide' or 'Narrow'.
goodScansDelay                   RW    Delay between good scans in proximity continuous mode, measured in milliseconds.
                                       Range 0 to 15000.  This value must be a multiple of 100.                                         
decodeFeedback                   RW    The remote scanner beeps and illuminates its green LED on a 
                                       successful decode.  'Enabled' or 'Disabled'.
ignoreCode128Usps                RW    Feature for ignoring Code 128 barcodes beginning with 420 and 421,
                                       'Enabled' or 'Disabled' 
scanTriggerWakeup                RW    Scanner trigger will wakeup the device from a low power state, 
                                       'Enabled' or 'Disabled'    
mems                             RW    Mems feature 'Enabled' or 'Disabled'    
proximityEnable                  RW    Proximity feature 'Enabled' or 'Disabled'    
proximityContinuous              RW    Proximity continuous mode 'Enabled' or 'Disabled'
proximityDistance                RW    Specify the distance for the proximity feature as 'Short', 'Medium' 
                                       or 'Long'    
pagingEnable                     RW    Specify whether paging the device is 'Enabled' or 'Disabled'    
pagingBeepSequence               RW    Range '0' to '15' to specify the pattern for the paging beep 
                                       sequence.    
pagingActivate                   W     'Start' or 'Stop' paging to the scanner.

ProximityEnable / Mems

If you press the trigger on an RSM scanner proximity enabled will be turned off, even though it still reports its self as being turned on if you query the RSM parameter. In order to use ProximityEnable you need to also have Mems enabled, this is the motion sensor and if you disable Mems the scanner will not function.

Requirements

RhoElements Version1.0.0 or above
Supported DevicesAll supported devices that have the ability to connect to remote scanners.
Minimum RequirementsThis tag requires appropriate hardware to run, i.e. a remote scanner and a device which supports it.
PersistenceTransient - The RSM parameters are volatile and only the current value of the RSM attribute will be altered. Changes to RSM attributes will persist until the scanner is disabled or a navigation occurs. rsmGetEvent will persist until a navigation occurs.

HTML/JavaScript Examples

The following example configures some parameters associated with the remote Bluetooth scanner:

<META HTTP-Equiv="Scanner" Content="Enabled:SCN2">
<META HTTP-Equiv="RSM" Content="BluetoothAuthentication:True">
<META HTTP-Equiv="RSM" Content="BluetoothPinCode:5678">
<META HTTP-Equiv="RSM" Content="BluetoothReconnectAttempts:6">
<META HTTP-Equiv="RSM" Content="BluetoothBeepOnReconnectAttempt:True">
<META HTTP-Equiv="RSM" Content="BluetoothPINCodeType:UseStored">
<META HTTP-Equiv="RSM" Content="BluetoothAutoReconnect:OnPowerOutOfRange">

The following example retrieves some attributes of the Bluetooth Scanner:

<SCRIPT TYPE="TEXT/JAVASCRIPT">

function onRSMAttributes(jsonObject)
{
    //  Receive array of attribute values in the order they were registered and populate SPAN tags.
    var spanID;
    var spanElement;
    for(i=0; i < jsonObject.attributeArray.length; i++)
    {
        spanID = "Span" + (i+1);
        spanElement = document.getElementById(spanID);
        spanElement.innerText = jsonObject.attributeArray[i];
    }
}

function onTest()
{
    //Invoke some attributes to be returned 
    rsm.markForRetrievalModelNumber();  //  Array Index 0
    rsm.markForRetrievalSerialNumber();         
    rsm.markForRetrievalBluetoothAddress();     
    rsm.markForRetrievalBluetoothPinCode();
    rsm.markForRetrievalBluetoothFriendlyName();
    rsm.markForRetrievalProximityEnable();  //  Array Index 5

    //  Finally assign a function for RSMGetEvent, this will call onRSMAttributes with the array of parameters we have registered for above.
    rsm.rsmGetEvent = onRSMAttributes(%json);

}
</SCRIPT>

<HTML>
    <HEAD>
        <!-- Scanner must be enabled to use RSM functionality -->
        <META HTTP-Equiv="Scanner" Content="Enabled:SCN2">
    </HEAD>
    <BODY>
        <a href="javascript:onTest()">Get Values</a><br>
        Model Number: <span id=Span1></span><br>
        Serial Number: <span id=Span2></span><br>
        BT Address: <span id=Span3></span><br>
        BT PINcode: <span id=Span4></span><br>
        BT Friendly Name: <span id=Span5></span><br>
        Proximity Enable: <span id=Span6></span><br>
    </BODY>
</HTML>