int CanonEDCamera::Shutdown()
{
   // save images on the memory card
   if (isLegacy_)
      EdsSendStatusCommand (camera_,  kEdsCameraStatusCommand_UILock, 0);
   EdsSaveTo toCamera = kEdsSaveTo_Camera;
   EdsError err = EdsSetPropertyData(camera_,  kEdsPropID_SaveTo, 0 , sizeof(EdsSaveTo),  &toCamera);
   if (isLegacy_)
      EdsSendStatusCommand (camera_,  kEdsCameraStatusCommand_UIUnLock, 0);

   // Close session with camera 
   err = EdsCloseSession(camera_); 
    
   // Release camera 
   if(camera_ != NULL) 
   { 
      EdsRelease(camera_); 
   } 
    
   // Terminate SDK 
   if(isSDKLoaded_) 
   { 
      EdsTerminateSDK(); 
   }

   return DEVICE_OK;
}
Example #2
0
void closeCamera(EdsCameraRef handle) {
	EdsError err = EdsCloseSession(handle);
	if (err != EDS_ERR_OK) {
		handleErrorCode(err);
	}

	// Release camera
	if (handle != NULL) {
		EdsRelease(handle);
	}
}
 EdsError Camera::requestCloseSession() {
     if (!mHasOpenSession) {
         return EDS_ERR_SESSION_NOT_OPEN;
     }
     
     EdsError error = EdsCloseSession(mCamera);
     if (error != EDS_ERR_OK) {
         std::cerr << "ERROR - failed to close camera session" << std::endl;
         return error;
     }
     
     mHasOpenSession = false;
     return EDS_ERR_OK;
 }
    //---------------------------------------------------------------------
    bool CanonCameraWrapper::closeSession(){
        if( state == CAMERA_CLOSED)return false;
        EdsError err = EDS_ERR_OK;

        err = EdsCloseSession( theCamera );
        if(err == EDS_ERR_OK){
            printf("We are closing session!\n");
            state = CAMERA_CLOSED;
            return true;
        }
        else{
            printf("We failed at closing session!\n");
        }
        return false;
    }
boolean disconFromFirstCamera(){

	EdsError err = EDS_ERR_OK;
	// Close session with camera
	err = EdsCloseSession(camera);

	// Release camera
	if(camera != NULL)
	{
		EdsRelease(camera);
	}
	// Terminate SDK
	if(isSDKLoaded)
	{
		EdsTerminateSDK();
	}
	pictureProgress = CAMERA_RESET;
	return err == EDS_ERR_OK;
}
CanonCamera::~CanonCamera(void)
{
	if(liveView)
		endLiveview();
	EdsCloseSession(camera);
}
void
Controller::handleStateEvent(
	EdsStateEvent	inEvent,
	EdsUInt32	inEventData )
{
    switch( inEvent ) {
	/*
	 *  Camera has lost connection to host computer, either because
	 *  it was disconnected by unplugging a cord, opening the
	 *  compact flash compartment, turning the camera off, auto
	 *  shut-off, or by other means.
	 */
	case kEdsStateEvent_Shutdown:
	    if( camera->handle() != 0 ) {
		stopLiveView();
		EdsCloseSession( camera->handle() );
		EdsRelease( camera->handle() );
		camera->setHandle( 0 );
	    }
	    // signal view of change in connection status
	    camera->initialize();
	    emit propertyChanged( kEdsPropID_ProductName, 0 );
	    emit eventReport( new Event( Event::ConnectionLost ) );
	    break;
	/*
	 *  Notifies of whether or not (0/1) there are objects waiting to
	 *  be transferred to the host computer. This is useful when
	 *  ensuring all shot images have been transferred when the
	 *  application is closed. A value of 1 is passed initially
	 *  (whether it is a single shot or a burst of shots to download),
	 *  followed by a 0 when downloading has completed.
	 */
	case kEdsStateEvent_JobStatusChanged:
	    camera->setObjectsWaiting( inEventData );
	    break;
	/*
	 *  Notifies that the camera will shut down after a specific period. 
	 *  Generated only if auto shut-off is set. Exactly when notification
	 *  is issued (that is, the number of seconds until shutdown) varies
	 *  depending on the camera model. If the camera is allowed to shut
	 *  down, the connection will be lost and can only be reestablished
	 *  by pressing the camera's shutter button half-way (or pressing
	 *  menu, disp). To continue operation without having the camera
	 *  shut down, use EdsSendCommand to extend the auto shut-off timer.
	 *  inEventData contains the number of seconds to shutdown.
	 */
	case kEdsStateEvent_WillSoonShutDown:
	    EdsSendCommand( camera->handle(),
			    kEdsCameraCommand_ExtendShutDownTimer,
			    0 );
	    break;
	/*
	 *  As the counterpart event to kEdsStateEvent_WillSoonShutDown,
	 *  this event notifies of updates to the number of seconds until
	 *  a camera shuts down. After the update, the period until shutdown
	 *  is model-dependent. Not all cameras notify of this event.
	 */
	case kEdsStateEvent_ShutDownTimerUpdate:
	    // ignore
	    break;
	/*
	 *  Notifies that a requested release has failed, due to focus
	 *  failure or similar factors: inEventData contains error code.
	 *  Hasn't occurred yet.
	 */
	case kEdsStateEvent_CaptureError:
	    emit eventReport( new Event( Event::CaptureFailure, inEventData ) );
	    break;
	/*
	 *  Notifies of internal SDK errors. If this error event is received,
	 *  the issuing device will probably not be able to continue working
	 *  properly, so cancel the remote connection.
	 */
	case kEdsStateEvent_InternalError:
	    stopLiveView();
	    closeSessionCommand();
	    camera->initialize();
	    // signal view of change in connection status
	    emit propertyChanged( kEdsPropID_ProductName, 0 );
	    emit eventReport( new Event( Event::ConnectionLost ) );
	    break;
	/*
	 *  Not documented and hasn't occurred yet.
	 */
	case kEdsStateEvent_AfResult:
	    emit eventReport(
		new Event( Event::AFResultUnhandled, inEventData ) );
	    break;
	/*
	 *  Notifies of the exposure time during bulb shooting. Events are
	 *  issued in about one-second intervals during bulb shooting. This
	 *  event is only issued when bulb shooting is started on the computer.
	 *  inEventData contains the exposure time in seconds.
	 */
	case kEdsStateEvent_BulbExposureTime:
	    emit eventReport(
		new Event( Event::BulbExposureTime, inEventData ) );
	    break;
    }
}