B4A Library ZXing Glass Library

ZXinLib.jpg


This library was create to use cameras with not default properties, like Google Glass, some Nexus, Smartwatches, etc

This is a modify version of ZXING and version of user IceFair333 (https://github.com/zxing/zxing)

I create this version because the image of camera in Google Glass with original Zxing/Icefair333 version show scrambled. (Tested on XE16 and XE17)


Simple Sample to work with Google Glass:



Dim zx As ZXingGlass
zx.EnableJavaLog = True
zx.CameraAngle = 0
zx.useFrontCam = False
zx.PreviewWidth = 640
zx.PreviewHeight = 360
zx.FPSMin = 30000
zx.FPSMax = 30000
zx.BeginScan("myzx")




Properties you can use to scan and create the barcodes

* Property: CameraAngle()
* Description: Set rotation to "n" degrees in camera
* Sample:
* Dim zx As ZXing
* zx.GlassCameraAngle = 90


* Property: useFrontCam()
* Description: Force use the Frontal Camera
* Sample:
* Dim zx As ZXing
* zx.useFrontCam = True


* Property: PreviewWidth()
* Description: Set Width of preview image
* Obs: Use EnableJavaLog = True to view all values of your camera
* Sample:
* Dim zx As ZXing
* zx.PreviewWidth = 640
* zx.PreviewWidth = 480


* Property: PreviewHeight()
* Description: Set Height of preview image
* Obs: Use EnableJavaLog = True to view all values of your camera
* Sample:
* Dim zx As ZXing
* zx.PreviewWidth = 640
* zx.PreviewWidth = 480


* Property: FPSMin()
* Description: Set Min Valiue to Frames Per Second of your camera
* Obs: Use EnableJavaLog = True to view all values of your camera
* Sample:
* Dim zx As ZXing
* zx.FPSMin = 10000
* zx.FPSMax = 30000


* Property: FPSMax()
* Description: Set Max Valiue to Frames Per Second of your camera
* Obs: Use EnableJavaLog = True to view all values of your camera
* Sample:
* Dim zx As ZXing
* zx.FPSMin = 10000
* zx.FPSMax = 30000


* Property: EnableJavaLog()
* Description: Enable Log from Java Code to view more information about your camera
* Sample:
* Dim zx As ZXing
* zx.EnableJavaLog = True


* Property: Version()
* Description: Show the version of this library
* Sample:
* Dim zx As ZXing
* Log(zx.Version)


* Property: About()
* Description: Show the library about
* Sample:
* Dim zx As ZXing
* Log(zx.About)


* Method: BeginScan
* Sample:
* Dim zx As ZXing
* zx.BeginScan("myzx") 'where "myzx" is the name of event is fired where result is coming. like: Sub myzx_result(atype As String,Values As String)
*
* please handle the event
* add this to manifest:<activity android:name="ice.zxing.CaptureActivity"
* android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
* android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
* android:windowSoftInputMode="stateAlwaysHidden"></activity>


* Property: Create2DCode()
* Description: Create a Barcode based on your text
* Sample:
* Dim zx As ZXing
* ImageView1.Bitmap = zx.Create2DCode("Alberto Iglesias")


And you case use the library to get the internal properties of camera, like this (to enable this, use the EnableJavaLog = True and look your log):
[DEBUG] CAMERA PARAMS: zoom=2.7;hue=middle;max-num-detected-faces-hw=15;af-draw=0;video-stabilization=false;zoom-supported=true;cap-mode=normal;pano-idx=0;contrast=middle;whitebalance=auto;video-stabilization-values=false,true;scene-mode=auto;jpeg-quality=85;exposure-meter=center;preview-format-values=yuv420sp,yuv420p,yuv420i-yyuvyy-3plane;rotation=0;jpeg-thumbnail-quality=85;burst-num=1;preview-format=yuv420sp;flash-value=2;exposure-values=0,1,2,3,-1,-2,-3;preview-size=320x240;focal-length=3.5;iso-speed=auto;cap-mode-values=normal,burstshot,smileshot,bestshot,evbracketshot,mav,hdr,autorama,asd,pano_3d,single_3d,face_beauty;ae-mode-values=1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,19,20,21,22;preview-frame-rate-values=15,24,30;iso-speed-eng=0;hue-values=low,middle,high;max-num-metering-areas=1;preview-frame-rate=30;focus-mode-values=infinity;fast-continuous-shot=off;jpeg-thumbnail-width=160;scene-mode-values=auto,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,candlelight;preview-fps-range-values=(5000,30000);jpeg-thumbnail-size-values=0x0,160x120,320x240;contrast-values=low,middle,high;zoom-ratios=100,114,132,151,174,200,229,263,303,348,400;awb-2pass=on;preview-size-values=176x144,320x240,352x288,480x320,480x368,640x480,720x480,800x480,864x480,1280x720,1920x1088;zsd-supported=true;awb-2pass-values=off,on;exposure=0;exposure-meter-values=center,spot,average;picture-size-values=640x480,1280x960,1600x1200,2048x1536,2560x1920;edge-values=low,middle,high;preview-fps-range=5000,30000;isp-mode=0;min-exposure-compensation=-3;antibanding=auto;max-num-focus-areas=0;vertical-view-angle=360;pano-dir=right;ae-mode=1;horizontal-view-angle=360;prv-int-fmt=yuv420i-yyuvyy-3plane;brightness=middle;video-stabilization-supported=true;jpeg-thumbnail-height=120;cam-mode=0;smooth-zoom-supported=false;capfname=/sdcard/DCIM/cap00;saturation-values=low,middle,high;af-y=0;zsd-mode=on;af-x=0;focus-mode=infinity;afeng-mode=0;tv-delay=240;rawfname=/sdcard/DCIM/raw00.raw;auto-whitebalance-lock-supported=true;edge=middle;max-num-detected-faces-sw=0;picture-format-values=jpeg;iso-speed-values=auto,100,200,400,800,1600;max-exposure-compensation=3;exposure-compensation=0;exposure-compensation-step=1.0;brightness-values=low,middle,high;flash-mode=off;effect-values=none,mono,sepia,negative,aqua,blackboard,whiteboard;fast-continuous-shot-values=off,on;picture-size=2560x1920;max-zoom=10;effect=none;afeng-pos=0;saturation=middle;whitebalance-values=auto,daylight,cloudy-daylight,shade,twilight,fluorescent,warm-fluorescent,incandescent;picture-format=jpeg;focus-distances=0.95,1.9,Infinity;rawsave-mode=0;zsd-mode-values=off,on;auto-exposure-lock-supported=true;antibanding-values=60hz,50hz,auto,off



Installation instructions:
- Copy the .xml and .jar files to your custom libraries folder



Version history:
V1.8:
- initial version


Have fun with it
 

Attachments

  • ZxingGlassLib18.zip
    412.3 KB · Views: 452
  • ZXingGlassTest.zip
    6 KB · Views: 399
Last edited:

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hi,
is it possible to decode the barcode in my own activity (not open other activity) ? with current library version my app lose the connection with server, after each activity resume my app must reconnect to server.
Thank you,
 
Top