package ti.barcode;

import android.hardware.Camera;
import android.util.Log;
import com.google.zxing.client.android.camera.open.CameraFacing;

public class FrontCamera {
	

	public static int getFrontCamera() {
		int index = 0;
		int numCameras = Camera.getNumberOfCameras();
		if (numCameras == 0) {
			Log.w("BarcodeModule", "No cameras!");
			return -1;
		}

		while (index < numCameras) {
			Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
			Camera.getCameraInfo(index, cameraInfo);
			CameraFacing reportedFacing = CameraFacing.values()[cameraInfo.facing];
			if (reportedFacing == CameraFacing.FRONT) {
				break;
			}
			index++;
		}
		
		return index;
	}
}

@@ -620,13 +620,20 @@
 %09%09%09%09
-b
 re
-ak
+turn index
 ;%0A%09%09
@@ -663,20 +663,17 @@
 %09return 
-index
+-1
 ;%0A%09%7D%0A%7D%0A

update frontfacing camera