Created
September 30, 2021 02:24
-
-
Save sproctor/1395589d9a6697b885ce3f394a2318fd to your computer and use it in GitHub Desktop.
Set scanner listener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LaunchedEffect(Unit) { | |
// Set scanner/barcode listener | |
sdkHandler.dcssdkSetDelegate(object : IDcsSdkApiDelegate { | |
override fun dcssdkEventBarcode( | |
barcodeData: ByteArray?, | |
barcodeType: Int, | |
scannerId: Int | |
) { | |
// handle the barcode | |
} | |
override fun dcssdkEventCommunicationSessionEstablished(scanner: DCSScannerInfo?) { | |
// handle scanner connect | |
} | |
override fun dcssdkEventCommunicationSessionTerminated(scannerId: Int) { | |
// handle scanner disconnect | |
} | |
// ... | |
}) | |
// Tell the SDK what we want to listen for | |
sdkHandler.dcssdkSubsribeForEvents( | |
DCSSDKDefs.DCSSDK_EVENT.DCSSDK_EVENT_BARCODE.value // for barcodes | |
or DCSSDKDefs.DCSSDK_EVENT.DCSSDK_EVENT_SESSION_ESTABLISHMENT.value // notice when a scanner connects | |
or DCSSDKDefs.DCSSDK_EVENT.DCSSDK_EVENT_SESSION_TERMINATION.value // notice when a scanner disconnects | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment