camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp
changeset 42 feebad15db8c
parent 41 67457b2ffb33
child 46 c826656d6714
equal deleted inserted replaced
41:67457b2ffb33 42:feebad15db8c
   207     if (state() == Uninitialized) {
   207     if (state() == Uninitialized) {
   208         // nothing to do
   208         // nothing to do
   209         return;
   209         return;
   210     }
   210     }
   211 
   211 
   212     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILL_CAPCONT_DEINIT 1" );
   212     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" );
   213 
   213 
   214     // Stop monitoring disk space.
   214     // Stop monitoring disk space.
   215     mDiskMonitor.stop();
   215     mDiskMonitor.stop();
   216     disconnect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged()));
   216     disconnect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged()));
   217 
   217 
   227 
   227 
   228     mSnapshotControl.stop();
   228     mSnapshotControl.stop();
   229 
   229 
   230     setState(Uninitialized);
   230     setState(Uninitialized);
   231 
   231 
   232     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILL_CAPCONT_DEINIT 0" );
   232     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" );
   233     CX_DEBUG_EXIT_FUNCTION();
   233     CX_DEBUG_EXIT_FUNCTION();
   234 }
   234 }
   235 
   235 
   236 
   236 
   237 /*!
   237 /*!
   244     if (state() != Uninitialized) {
   244     if (state() != Uninitialized) {
   245         // wrong state and we return
   245         // wrong state and we return
   246         return;
   246         return;
   247     }
   247     }
   248 
   248 
   249     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1" );
   249     OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1");
   250 
   250 
   251     int err = KErrNone;
   251     int err = KErrNone;
   252     CxeError::Id cxErr = getImageQualityDetails(mCurrentImageDetails);
   252     CxeError::Id cxErr = getImageQualityDetails(mCurrentImageDetails);
   253     int ecamStillResolutionIndex = 0;
   253     int ecamStillResolutionIndex = 0;
   254 
   254 
   269             ecamStillResolutionIndex = 0;
   269             ecamStillResolutionIndex = 0;
   270         }
   270         }
   271 
   271 
   272         // Prepare Image capture
   272         // Prepare Image capture
   273         CCamera::TFormat imgFormat = supportedStillFormat(mCameraDeviceControl.cameraIndex());
   273         CCamera::TFormat imgFormat = supportedStillFormat(mCameraDeviceControl.cameraIndex());
   274         OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1");
   274         OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1");
   275         TRAP(err, mCameraDevice.camera()->PrepareImageCaptureL(imgFormat, ecamStillResolutionIndex));
   275         TRAP(err, mCameraDevice.camera()->PrepareImageCaptureL(imgFormat, ecamStillResolutionIndex));
   276         OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0");
   276         OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0");
   277 
   277 
   278         CX_DEBUG(("PrepareImageCaptureL done, err=%d, resolution index = %d", err, ecamStillResolutionIndex));
   278         CX_DEBUG(("PrepareImageCaptureL done, err=%d, resolution index = %d", err, ecamStillResolutionIndex));
   279 
   279 
   280         if (!err) {
   280         if (!err) {
   281             // still capture prepare went fine, try preparing snapshot
   281             // still capture prepare went fine, try preparing snapshot
   316     }
   316     }
   317 
   317 
   318     // Inform interested parties that image mode has been prepared for capture
   318     // Inform interested parties that image mode has been prepared for capture
   319     emit imagePrepareComplete(CxeErrorHandlingSymbian::map(err));
   319     emit imagePrepareComplete(CxeErrorHandlingSymbian::map(err));
   320 
   320 
   321     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_OUT, "msg: e_CX_STILLCAPCONT_PREPARE 0" );
   321     OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 0");
       
   322     OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_OUT, "msg: e_CX_STILLCAPCONT_PREPARE 0");
   322 
   323 
   323     CX_DEBUG_EXIT_FUNCTION();
   324     CX_DEBUG_EXIT_FUNCTION();
   324 }
   325 }
   325 
   326 
   326 
   327 
   330  Returns symbian error code.
   331  Returns symbian error code.
   331  */
   332  */
   332 int CxeStillCaptureControlSymbian::prepareStillSnapshot()
   333 int CxeStillCaptureControlSymbian::prepareStillSnapshot()
   333 {
   334 {
   334     CX_DEBUG_ENTER_FUNCTION();
   335     CX_DEBUG_ENTER_FUNCTION();
   335     OstTrace0( camerax_performance, DUP4_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 1" );
   336     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_1, "msg: e_CX_PREPARE_SNAPSHOT 1" );
   336 
   337 
   337     int status(KErrNone);
   338     int status(KErrNone);
   338     try {
   339     try {
   339         QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
   340         QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
   340                                 mViewfinderControl.deviceDisplayResolution(),
   341                                 mViewfinderControl.deviceDisplayResolution(),
   341                                 mCurrentImageDetails.mAspectRatio);
   342                                 mCurrentImageDetails.mAspectRatio);
   342         mSnapshotControl.start(snapshotSize);
   343         mSnapshotControl.start(snapshotSize);
   343     } catch (...) {
   344     } catch (...) {
   344         status = KErrGeneral;
   345         status = KErrGeneral;
   345     }
   346     }
   346     OstTrace0( camerax_performance, DUP5_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 0" );
   347     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_2, "msg: e_CX_PREPARE_SNAPSHOT 0" );
   347 
   348 
   348     CX_DEBUG_EXIT_FUNCTION();
   349     CX_DEBUG_EXIT_FUNCTION();
   349     return status;
   350     return status;
   350 }
   351 }
   351 
   352 
   355  Returns CxeError error code.
   356  Returns CxeError error code.
   356  */
   357  */
   357 CxeError::Id CxeStillCaptureControlSymbian::getImageQualityDetails(CxeImageDetails &imageInfo)
   358 CxeError::Id CxeStillCaptureControlSymbian::getImageQualityDetails(CxeImageDetails &imageInfo)
   358 {
   359 {
   359     CX_DEBUG_ENTER_FUNCTION();
   360     CX_DEBUG_ENTER_FUNCTION();
       
   361     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_GETQUALITYDETAILS_1, "msg: e_CX_GET_QUALITY_DETAILS 1" );
   360 
   362 
   361     int imageQuality = 0;
   363     int imageQuality = 0;
   362     CxeError::Id err = CxeError::None;
   364     CxeError::Id err = CxeError::None;
   363     if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex) {
   365     if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex) {
   364         err = mSettings.get(CxeSettingIds::IMAGE_QUALITY, imageQuality);
   366         err = mSettings.get(CxeSettingIds::IMAGE_QUALITY, imageQuality);
   376         // we are in secondary camera
   378         // we are in secondary camera
   377         // get secondary camera image quality details
   379         // get secondary camera image quality details
   378        imageInfo = mIcmSupportedImageResolutions.at(imageQuality);
   380        imageInfo = mIcmSupportedImageResolutions.at(imageQuality);
   379     }
   381     }
   380 
   382 
       
   383     OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_GETQUALITYDETAILS_2, "msg: e_CX_GET_QUALITY_DETAILS 0" );
   381     CX_DEBUG_EXIT_FUNCTION();
   384     CX_DEBUG_EXIT_FUNCTION();
   382     return err;
   385     return err;
   383 }
   386 }
   384 
   387 
   385 /*!
   388 /*!
   450 void CxeStillCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
   453 void CxeStillCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
   451 {
   454 {
   452     CX_DEBUG_ENTER_FUNCTION();
   455     CX_DEBUG_ENTER_FUNCTION();
   453     if (mCameraDeviceControl.mode() == Cxe::ImageMode) {
   456     if (mCameraDeviceControl.mode() == Cxe::ImageMode) {
   454 
   457 
   455         OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 1" );
   458         OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_1, "msg: e_CX_HANDLE_SNAPSHOT 1");
   456 
   459 
   457         QPixmap ss = QPixmap::fromImage(snapshot);
   460         QPixmap ss = QPixmap::fromImage(snapshot);
   458         // Get image container for current snapshot index.
   461         // Get image container for current snapshot index.
   459         // Remember to increment counter.
   462         // Remember to increment counter.
   460         CxeStillImageSymbian* stillImage = getImageForIndex(mNextSnapshotIndex++);
   463         CxeStillImageSymbian* stillImage = getImageForIndex(mNextSnapshotIndex++);
   469         if (stillImage->filename().isEmpty()) {
   472         if (stillImage->filename().isEmpty()) {
   470             // Error ignored at this point, try again when image data arrives.
   473             // Error ignored at this point, try again when image data arrives.
   471             prepareFilename(stillImage);
   474             prepareFilename(stillImage);
   472         }
   475         }
   473 
   476 
   474         OstTrace0( camerax_performance, DUP1_CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 0" );
   477         OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0");
   475     }
   478     }
   476 
   479 
   477     CX_DEBUG_EXIT_FUNCTION();
   480     CX_DEBUG_EXIT_FUNCTION();
   478 }
   481 }
   479 
   482 
   742  * behaviour is required in rare cases where image data arrives before snapshot.
   745  * behaviour is required in rare cases where image data arrives before snapshot.
   743  */
   746  */
   744 CxeError::Id
   747 CxeError::Id
   745 CxeStillCaptureControlSymbian::prepareFilename(CxeStillImageSymbian *stillImage)
   748 CxeStillCaptureControlSymbian::prepareFilename(CxeStillImageSymbian *stillImage)
   746 {
   749 {
       
   750     OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_1, "msg: e_CX_PREPARE_FILENAME 1" );
       
   751 
   747     CxeError::Id err = CxeError::None;
   752     CxeError::Id err = CxeError::None;
   748     if (stillImage->filename().isEmpty()) {
   753     if (stillImage->filename().isEmpty()) {
   749         QString path;
   754         QString path;
   750 
   755 
   751         QString fileExt = mCurrentImageDetails.mImageFileExtension;
   756         QString fileExt = mCurrentImageDetails.mImageFileExtension;
   765             //! @todo: Error ID can be returned by this function.
   770             //! @todo: Error ID can be returned by this function.
   766             // Also error can be detected from empty filename string.
   771             // Also error can be detected from empty filename string.
   767             CX_DEBUG(("ERROR in filename generation. err:%d", err));
   772             CX_DEBUG(("ERROR in filename generation. err:%d", err));
   768         }
   773         }
   769     }
   774     }
       
   775 
       
   776     OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_2, "msg: e_CX_PREPARE_FILENAME 0" );
   770     return err;
   777     return err;
   771 }
   778 }
   772 
   779 
   773 /*!
   780 /*!
   774 * Helper method to set orientation data from the orientation sensor
   781 * Helper method to set orientation data from the orientation sensor