Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_camera_exit ( Camera *  camera,
GPContext context 

gp_camera_exit: : a Camera : a GPContext

Closes a connection to the camera and therefore gives other application the possibility to access the camera, too. It is recommended that you call this function when you currently don't need the camera. The camera will get reinitialized by gp_camera_init automatically if you try to access the camera again.

Return value: a gphoto2 error code.

Definition at line 276 of file gphoto2-camera.c.

References gp_camera_stop_timeout(), and gp_filesystem_reset().

Referenced by gp_camera_free(), gp_camera_set_abilities(), and gp_camera_set_port_speed().

      CHECK_NULL (camera);

      gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Exiting camera ('%s')...",

       * We have to postpone this operation if the camera is currently 
       * in use. gp_camera_exit will be called again if the
       * camera->pc->used will drop to zero.
      if (camera->pc->used) {
            camera->pc->exit_requested = 1;
            return (GP_OK);

      /* Remove every timeout that is still pending */
      while (camera->pc->timeout_ids_len)
            gp_camera_stop_timeout (camera, camera->pc->timeout_ids[0]);
      free (camera->pc->timeout_ids);
      camera->pc->timeout_ids = NULL;

      if (camera->functions->exit) {
            gp_port_open (camera->port);
            camera->functions->exit (camera, context);
      gp_port_close (camera->port);
      memset (camera->functions, 0, sizeof (CameraFunctions));

      if (camera->pc->lh) {
#ifdef HAVE_LTDL_H
            lt_dlclose (camera->pc->lh);
            lt_dlexit ();
            GP_SYSTEM_DLCLOSE (camera->pc->lh);
            camera->pc->lh = NULL;

      gp_filesystem_reset (camera->fs);

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index