Hello All,
Here is a library that I wrapped for generic Android 1D/2D laser barcode scanners.
You don't need a library to use a generic Android 1D/2D hardware laser barcode scanners. To receive barcode data you can use an Intent via a Receiver Module without the need for a library, but there can be conflicts. For instance, the Camera2 library does not work while the scanner is open(on). This is because the barcode scanner module itself is classed as a camera and you can't run 2 cameras at the same time. I used the original barcode library that I've got to close(off) the barcode scanner module then I can use the Camera2 library to take photos (for example stock item images), after that I can open(on) the barcode scanner module again. Yes this can also be achieved via JavaObject, but hey
Take note: This library does not work with normal mobile phone built-in cameras, just selected Android powered 1D/2D laser barcode scanners.
Personally I only purchase and supply to my clients, barcode scanners that use the Honeywell N6602/N6603 (N660x) laser module or variants of them. According to sellers that I've interacted with, the SDK that I've used will work with some other none Honeywell laser modules, but I personally can't vouch for that. Yes generic Android powered 1D/2D laser barcode scanners cost more but the build quality (of the thicker/heftier scanners), scanning distance and the speed of scanning barcodes are clearly superior to using smartphone cameras.
B4A library tab
There are 3 files in the attached zipped library folder, place them all in your additional libraries folder.
I've changed some of the functions for simplicity purposes.
SS_GenericBarcodeScanner
Author: Peter Simpson
Version: 1.0
Below are some examples of generic Android powered 1D/2D laser barcode scanners that this library could work with (4 definitely work), plus much much more. No guarantees thought.
Enjoy...
Here is a library that I wrapped for generic Android 1D/2D laser barcode scanners.
You don't need a library to use a generic Android 1D/2D hardware laser barcode scanners. To receive barcode data you can use an Intent via a Receiver Module without the need for a library, but there can be conflicts. For instance, the Camera2 library does not work while the scanner is open(on). This is because the barcode scanner module itself is classed as a camera and you can't run 2 cameras at the same time. I used the original barcode library that I've got to close(off) the barcode scanner module then I can use the Camera2 library to take photos (for example stock item images), after that I can open(on) the barcode scanner module again. Yes this can also be achieved via JavaObject, but hey
Take note: This library does not work with normal mobile phone built-in cameras, just selected Android powered 1D/2D laser barcode scanners.
Personally I only purchase and supply to my clients, barcode scanners that use the Honeywell N6602/N6603 (N660x) laser module or variants of them. According to sellers that I've interacted with, the SDK that I've used will work with some other none Honeywell laser modules, but I personally can't vouch for that. Yes generic Android powered 1D/2D laser barcode scanners cost more but the build quality (of the thicker/heftier scanners), scanning distance and the speed of scanning barcodes are clearly superior to using smartphone cameras.
B4A library tab
There are 3 files in the attached zipped library folder, place them all in your additional libraries folder.
Some scanner functions:
BScannner.SetScanBeep(True)
BScannner.SetScanVibrate(True)
BScannner.SetIndicatorLightMode(True)
Log($"Open the scanner: ${BScannner.OpenScanner}"$) 'Laser scanner is turned on and will scan
Log($"Is scanner open: ${BScannner.IsScanOpened}"$)
Log($"Get beep state: ${BScannner.GetScanBeepState}"$)
Log($"Get vibrate state: ${BScannner.GetScanVibrateState}"$)
Log($"Get indicator light state: ${BScannner.GetIndicatorLightMode}"$)
Log($"Get broadcast mode: ${BScannner.GetOutScanMode}"$)
Log($"Get scan mode: ${BScannner.GetScanLaserMode}"$)
Log($"Scanned barcode value: ${BScannner.GetScanCodeValue}"$)
Log($"Reset the scanner: ${BScannner.ResetScan}"$)
B4A logs:
** Activity (main) Create (first time) **
Success: Scanner module found
Scanner mode: Broadcast mode
Open the scanner: true
Is scanner open: true
Get beep state: true
Get vibrate state: true
Get indicator light state: true
Get broadcast mode: Broadcast mode
Get scan mode: Single mode
Scanned barcode value: null
Reset the scanner: true
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
I've changed some of the functions for simplicity purposes.
SS_GenericBarcodeScanner
Author: Peter Simpson
Version: 1.0
- GenericBarcodeScanner
- Functions:
- CloseScanner As Boolean
Turn off the power for the scanner.
Return true if successful, false if failed. - GetIndicatorLightMode As Boolean
Get the blink indicator lamp mode.
Returns true for On or false for Off. - GetOutScanMode As String
Get the barcode output mode.
Return output mode. - GetScanBeepState As Boolean
Get the beep status.
Returns true for On or false for Off. - GetScanCodeValue As String
Get the scan data at broadcast mode.
Return only scan data, can use after scan complete.<br/>
I personally recommend using the B4A Receiver Module after scanning a barcode. - GetScanLaserMode As String
Get the laser continuous mode.
Returns continuous mode(4) or single mode(8) setting. - GetScanVibrateState As Boolean
Get the vibrate status.
Returns true for On or false for Off. - Initialize (EventName As String)
Initializes the object. - IsInitialized As Boolean
Tests whether the object was initialized. - IsScanOpened As Boolean
Get the scanner status.
Return true for open or false for closed. - OpenScanner As Boolean
Turn on the power for the scanner.
Return true if successful, false if failed. - ResetScan As Boolean
Reset the scanner.
Return true if reset successfully. - SetIndicatorLightMode (Mode As Boolean)
Blink the indicator lamp when the scan is successful.
Param mode True(On) indicator lamp, False(Off) no indicator lamp. - SetOutScanMode (Mode As Int) As Boolean
Set the barcode output mode.
Param mode value: 0 Broadcast mode, 1 Editbox Mode, 2 Keyboard Mode.
Return true if successful, false if failed. - SetScanBeep (Mode As Boolean) As Boolean
Beep when the scan is successful.
Set true for On or false for Off.
Returns true for setting successfully. - SetScanLaserMode (Mode As Boolean)
Set the laser continuous scan mode.
Param mode start continuous scan True(On), stop continuous scan False(Off). - SetScanVibrate (Mode As Boolean) As Boolean
Vibrate when the scan is successful.
Set true for On or false for Off.
Returns true for setting successfully. - StartScan As Boolean
Start decoding.
Return true if the trigger is already active. - StopScan As Boolean
Stop decoding.
Return true if stopped successfully.
- CloseScanner As Boolean
- Functions:
Below are some examples of generic Android powered 1D/2D laser barcode scanners that this library could work with (4 definitely work), plus much much more. No guarantees thought.
Enjoy...
Attachments
Last edited: