I'm implementing a viewfinder on Series 60 using the SnapShot example plus requesting continuous low quality snaps from CameraManager Active Object.

The problem is the Camera is not ready at all times, and when the user actually does request a "snap" high quality picture, chances are the Camera Server is not ready yet, and his request is not completed.

How can I wait for the CameraManager active object to become ready before I actually execute this high quality snap?

I tried User::After but of course it doesn't work since it puts the whole thread to sleep (including the CameraManager active object). I tried looping (while) but that simply blocks everything.

Here's the code to be clearer:

void CPicoCameraView::TakeSnapShotL(TBool aPreviewFlag)
{
if (!aPreviewFlag) // if user actually click ok to take pic...
// ...I want to wait until the cameramanager is ready so that I can guarantee taking the picture
// First I check if the iCameraManager is Ready. It won't be if the Snap function in here is not done yet
if (iCameraManager && iCameraManager->IsReady())
{
// Get a bmp handle from container
CFbsBitmap* pic = iContainer->GetPictureHandle(ETrue);
CleanupStack::PushL(pic);
// Snap. All this does is take the picture RCameraServ->GetBmp or something like that. of course it completes in RunL method of CameraManger where the state is set back to ready.
iCameraManager->Snap(*pic, aPreviewFlag);

// clear stack
CleanupStack::Pop(); // bmp
// clear local pointer
pic = NULL;
}
}