Package com.gmv.its.deepsy.hal.ise

Classes

enum  ConfigBrightness
 
enum  ConfigDetectMode
 
enum  ConfigIllumination
 
enum  ConfigImageRotation
 
enum  ConfigReadMode
 
enum  ConfigSenseMode
 
interface  ImagerScanEngine
 ImagerScanEngine. More...
 
interface  ImagerScanEngineEvent
 ImagerScanEngine event. More...
 
interface  ImagerScanEngineListEvent
 ImagerScanEngineListEvent Event. More...
 
interface  ImagerScanEngineListObserver
 Imager scan engine list observer. More...
 
class  ImagerScanEngineLowLevelException
 ImagerScanEngine low level exception. More...
 
interface  ImagerScanEngineManager
 ImagerScanEngine manager. More...
 
interface  ImagerScanEngineNewCodeEvent
 
class  ImagerScanEngineNotAvailableException
 ImagerScanEngine not available exception. More...
 
interface  ImagerScanEngineObserver
 
class  ImagerScanEngineStatusEvent
 ImagerScanEngine status change event. More...
 

Detailed Description

To work with Deepsy imager scan engine service it is necessary to use DeepsyImagerScanEngineManager located in com.gmv.its.deepsy.ise for getting the initial ImagerScanEngineManager object.

ImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager.getInstance();


DeepsyImagerScanEngineManager.getInstance has an optional parameter indicating the ip address of remote service. For instance:

ImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager.getInstance("192.168.1.10");


DeepsyImagerScanEngineManager is an AutoCloseable interface. An object that may hold resources (such as file or socket handles) until it is closed. The close() method of an AutoCloseable object is called automatically when exiting a try-with-resources block for which the object has been declared in the resource specification header. This construction ensures prompt release, avoiding resource exhaustion exceptions and errors that may otherwise occur. To obtain ImagerScanEngine objects:

try (DeepsyImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager.getInstance("192.168.1.10")){
List<ImagerScanEngine> imagerScanEnginesList = imagerScanEngineManager.getImagerScanEngines();
} catch (ImagerScanEngineNotAvailableException e) {
e.printStackTrace();
} catch (ImagerScanEngineLowLevelException e) {
e.printStackTrace();
}


If this object is not inside a try with resources block, it is recommended to call to imagerScanEngineManager.close() in order to finalize properly;

imagerScanEngineManager.close();


Service availability

To detect service availability the DeepsyImagerScanEngineManager implements Manager interface which provides methods for getting availability and subscribing to availability events.

class MyManagerObserver implements ManagerObserver{
public void notify(ManagerConnectionEvent event) {
System.out.println(event.getManager().getName() + " in "+ event.getManager().getIp() + " "+ event.getAction().toString());
}
}
public class App {
public static void main(String[] args) {
ManagerObserver observer = new MyManagerObserver();
try (DeepsyImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager.getInstance()){
imagerScanEngineManager.subscribe(observer);
} catch (CannotSubscribeException e1) {
e1.printStackTrace();
}
}
}


Examples

  • Getting available imager scan engines
    For getting available imager scan engines it is necessary to call to getImagerScanEngines method of ImagerScanEngineManager.

    import java.util.List;
    import com.gmv.its.deepsy.hal.ise.*;
    import com.gmv.its.deepsy.ise.DeepsyImagerScanEngineManager;
    public class App {
    public static void main(String[] args) {
    try (DeepsyImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager.getInstance("192.168.1.10")) {
    List<ImagerScanEngine> imagerScanEngineList = imagerScanEngineManager.getImagerScanEngines();
    } catch (ImagerScanEngineNotAvailableException e) {
    e.printStackTrace();
    } catch (ImagerScanEngineLowLevelException e) {
    e.printStackTrace();
    }
    }
    }


  • Set and Get Imager scan engine configuration
    Getting configurations functionality is provided by getConfig methods.

    • ImagerScanEngine.getConfigBrightness
    • ImagerScanEngine.getConfigIllumination
    • ImagerScanEngine.getConfigImageRotation
    • ImagerScanEngine.getConfigReadMode

  • Set imager scan engine configuration
    Setting configurations functionality is provided by setConfig methods.

    • ImagerScanEngine.setConfigBrightness
    • ImagerScanEngine.setConfigIllumination
    • ImagerScanEngine.setConfigImageRotation
    • ImagerScanEngine.setConfigReadMode
    package com.gmv.its.dpyjavaexamples.ise;
    import java.util.List;
    import com.gmv.its.deepsy.hal.ise.*;
    import com.gmv.its.deepsy.ise.DeepsyImagerScanEngineManager;
    public class setGetConfigurationApp {
    public static void main(String[] args) {
    try (DeepsyImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager
    .getInstance("192.168.0.84")) {
    List<ImagerScanEngine> imagerScanEnginesList = imagerScanEngineManager.getImagerScanEngines();
    System.out.println("There are " + imagerScanEnginesList.size() + " imager scan engines.");
    for (ImagerScanEngine scanner : imagerScanEnginesList) {
    scanner.setConfigBrightness(ConfigBrightness.STANDARD);
    scanner.setConfigIllumination(ConfigIllumination.ENABLE);
    scanner.setConfigImageRotation(ConfigImageRotation.NONE);
    scanner.setConfigReadMode(ConfigReadMode.AUTOTRIGGER);
    scanner.setConfigRereadTimeout(1000);
    }
    for (ImagerScanEngine scanner : imagerScanEnginesList) {
    System.out.println("Scanner configuration: ");
    System.out.println("Brightness: " + scanner.getConfigBrightness().name());
    System.out.println("Illumination: " + scanner.getConfigIllumination().name());
    System.out.println("ImageRotation: " + scanner.getConfigImageRotation().name());
    System.out.println("ReadMode: " + scanner.getConfigReadMode().name());
    System.out.println("RereadTimeout: " + scanner.getConfigRereadTimeout());
    }
    } catch (ImagerScanEngineNotAvailableException e) {
    e.printStackTrace();
    } catch (ImagerScanEngineLowLevelException e) {
    e.printStackTrace();
    }
    }
    }


  • Subscribe to events
    There are 3 types of events in the imager scan engine system:

    This example subscribes to every event.

    package com.gmv.its.dpyjavaexamples.ise;
    import java.util.List;
    import com.gmv.its.deepsy.hal.ise.*;
    import com.gmv.its.deepsy.ise.DeepsyImagerScanEngineManager;
    class MyImagerScanEngineListObserver implements ImagerScanEngineListObserver {
    public void notify(ImagerScanEngineListEvent event) {
    System.out.println("Imager scan engine " + event.getAction().name());
    }
    }
    class MyImagerScanEngineObserver implements ImagerScanEngineObserver {
    public void notify(ImagerScanEngineEvent event) {
    if (event instanceof ImagerScanEngineNewCodeEvent) {
    System.out.println("New code: " + ((ImagerScanEngineNewCodeEvent) event).getCode());
    } else if (event instanceof ImagerScanEngineStatusEvent) {
    System.out.println("New Status: " + ((ImagerScanEngineStatusEvent) event).getStatus().name());
    }
    }
    }
    public class ImagerScanEngineEventsApp {
    public static void main(String[] args) {
    try (DeepsyImagerScanEngineManager imagerScanEngineManager = DeepsyImagerScanEngineManager.getInstance("192.168.0.144")) {
    imagerScanEngineManager.subscribe(new MyImagerScanEngineListObserver());
    List<ImagerScanEngine> imagerScanEnginesList = imagerScanEngineManager.getImagerScanEngines();
    System.out.println("There are " + imagerScanEnginesList.size() + " imager scan engines.");
    for (ImagerScanEngine scanner : imagerScanEnginesList) {
    scanner.subscribe(new MyImagerScanEngineObserver());
    }
    Thread.sleep(10000);
    } catch (ImagerScanEngineNotAvailableException e) {
    e.printStackTrace();
    } catch (ImagerScanEngineLowLevelException e) {
    e.printStackTrace();
    } catch (CannotSubscribeException e) {
    e.printStackTrace();
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    }
    }