I greatly appreciate your answer, thanks a lot. I added your hints to my program but it still doesn't work. The camera takes a picture but then the program gets deadlocked in the message loop. When I terminate the app and switch off the camera, the cam-display shows a message indicating that there are images left to be saved. This wasn't the case before. I suspect the sdk doesn't get the messages, but I'm not very familiar with this. Can you please look at my code again? Could you test if it works on your system? Thanks in advance!
- Code: Select all
int main(int argc, char* argv[])
{
EdsInitializeSDK();
EdsError error ;
EdsCameraListRef cameraList = NULL;
EdsUInt32 count = 0;
EdsCameraRef camera;
error = EdsGetCameraList(&cameraList);
error += EdsGetChildCount(cameraList, &count);
error += EdsGetChildAtIndex(cameraList, 0, &camera);
error += EdsSetPropertyEventHandler(camera, kEdsPropertyEvent_All, CameraEventListener::handlePropertyEvent, NULL);
error += EdsSetObjectEventHandler(camera, kEdsPropertyEvent_All, CameraEventListener::handleObjectEvent, NULL);
error += EdsSetCameraStateEventHandler(camera, kEdsPropertyEvent_All, CameraEventListener::handleStateEvent, NULL);
error += EdsOpenSession(camera);
EdsUInt32 saveTo = kEdsSaveTo_Host;
error += EdsSetPropertyData(camera, kEdsPropID_SaveTo, 0, sizeof(saveTo), &saveTo);
error += EdsSendStatusCommand(camera, kEdsCameraStatusCommand_UILock, 0);
EdsCapacity capacity = {0x7FFFFFFF, 0x1000, 1};
error += EdsSetCapacity(camera, capacity);
error += EdsSendStatusCommand(camera, kEdsCameraStatusCommand_UIUnLock, 0);
if(error == EDS_ERR_OK)
{
EdsSendCommand(camera, kEdsCameraCommand_TakePicture, 0);
MSG Msg;
BOOL bRet;
while( (bRet = GetMessage( &Msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
printf("Msg.message:%u\n", Msg.message);
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}
if(cameraList != NULL)
{
EdsRelease(cameraList);
cameraList = NULL;
}
error = EdsCloseSession(camera);
return 0;
}
