Class ScannerLibrary

Object
ScannerLibrary

public class ScannerLibrary
extends Object
The CASIO Enterprise Developer Tools Scanner Library

Since:
2.00
API Note:
The Scanner Library is bound to the calling application on application startup time automatically.
The Library's lifecycle therefore depends on the application lifecycle.
Due to the Lifecycle of Android Applications and the underlying timing, it is strongly advised not to call any Library Methods inside the onCreate method.
When the activity is being launched (and hence the process gets created), the same applies to the onStart and onResume methods.
If you need to call any Library methods at application start in one of the above mentioned methods, you should use the Callback Mechanism offered by the onLibraryReady method instead.
For instance, instead of calling ScannerLibrary.openScanner() directly in onCreate, use this code to postpone it to a Callback appropriately:
ScannerLibrary.onLibraryReady(new LibraryCallback() {
     public void onLibraryReady() {
         ScannerLibrary.openScanner();
     }
 });

Which can be simplified to:
ScannerLibrary.onLibraryReady(() -> { ScannerLibrary.openScanner(); });

Or even further to:
ScannerLibrary.onLibraryReady(ScannerLibrary::openScanner);
  • Method Summary

    Modifier and Type Method Description
    static int captureImage​(byte[] buffer)
    Capture the image.
    static int closeScanner()
    Close the barcode scanner.
    static int deinitializeStream()
    Deinitialization processing for streaming.
    static String getAPIVersion()
    Get the Scanner API version.
    static int getCenteringWindow()
    Get enable/disable of the centering window mode.
    static int getDelimiter()
    Get the delimiter for Package scan.
    static int getDetectionAreaSize()
    Get the size of barcode detection area for the centering window mode.
    static int getImageDataSize()
    Get the size of the data required for capturing image.
    static int getInternalParameter​(int tag)
    Get internal parameters.
    static int getInternalParameter​(int[] tags, int[] values)
    Get internal parameters.
    static int getInverseMode()
    Get the inverse barcode reading mode.
    static int getLaserHighlightMode()
    Get enable/disable of the laser highlight mode of 1D scanner.
    static int getLaserSwingWidth()
    Get the laser swing width of 1D scanner.
    static int getLightMode()
    Get the light mode.
    static String getModuleVersion()
    Get the Scanner module version.
    static int getNotificationLED()
    Get the behavior of the notification LED.
    static int getNotificationSound()
    Get the behavior of the notification sound.
    static int getNotificationVibrator()
    Get the behavior of the notification vibrator.
    static int getNumberOfBarcodes()
    Get the number of barcodes to be scanned in Multi-step scan or Package scan.
    static int getOutputType()
    Get the output type of the scan result.
    static int getScannerAPO()
    Get the Auto Power Off(APO) time of the barcode scanner.
    static int getScanResult​(ScanResult scanResult)
    Get the last Scan Result.
    static int getStreamDataSize()
    Get the size of data required for streaming.
    static int getStreamDataSize​(Rect rectangle, int resolution)
    Get the size of data required for streaming.
    static int getSuffix()
    Get the suffix type added at the end of the scan result.
    static int getSymbologyCheckCount​(int symbologyID)
    Get the value of check count of the specified barcode.
    static int getSymbologyEnable​(int symbologyID)
    Get reading enable/disable of the specified barcode.
    static int getSymbologyMax​(int symbologyID)
    Get the reading maximum number of digits of the specified barcode.
    static int getSymbologyMaxDefault​(int symbologyID)
    Get the default reading maximum number of digits of the specified barcode.
    static int getSymbologyMin​(int symbologyID)
    Get the reading minimum number of digits of the specified barcode.
    static int getSymbologyMinDefault​(int symbologyID)
    Get the default reading minimum number of digits of the specified barcode.
    static int getSymbologyProperty​(int symbologyID, int propertyNo)
    Get the value of property setting of the specified barcode.
    static int getTriggerKeyEnable()
    Get the Trigger key enable/disable.
    static int getTriggerKeyMode()
    Get the Trigger key mode.
    static int getTriggerKeyTimeout()
    Get the Trigger key timeout.
    static int initializeStream​(Rect rectangle, int resolution)
    Initialization processing for streaming.
    static boolean isMethodSupported​(String methodName)
    Check whether the Method indicated by the String methodName parameter is supported on the currently active device
    static boolean isMethodSupported​(BigInteger method)
    Check whether the Method indicated by the BigInteger method parameter is supported on the currently active device
    static boolean isScannerOpen()
    Check the barcode scanner is opened.
    static void onLibraryReady​(LibraryCallback callback)
    Add a new Callback to the Queue of Callbacks to be processed once the Scanner becomes available
    static int openScanner()
    Open the barcode scanner.
    static int readStream​(byte[] buffer)
    Read the stream data.
    static int setCenteringWindow​(int centeringWindow)
    Set enable/disable of the centering window mode.
    static int setDefaultAll()
    Return all barcode scanner settings to default.
    static int setDelimiter​(int delimiter)
    Set the delimiter for Package scan.
    static int setDetectionAreaSize​(int detectionAreaSize)
    Set the size of barcode detection area for the centering window mode.
    static int setInternalParameter​(byte[] command)
    Set internal parameters.
    static int setInternalParameter​(int tag, int value)
    Set internal parameters.
    static int setInternalParameter​(int number, int[] tags, int[] values)
    Set internal parameters.
    static int setInverseMode​(int inverseMode)
    Set the inverse barcode reading mode.
    static int setLaserHighlightMode​(int enable)
    Set enable/disable of the laser highlight mode of 1D scanner.
    static int setLaserSwingWidth​(int laserSwingWidth)
    Set the laser swing width of 1D scanner.
    static int setLightMode​(int lightMode)
    Set the light mode.
    static int setNotificationLED​(int led)
    Set the behavior of the notification LED.
    static int setNotificationSound​(int sound)
    Set the behavior of the notification sound.
    static int setNotificationVibrator​(int vibrator)
    Set the behavior of the notification vibrator.
    static int setNumberOfBarcodes​(int numberOfBarcodes)
    Set the number of Barcodes to be scanned in Multi-step scan or Package scan.
    static int setOutputType​(int outputType)
    Set the output type of the scan result.
    static int setScannerAPO​(int scannerAPOTime)
    Set the Auto Power Off(APO) time of the barcode scanner.
    static int setSuffix​(int suffix)
    Set the suffix type added at the end of the scan result.
    static int setSymbologyCheckCount​(int symbologyID, int checkCount)
    Set the value of check count of the specified barcode.
    static int setSymbologyEnable​(int symbologyID, int enable)
    Set reading enable/disable of the specified barcode.
    static int setSymbologyMax​(int symbologyID, int max)
    Set the reading maximum number of digits of the specified barcode.
    static int setSymbologyMin​(int symbologyID, int min)
    Set the reading minimum number of digits of the specified barcode.
    static int setSymbologyProperty​(int symbologyID, int propertyNo, int propertySetting)
    Set the value of property setting of the specified barcode.
    static int setTriggerKeyEnable​(int triggerKeyEnable)
    Set the Trigger key enable/disable.
    static int setTriggerKeyMode​(int triggerKeyMode)
    Set the Trigger key mode.
    static int setTriggerKeyOn​(int triggerKeyOn)
    Control the behavior of trigger key by software.
    static int setTriggerKeyTimeout​(int triggerKeyTimeout)
    Set the Trigger key timeout.
    static int startStream()
    Start streaming.
    static int stopStream()
    Stop streaming.
    static int turnAimerOn​(int aimerOn)
    Control the behavior of the aimer by software.
    static int turnIlluminationOn​(int illuminationOn)
    Control the behavior of the illumination by software.