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

int gp_camera_start_timeout ( Camera *  camera,
unsigned int  timeout,
CameraTimeoutFunc  func 

gp_camera_start_timeout: : a Camera : the number of seconds that should pass between each call to : the function that should be called each seconds

This function should be called by the camera driver during camera_init if the camera needs to be sent messages periodically in order to prevent it to shut down.

Return value: The id of the background process or a gphoto2 error code

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

      int id;
      unsigned int *ids;

      if (!camera || !camera->pc)
            return (GP_ERROR_BAD_PARAMETERS);

      if (!camera->pc->timeout_start_func)
            return (GP_ERROR_NOT_SUPPORTED);

       * We remember the id here in order to automatically remove
       * the timeout on gp_camera_exit.
      ids = realloc (camera->pc->timeout_ids, sizeof (int) *
                              (camera->pc->timeout_ids_len + 1));
      if (!ids)
            return (GP_ERROR_NO_MEMORY);
      camera->pc->timeout_ids = ids;

      id = camera->pc->timeout_start_func (camera, timeout, func,
      if (id < 0)
            return (id);
      camera->pc->timeout_ids[camera->pc->timeout_ids_len] = id;

      return (id);

Generated by  Doxygen 1.6.0   Back to index