Skip to main content

Classes

The following classes are required for the SDK.

ClassesDescription
DatalogicDeviceManagerManages the connected Datalogic Scanner.
DatalogicDeviceStands for the Datalogic Scanner. It contains the Datalogic Scanner details and all the functions to interact with it.
DatalogicBluetoothDeviceStands for the Datalogic Bluetooth Scanner. It contains the Datalogic Bluetooth Scanner details and all the functions to interact with it.
UsbScanData(

val rawData: ByteArray,

val barcodeData: String,

val barcodeType: String

)

Data class passed by onScan to retrieve scanned data from the USB Scanner.
ScaleData(

val status: String,

val weight: String,

val unit: ScaleUnit

)

Data class passed by onScale to retrieve scale data from the USB Scanner.

DatalogicDeviceManager

Management class for the Datalogic Scanner device. Used to detect USB Scanner Devices and register scanner events. USB permission is required to communicate with USB devices.

Public MethodsDescription
ArrayList < DatalogicDevice > detectDevice(context: Context)Gets the connected devices list and prepares the DatalogicDevice based on the product Id. Returns the connected device list of ArrayList < DatalogicDevice >.
Int registerUsbListener(listener: UsbListener)Registers a listener for USB Events to notify when the USB Scanner connected or disconnected.
Int unregisterUsbListener(listener: UsbListener)Unregisters a listener for USB Events.
Int registerStatusListener(listener: StatusListener)Registers a listener for device Status Changes.
Int unregisterStatusListener(listener: StatusListener)Unregistered listeners for Status event.
Bitmap qrCodeGenerator(context: Context, bluetoothProfile: BluetoothProfile)Generates the barcode image to pair the Bluetooth device. Read this barcode with the scanner to pair it to the Android device via Bluetooth connection.
scanBluetoothDevices(context: Activity, onComplete: (BluetoothPairingData) -> Unit)Start scanning the Bluetooth scanner device (that has scanned the barcode from qrCodeGenerator) to pair it. The pair result is returned on BluetoothPairingData.
stopScanBluetoothDevices(context: Context)Reset the Bluetooth device scanning configuration. You can use it before executing scanBluetoothDevices to make sure that all the settings are set to default.
getAllBluetoothDevice(context: Context, onComplete: (ArrayList < BluetoothDevice >) -> Unit)Gets all the current Bluetooth devices. The Bluetooth devices are returned in (ArrayList< BluetoothDevice >). Note: it includes not only the Datalogic Scanner device but all the Bluetooth devices.

DatalogicDevice

Stands for the Datalogic Scanner. It contains the Datalogic Scanner details and all the functions to interact with it.

Public MethodsDescription
Int openDevice(context: Context)This method opens a connection to the specified DatalogicDevice, allowing for communication with the device’s endpoints. Return 0 if the interface was successfully opened, -1 otherwise.
Int closeDevice()Close the DatalogicDevice.
Int registerUsbScanListener(listener: UsbScanListener)Register listener for USB scan event to be notified when the Scanner scans the barcodes.
Int unregisterUsbScanListener(listener: UsbScanListener)Unregister listeners for Scan event.
Int registerUsbDioListener(listener: UsbDioListener)Register listener for Usb dio event to be notified when the Dio Commands get failed.
Int unregisterUsbDioListener(listener: UsbDioListener)Unregistered listeners for dio error event.
String dioCommand (device: UsbDeviceDescriptor, commandType: DIOCmdValue,cmd: String, context: Context)Function to execute the DIO Commands and return status value (Command type and valid command value should be correct for output).
HashMap < ConfigurationFeature, String > readConfig(device: UsbDeviceDescriptor, context: Context)Function to execute the read config Commands.
HashMap < ConfigurationFeature, String > writeConfig(type: String, data: HashMap < ConfigurationFeature, String > )Function to execute the write config Commands.
ByteArray imageCaptureAuto(currentBrightness, currentContrast)Function to capture image. The parameter currentBrightness and currentContrast only is applied for HHS device.
Boolean startScale()Start to receive scale data.
Boolean stopScale()Stop to receive scale data.
Boolean isScaleAvailable()Check if this device is a supported scale or not.
String getCustomConfiguration()Gets all the current configurations on the device.
ConfigurationResult writeCustomConfiguration(configStr: String)Write all the configurations in configStr into the device.
Boolean upgradeFirmware(file: File, fileType: String, context: Context, resetCallback: () -> Unit, progressCallback: (Int) -> Unit, isBulkTransfer: Boolean)Upgrade the device firmware.
- file: Path to the firmware file on local folder
- fileType: can be “DFW”, “SWU”, “S37”
- isBulkTransfer: set to “true” to use Bulk Transfer protocol to speed up firmware upgrade. Only support “S37” on Magellan 9600i, 900i, 9550i.

DatalogicBluetoothDevice

Stands for the Datalogic Bluetooth Scanner. It contains the Datalogic Bluetooth Scanner details and all the functions to interact with it.

Public MethodsDescription
DatalogicBluetoothDevice(bluetoothDevice: BluetoothDevice, bluetoothProfile: BluetoothProfile, hostType: HostType)Creates the Bluetooth SPP scanner:
DatalogicBluetoothDevice(device, BluetoothProfile.SPP, HostType.Unconfigured).
connectDevice(serialListener: UsbScanListener, context: Activity, onComplete: (BluetoothPairingStatus) -> Unit)Connects the Bluetooth scanner.
clearConnection(context: Context)Disconnects the Bluetooth scanner.

UsbScanData

Data class containing the data of a scanned code. Can retrieve barcode data either as a String or an array if bytes.

Public PropertiesDescription
byte[] rawDataGets the barcode data as an array of bytes.
String barcodeDataGets the barcode data as a String.
String barcodeTypeGets the barcode ID as a String.