×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Red face S60 Platform: Camera Example Rework

    Hello, I'm new here, i don't have much programming knowledge and i'm trying to modify this application

    Code:
    http://www.forum.nokia.com/info/sw.nokia.com/id/9a3e1226-79db-4c8e-bd70-7d9d22aaa6eb/S60_Platform_Camera_Example.html
    So when it starts it automatically it takes a picture every 15 seconds, infinitely but without loosing the focus feature which is working perfectly when i take a single picture.

    But i can't figure out how to do this.

    I guess the settings i need to modify are located in

    \src\CameraWrapperExampleAppView.cpp
    My guess is that i need to somehow loop this code, and i have no clue how to do that also.

    // Capture picture after it has focused
    iCameraWrapper->StopViewFinder();
    TRAPD(err,iCameraWrapper->CaptureL());
    if (err)
    {
    SetError(_L("Camera capture error %d"), err);
    }
    }
    }

    void CCameraWrapperExampleAppView::MceoCapturedDataReady( TDesC8* aData )
    {
    SetTitle(_L("Saving picture..."));

    delete iData; iData = NULL;
    iData = aData->Alloc();

    if (iCameraWrapper)
    iCameraWrapper->ReleaseImageBuffer();

    TRAP_IGNORE(iAppUi->UseOptionsBackCbaL());

    StorePicture(iData);
    }

    void CCameraWrapperExampleAppView::StorePicture( TDesC8* aData )
    {
    // Create path for filename
    TFileName path = PathInfo::MemoryCardRootPath ();
    path.Append(PathInfo::ImagesPath());

    // Ensure that path exists
    BaflUtils::EnsurePathExistsL(iEikonEnv->FsSession(),path);

    // Get next free filename for the image
    TFileName fileToSave;
    TBool fileExists = ETrue;
    for (TInt i=1 ; i<100 ; i++)
    {
    fileToSave.Copy(path);
    fileToSave.Append(_L("M"));
    fileToSave.AppendNum(i);
    fileToSave.Append(_L(".jpg"));
    fileExists = BaflUtils::FileExists(iEikonEnv->FsSession(),fileToSave);
    if (!fileExists)
    {
    break;
    }
    }

    // Save file
    if (!fileExists)
    {
    RFile file;
    TInt err = file.Create(iEikonEnv->FsSession(),fileToSave,EFileWrite);
    if (!err)
    {
    file.Write(*aData);
    file.Close();
    SetTitle(fileToSave);
    }
    else
    {
    SetError(_L("File saving error %d"),err);
    }
    }
    else
    {
    SetTitle(_L("File not saved, delete old pictures!"));
    }
    }


    void CCameraWrapperExampleAppView::MceoCapturedBitmapReady( CFbsBitmap* aBitmap )
    {
    if (iBackBufferContext)
    {
    TSize bmpSizeInPixels = aBitmap->SizeInPixels();
    TInt xDelta = (Rect().Width() - bmpSizeInPixels.iWidth) / 2;
    TInt yDelta = (Rect().Height() - bmpSizeInPixels.iHeight) / 2;
    TPoint pos( xDelta, yDelta );

    A possible alternative would be that i only need to tap the phone screen once, and it would take images every 15 seconds automatically after that (if full automatisation is impossible).

    I would be grateful for any help & i need to solve this urgently so please help me.

    Regards

    RapidTuna

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,335

    Re: S60 Platform: Camera Example Rework

    Quote Originally Posted by rapidtuna View Post
    Hello, I'm new here, i don't have much programming knowledge and i'm trying to modify this application

    ...
    i need to solve this urgently
    These two statements do not go together well, do they?

    Anyways you can try creating timer which should trigger capture image call after 15 seconds. Check this Wiki article for how to implement timer: http://wiki.forum.nokia.com/index.ph...implementation
    Nokia Developer Wiki Moderation team

  3. #3
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    258

    Re: S60 Platform: Camera Example Rework

    Quote Originally Posted by rapidtuna View Post
    So when it starts it automatically it takes a picture every 15 seconds, infinitely but without loosing the focus feature which is working perfectly when i take a single picture.

    But i can't figure out how to do this.
    Hi,

    I suggest starting by finding out what actually happens when you press the key to take a single picture with the focus feature working. In OfferKeyEventL of the view:

    Code:
            case EKeyOK:
            case EStdKeyDevice3:
                {
                // Capture picture
                iCameraShutterFocusing = EFalse;
                StartFocusing();
                return EKeyWasConsumed;
                }
    Then you'll only need to duplicate this behaviour every 15 seconds. Easiest way to do it would probably be using CPeriodic and a callback function that either simulates a keypress (calls OfferKeyEventL with the correct key code) or sets iCameraShutterFocusing to EFalse and calls StartFocusing() as above.

    -TongMuan

Similar Threads

  1. Python for S60 1.9.5 is now released
    By tvijayan in forum Symbian
    Replies: 8
    Last Post: 2009-05-30, 05:33
  2. Python for S60 1.9.4 is now released
    By tvijayan in forum Symbian
    Replies: 9
    Last Post: 2009-05-27, 10:39
  3. previous camera autofocus lib can not work in S60 3.2
    By whitewinds in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2008-02-19, 08:02
  4. Replies: 3
    Last Post: 2008-02-15, 09:50
  5. S60 Platform China Team Recruiting Developers
    By bbggzyq in forum News and Announcements
    Replies: 3
    Last Post: 2007-08-31, 18:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •