How to: manage the JoyaTouch AutoScan Trigger through Datalogic Android SDK

Datalogic JoyaTouch devices are equipped with a proximity sensor and a control software that enables the ScanEngine to activate automatically when an object approaches.
This feature is called Auto Scan Trigger, and can be configured from the device settings menu Settings / Datalogic Settings / Keyboard & Triggers / Triggers / Auto Scan Trigger (Pic.1) , or via configuration SW like Datalogic Scan2Deploy or other MDMs (Pic.2)


(Picture 1)


(Picture 2)

The Auto Scan Trigger feature also allows you to configure the sensitivity of the sensor (Auto Scan Trigger Range) to trigger the scanner when the code label is more or less distant. Available values are Near, Intermediate and Far.

The applications that need to enable or configure the Auto Scan Trigger option at runtime, can do it through the com.datalogic.device.input.KeyboardManager, Trigger and AutoScanTrigger interfaces of the Datalogic Android SDK.

To enable/disable the AutoScan Trigger, you have to:

  1. Create an instance of the KeyboardManager class;
  2. Obtain the list of available triggers on the device using the getAvailableTriggers() method;
  3. Inside the list search for the Trigger identified by the VSCAN_AUTOSCAN_TRIGGER enum;
  4. finally use the setEnable(bool) method to enable or disable the AutoTrigger.

To set the range of the AutoScan trigger, you have to:

  1. Convert the object that implements the Trigger interface to an object that implements the AutoScanTrigger interface;
  2. Use the getSupportedRanges() method to get the list of AutoScanTrigger.Range supported in the device.
  3. Find the AutoScanTrigger.Range instance with the desired name (e.g. Near, Intermediate, Far…) in the list.
  4. Use the setCurrentRange() method of the AutoScanTrigger interface with the previously found Trigger object to apply the new AutoScanTrigger’s Range.

The code snippet below implements the logic:

KeyboardManager km  = new KeyboardManager() ;

List<Trigger> lt=km.getAvailableTriggers();
for (Trigger tr: lt){
    if(tr.getId() == KeyboardManager.TRIGGER_ID_AUTOSCAN ){
        AutoScanTrigger as = (AutoScanTrigger) tr;
                
        //Enable the AutoScanTrigger option
        as.setEnabled(true);

        //Set the Auto Scan Trigger's Range to “near”
        for(AutoScanTrigger.Range r: as.getSupportedRanges()){
            if(r.getName().equalsIgnoreCase("Near")){
               as.setCurrentRange(r);
            }
        }
    }
}

Simone Callegari
Datalogic Mobile Products Specialist - L3 SW Engineer

1 Like