Пример #1
0
void
GonkCameraHardware::PullParameters(CameraParameters& aParams)
{
  if (!NS_WARN_IF(mClosing)) {
    const String8 s = mCamera->getParameters();
    aParams.unflatten(s);
  }
}
void
TestGonkCameraHardware::PullParameters(CameraParameters& aParams)
{
  DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
  nsString as;
  nsresult rv = WaitWhileRunningOnMainThread(new PullParametersDelegate(this, &as));
  if (NS_WARN_IF(NS_FAILED(rv))) {
    as.Truncate();
  }

  String8 s(NS_LossyConvertUTF16toASCII(as).get());
  aParams.unflatten(s);
}
Пример #3
0
void
GonkCameraHardware::PullParameters(CameraParameters& aParams)
{
  const String8 s = mCamera->getParameters();
  aParams.unflatten(s);
}
Пример #4
0
/*! 
 \return 0 on success, otherwise error code
*/
int camera_open(void)
{
	LOGE("%s",__FUNCTION__);

	CameraParameters	params;
	status_t		rtn;

	/* Open video device */
	#ifdef CAMERA_FOR_SCANNER
	//pCamera = CameraScanner::connect(0);
	

	
#ifdef CAMERA_FOR_SCANNER
	fd = open("/sys/devices/platform/image_sensor/currDrvIndex",O_RDWR);
    if(fd<0)
	{
		LOGE("Cannot open currDrvIndex\n");
		return -1;
	}
	int temp = 20002;
	write(fd,"20002",5);

	fd_scanner1 = open(SE955_CHANNEL_NAME, O_RDONLY);
 
#endif
	pCamera = Camera::connect(1);
	#else
	pCamera = CameraScanner::connect(ANDROID_CAMERA_ID);
	//pCamera = CameraScanner::connect(0);
	#endif
	if( pCamera == 0)
	{
		LOGE("Cannot connect to camera %d of: %i, %s\n", ANDROID_CAMERA_ID, errno, strerror(errno));
		return -errno;
	}

	LOGE("Camera %d \n", ANDROID_CAMERA_ID);
#ifdef CAMERA_FOR_SCANNER
pCamera->setListener(&scannerListener);	//enable data callback

#else

	pCamera->setScannerListener(&scannerListener);	//enable data callback
#endif

#ifdef VIDEO_SUBDEV 
	/* Open subdevice */
	video_subdev_handle = ::open(VIDEO_SUBDEV, O_RDWR);
	if (video_subdev_handle == -1) {
		LOGE("ERROR opening %s: %d\n", VIDEO_SUBDEV, errno);
		return -errno;
	}

	LOGE("Subdevice: %s, handle = %d\n", VIDEO_SUBDEV, video_subdev_handle);
#endif

	ImagerProps.width = 256; ImagerProps.height = 64;
#ifdef CAMERA_FOR_SCANNER
			//ImagerProps.width = 624;
			//ImagerProps.height = 474;
			ImagerProps.width = 640;
			ImagerProps.height = 480;
			ImagerProps.mount = 2;
			ImagerProps.i2c_addr_sensor = 0x48;
			ImagerProps.i2c_addr_psoc = 0x40;
			ImagerProps.i2c_addr_clock = 0x69;
#else

	if( 0 != camera_ioctl(HSM_GET_PROPERTIES, &ImagerProps) )
	{
		pCamera->disconnect();
		LOGE("HSM_GET_PROPERTIES error %d\n", errno);
		return -1;
	}
#endif

#ifdef CAMERA_FOR_SCANNER
#else

	LOGE("Image size = %dx%d\n", ImagerProps.width, ImagerProps.height);
#endif

	cbBufLength = ImagerProps.height * ImagerProps.width;

	params.unflatten(pCamera->getParameters());
	params.set("mtk-cam-mode", 1);
#if 0 //def CAMERA_FOR_SCANNER
#else
	params.set("scanner-mode", "on");
#endif
	params.setPreviewSize(ImagerProps.width, ImagerProps.height);
	//params.setPreviewFormat("yuv422i-yuyv"); // FIXME: "raw"
	//params.setPreviewFormat("yuv420sp"); // FIXME: "raw" 
	rtn = pCamera->setParameters(params.flatten());
	if( rtn != OK )
	{
		LOGE("setParameters error %d\n", rtn);
	}
#ifdef CAMERA_FOR_SCANNER


	if(fd>=0)write(fd,"20001",5);
#endif

#if 0
	rtn = pCamera->setPreviewTexture(dummy_texture); // FIXME: Is there a dummy texture?
	if( rtn != OK )
	{
		KIL_ERR("setPreviewDisplay error %d\n", rtn);
	}
#endif

	return 0;
}