GoranHalvarsson / BarcodeReader-MonoTouch

A barcode reader
22 stars 10 forks source link

Won't scan #3

Closed joehanna closed 8 years ago

joehanna commented 12 years ago

Hi,

I am trying to make this work on an iPad 2 and iPad 3, both running iOS 5.1 and after the application fires up, it simply won't recognise the barcode, no matter how clear or close it is. Occasionally, it will crash the app.

I tried debugging the app to see if the BarCodeEvent fires but it doesn't.

Can you help?

Many thanks in advance Joe

AlexanderViken commented 12 years ago

Hi. I tried to get this app working on my iPhone 4s and found that it's the "scanning area" that is the problem....

it's defined in CameraOverLayView.cs:58 private static RectangleF picFrame = new RectangleF(0, 146, 320, 157);

Then in the Worker() method of CameraOverLayView.cs:131 there's a check for hardware version of iPhone 4 to handle retina display.

if(DeviceHardware.Version == DeviceHardware.HardwareVersion.iPhone4) { picFrame = new RectangleF(0, 146_2, 320_2, 157*2); }

The hardware version is defined in the class DeviceHardware.cs and the getter of the property "Version".

If you look at the if/else if/else section that begins in DeviceHardware.cs:76 the 4s isn't defined (should have hardwareStr == "iPhone4,1") neither is the new iPad (iPad3)

The iPhone 4s and iPad2 doesn't scan because the scan area is too small. increase the pictFrame variable and i guess it will work.

The reader in the test app is defined as com.google.zxing.oned.MultiFormatOneDReader so it will only read 1D barcodes (Like EAN13) if you want it to read QR Codes redefine the _multiFormatOneReader to a com.google.zxing.qrcode.QRCodeReader (CameraOverLayView.cs line 57 and 149.)

Hope this helps.

dj-technohead commented 12 years ago

I've made a fork of this repository (https://github.com/dj-technohead/BarcodeReader-MonoTouch), and made some changes to handle iPhone 4s and iPad's without relying on hard coding of device. I don't have an iPad with camera, so the scaling factors will probably need to be modified if running on iPad at the device's native resolution. This probably should be pulled back into the base repository, sorry, I'm a GitHub n00b.