Skip to main content

Interfaces

The SDK will have a series of interfaces that expose abstract methods that can be overwritten by the user to receive callbacks to events. Examples of other similar interfaces can be found in the existing Datalogic USB SDK here: (https://datalogic.github.io/android-sdk-docs/reference/com/datalogic/decode/package-summary.html).

InterfacesDescription
UsbListenerFor listening to USB Scanner device connection events (connected or disconnected).
UsbScanListenerFor listening to USB Scan events.
StatusListenerFor listening to when a device status get changed.
UsbDioListenerFor listening to when a DIO Commands get execute.
UsbScaleListenerFor listening to USB scale events that will return the scale data.

UsbListener

Interface with an abstract method that is triggered when a USB Scanner device is connected or disconnected with the mobile device.

Public Abstract MethodsDescription
void onDeviceAttachedListener()Called when a USB Scanner connection event is fired.
void onDeviceDetachedListener()Called when a USB Scanner disconnection event is fired.

UsbScanListener

Interface with a single abstract method that is triggered when a USB Scanner device scans a barcode.

Public Abstract MethodsDescription
fun onScan(scanData: UsbScanData)Called when a USB Scanner scan event is fired. Receives ScanData of the scanned barcode as an argument.

StatusListener

Interface with abstract method that is triggered when a when a device status get changed.

Public Abstract MethodsDescription
fun onStatus(productId:String, status: DeviceStatus)Called when a USB device status event is fired.
fun onError(errorStatus : Int)Function called when error occurred.

UsbDioListener

Interface with abstract method that is triggered when a DIO Commands get failed.

Public Abstract MethodsDescription
fun fireDioErrorEvent(errorCode: Int, message: String)Called when a DIO Commands get failed.

UsbScaleListener

Interface with a single abstract method that is triggered when a USB Scanner device returns the scale value.

Public Abstract MethodsDescription
fun onScale(scaleData: ScaleData)Called when a USB Scanner scale event is fired. Receives ScaleData of the scale data as an argument.