Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

int gp_camera_free ( Camera camera  ) 

Free the camera.

Parameters:
camera a Camera
Returns:
a gphoto2 error code
Deprecated:
This function should never be used. Please use gp_camera_unref instead.

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

References CHECK_NULL, gp_camera_exit(), gp_filesystem_free(), gp_log(), GP_LOG_DEBUG, GP_OK, and gp_port_free().

Referenced by gp_camera_new(), and gp_camera_unref().

{
      CHECK_NULL (camera);

      gp_log (GP_LOG_DEBUG, "gp-camera", "Freeing camera...");

      /*
       * If the camera is currently initialized, close the connection.
       * We don't care if we are successful or not.
       */
      if (camera->port && camera->pc && camera->pc->lh)
            gp_camera_exit (camera, NULL);

      /* We don't care if anything goes wrong */
      if (camera->port) {
            gp_port_free (camera->port);
            camera->port = NULL;
      }

      if (camera->pc) {
            if (camera->pc->timeout_ids)
                  free (camera->pc->timeout_ids);
            free (camera->pc);
            camera->pc = NULL;
      }

      if (camera->fs) {
            gp_filesystem_free (camera->fs);
            camera->fs = NULL;
      }

        if (camera->functions) {
                free (camera->functions);
            camera->functions = NULL;
      }
 
      free (camera);

      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index