Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

Rsm Module

The Rsm Module is used to configure or to retrieve attributes relating to a remote scanner either tethered to the device or connected via Bluetooth. The properties of the scanner which can be configured are detailed in the ‘Remarks’ section. When used for retrieval navigation to URL or call to JavaScript function happens immediately.

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)';

For more details on the event syntax and parameters see the Retrieval Events page.
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");
Rsm Ruby Object Syntax:
By default the Ruby Object 'Rsm' will exist on the current page and can be used to interact directly with the Rsm. All Methods, Parameters and Events are the same as JavaScript, however, notice 'Rsm' needs to start with an uppercase letter. Another difference in Ruby is that methods do not end in '()'
To Invoke Rsm methods via Ruby use the following syntax: Rsm.method()

e.g. Rsm.markForRetrievalModelNumber
To Set Rsm parameters via Ruby 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 Ruby use the following syntax: Rsm.event = url_for(:action => :event_callback)

e.g. Rsm.rsmGetEvent = url_for(:action => :rsm_event_callback)

For more details on the event syntax and parameters see the Retrieval Events page.

To access the event parameters in a Ruby callback function, you reference the @params object within the callback function. This object is simply a ruby hash {"parameter1 name" => "parameter1 value", "parameter2 name" => "parameter2 value", ...}

Methods

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

Name Description Default 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
markForRetrievalBluetoothReconnectAttempts Marks 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
bluetoothDisconnect Instructs the Bluetooth scanner to disconnect from its associated device. Device Dependant
bluetoothUnpair Instructs the bluetooth scanner to unpair from its associated device. Allows the scanner to be associated with a different device Device Dependant

Parameters

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

Name Possible Values Description Default Value
bluetoothAuthentication:[Value] See Remarks Sets the BluetoothAuthentication of the connected BT Scanner to the stated value. Device Dependant
bluetoothEncryption:[Value] See Remarks Sets the BluetoothEncryption of the connected BT Scanner to the stated value. Device Dependant
bluetoothPinCode:[Value] See Remarks Sets the BluetoothPINCode of the connected BT Scanner to the stated value. Device Dependant
bluetoothPinCodeType:[Value] See Remarks Sets the BluetoothPINCodeType of the connected BT Scanner to the stated value. Device Dependant
bluetoothReconnectAttempts:[Value] See Remarks Sets the BluetoothReconnectAttempts of the connected BT Scanner to the stated value. Device Dependant
bluetoothBeepOnReconnectAttempt:[Value] See Remarks Sets the BluetoothBeepOnReconnectAttempt of the connected BT Scanner to the stated value. Device Dependant
bluetoothHidAutoReconnect:[Value] See Remarks Sets the BluetoothHIDAutoReconnect of the connected BT Scanner to the stated value. Device Dependant
bluetoothFriendlyName:[Value] See Remarks Sets the BluetoothFriendlyName of the connected BT Scanner to the stated value. Device Dependant
bluetoothInquiryMode:[Value] See Remarks Sets the BluetoothInquiryMode of the connected BT Scanner to the stated value. Device Dependant
bluetoothAutoReconnect:[Value] See Remarks Sets the BluetoothAutoReconnect of the connected BT Scanner to the stated value. Device Dependant
forceSavePairingBarcode:[Value] See Remarks Sets the ForceSavePairingBarcode of the connected BT Scanner to the stated value. Device Dependant
lowBatteryIndication:[Value] See Remarks Sets the LowBatteryIndication of the connected BT Scanner to the stated value. Device Dependant
lowBatteryIndicationCycle:[Value] See Remarks Sets the LowBatteryIndicationCycle of the connected BT Scanner to the stated value. Device Dependant
scanLineWidth:[Value] See Remarks Sets the ScanLineWidth of the connected BT Scanner to the stated value. Device Dependant
goodScansDelay:[Value] See Remarks Sets the GoodScansDelay of the connected BT Scanner to the stated value. Device Dependant
decodeFeedback:[Value] See Remarks Sets the DecodeFeedback of the connected BT Scanner to the stated value. Device Dependant
ignoreCode128Usps:[Value] See Remarks Sets the IgnoreCode128USPS of the connected BT Scanner to the stated value. Device Dependant
scanTriggerWakeup:[Value] See Remarks Sets the ScanTriggerWakeup of the connected BT Scanner to the stated value. Device Dependant
mems:[Value] See Remarks Sets the Mems of the connected BT Scanner to the stated value. See remarks Device Dependant
proximityEnable:[Value] See Remarks Sets the ProximityEnable of the connected BT Scanner to the stated value. See remarks. Device Dependant
proximityContinuous:[Value] See Remarks Sets the ProximityContinuous of the connected BT Scanner to the stated value. Device Dependant
proximityDistance:[Value] See Remarks Sets the ProximityDistance of the connected BT Scanner to the stated value. Device Dependant
pagingEnable:[Value] See Remarks Sets the PagingEnable of the connected BT Scanner to the stated value. Device Dependant
pagingBeepSequence:[Value] See Remarks Sets the PagingBeepSequence of the connected BT Scanner to the stated value. Device Dependant
pagingActivate:[Value] See Remarks Sets 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

ID Name Description
1 attributeArray Array 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 Version 1.0.0 or above
Supported Devices All supported devices that have the ability to connect to remote scanners.
Minimum Requirements This tag requires appropriate hardware to run, i.e. a remote scanner and a device which supports it.
Persistence Transient - 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>
Back to Top