B4i Library iBarcode library

Status
Not open for further replies.
This library allows you to use the device camera to scan for all kinds of barcodes.
It is based on this open source project: https://github.com/mikebuss/MTBBarcodeScanner
License: https://github.com/mikebuss/MTBBarcodeScanner/blob/master/LICENSE

The attached example demonstrates how to use this library.
The main steps are:
1. Initialize the BarcodeScanner and set the preview panel.
2. In the panel resize event call scanner.Resize to resize the preview layer when needed.
3. The ready event will be raised when the scanner is ready. If Success is true then you can start scanning.
4. Call scanner.Start to start scanning.
5. The Detected event will be raised when a code is detected.



Edit: You need to add this line to the example:
B4X:
#PlistExtra:<key>NSCameraUsageDescription</key><string>Read barcodes</string>
 

Attachments

  • BarcodeExample.zip
    2.6 KB · Views: 513
Last edited:

jo1234

Active Member
Licensed User
Longtime User
Hi Erel,

unfortunately, the iBarcode lib (and iOS7/8) does not support barcodes in "Interleaved 2 of 5" format, which are absolutely essential for my app.

Please make also an Barcode library that is based on
http://zbar.sourceforge.net/

ZBar is an open source software. It supports many popular symbologies (types of bar codes) including EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code. ZBar is licensed under the GNU LGPL 2.1 to enable development of both open source and commercial projects.

I tested their app on a iPhone 6 and it is quick and reliable.

Please make this a B4i library, because otherwise I'm really stuck.

Thanks a lot!
John
 

jo1234

Active Member
Licensed User
Longtime User
Hi,

the scanning is quite slow, mostly because of the autofocus.
It could help to restrict the autoFocusRangeRestriction to AVCaptureAutoFocusRangeRestrictionNear.

I found this code on http://stackoverflow.com/questions/15782083/set-an-initial-focal-distance-on-ios

B4X:
AVCaptureDevice *cameraDevice = zbarReaderView.device;
if ([cameraDevice respondsToSelector:@selector(isAutoFocusRangeRestrictionSupported)] && cameraDevice.autoFocusRangeRestrictionSupported) {
  // If we are on an iOS version that supports AutoFocusRangeRestriction and the device supports it
  // Set the focus range to "near"
  if ([cameraDevice lockForConfiguration:nil]) {
  cameraDevice.autoFocusRangeRestriction = AVCaptureAutoFocusRangeRestrictionNear;
  [cameraDevice unlockForConfiguration];
  }
}

How can I use this in B4i with the iBarcode library?

Thanks a lot!
 

little3399

Active Member
Licensed User
Longtime User
Hi, Erel
When I compile the demo success , and install on my iPhone5 , but it happen "flash back" .... suddenly close one application by accident and jump to the main menu
 

little3399

Active Member
Licensed User
Longtime User
Hi, Erel,

Yes ,the progrma was crash , where I can find the logs ? need help , tks!
 

jaraiza

Active Member
Licensed User
Longtime User
Check the Logs tab in the IDE.

Hi,

Does the entire library require iOS 8? I'm also having the crash (iPad Air) and there's nothing in log Window...

I took a video (is unlisted, you need the link to see it)


 

jaraiza

Active Member
Licensed User
Longtime User
Can you upload your project?
Hi!

Is the example you posted, "BarcodeExample.zip", I haven't added it to my project because the example doesn't work for me. I'm using the library 1.02.

I'm sorry I don't have more clues for you :(

WnQggcw.png


Thanks!
 

jaraiza

Active Member
Licensed User
Longtime User
Does it happen if you comment the scanner.Initialize line?
Yep, I've just tested and it does the same... But I've noticed something really weird, I put a debugger break on the first line "NavControl = Nav" but the bridge never get there o_O

I commented "Private scanner As BarcodeScanner" just in case, but it stills don't enter "Application_Start" Sub.

Ok, the problem is the library itself, I've just deactivated it and the debugger enters Application Start Sub o_O

Greets!
 

jaraiza

Active Member
Licensed User
Longtime User
P.D.

Just in case, I haven't updated the iPad, it still has iOS 7.1.2
 
Status
Not open for further replies.
Top