diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2009-04-10 12:43:50 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2009-04-10 12:43:50 +0000 |
commit | 5e26cd696d55683f514a574e6590afbdc5fa7bd3 (patch) | |
tree | 67b3b0a513bfe1bc3fde49843e78df6f85ccc05e | |
parent | c048616a7c3fdab64a2c933113ec1c004d795e0f (diff) | |
download | libgphoto2-5e26cd696d55683f514a574e6590afbdc5fa7bd3.tar.gz |
add a new trigger capture function (just triggers capture, no results)
added a new CAPTURE_COMPLETE event for wait_for_event.
some deprecated stuff removed.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@11958 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | gphoto2/gphoto2-abilities-list.h | 3 | ||||
-rw-r--r-- | gphoto2/gphoto2-camera.h | 12 | ||||
-rw-r--r-- | libgphoto2/gphoto2-camera.c | 28 | ||||
-rw-r--r-- | libgphoto2/libgphoto2.sym | 1 |
4 files changed, 37 insertions, 7 deletions
diff --git a/gphoto2/gphoto2-abilities-list.h b/gphoto2/gphoto2-abilities-list.h index 5be5d34f7..19f840cdb 100644 --- a/gphoto2/gphoto2-abilities-list.h +++ b/gphoto2/gphoto2-abilities-list.h @@ -64,7 +64,8 @@ typedef enum { GP_OPERATION_CAPTURE_VIDEO = 1 << 1, /**< Capturing videos supported. */ GP_OPERATION_CAPTURE_AUDIO = 1 << 2, /**< Capturing audio supported. */ GP_OPERATION_CAPTURE_PREVIEW = 1 << 3, /**< Capturing image previews supported. */ - GP_OPERATION_CONFIG = 1 << 4 /**< Camera and Driver configuration supported. */ + GP_OPERATION_CONFIG = 1 << 4, /**< Camera and Driver configuration supported. */ + GP_OPERATION_TRIGGER_CAPTURE = 1 << 5, /**< Camera can trigger capture and wait for events. */ } CameraOperation; /** diff --git a/gphoto2/gphoto2-camera.h b/gphoto2/gphoto2-camera.h index 2b785fd48..8d545dd30 100644 --- a/gphoto2/gphoto2-camera.h +++ b/gphoto2/gphoto2-camera.h @@ -105,7 +105,8 @@ typedef enum { GP_EVENT_UNKNOWN, /**< unknown and unhandled event */ GP_EVENT_TIMEOUT, /**< timeout, no arguments */ GP_EVENT_FILE_ADDED, /**< CameraFilePath* = file path on camfs */ - GP_EVENT_FOLDER_ADDED /**< CameraFilePath* = folder on camfs */ + GP_EVENT_FOLDER_ADDED, /**< CameraFilePath* = folder on camfs */ + GP_EVENT_CAPTURE_COMPLETE /**< last capture is complete */ } CameraEventType; /** @@ -173,6 +174,7 @@ typedef int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget, GPContext *context); typedef int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context); +typedef int (*CameraTriggerCaptureFunc) (Camera *camera, GPContext *context); typedef int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file, GPContext *context); typedef int (*CameraSummaryFunc) (Camera *camera, CameraText *text, @@ -227,6 +229,7 @@ typedef struct _CameraFunctions { /* Capturing */ CameraCaptureFunc capture; /**< \brief Remote control the camera to capture */ + CameraTriggerCaptureFunc trigger_capture;/**< \brief Remote control the camera to trigger capture */ CameraCapturePreviewFunc capture_preview;/**< \brief Preview viewfinder content. */ /* Textual information */ @@ -236,7 +239,6 @@ typedef struct _CameraFunctions { /* Event Interface */ CameraWaitForEvent wait_for_event; /**< \brief Wait for a specific event from the camera */ - /* Reserved space to use in the future without changing the struct size */ void *reserved1; /**< \brief reserved for future use */ void *reserved2; /**< \brief reserved for future use */ @@ -245,12 +247,9 @@ typedef struct _CameraFunctions { void *reserved5; /**< \brief reserved for future use */ void *reserved6; /**< \brief reserved for future use */ void *reserved7; /**< \brief reserved for future use */ + void *reserved8; /**< \brief reserved for future use */ } CameraFunctions; -/* Those are DEPRECATED */ -typedef GPPort CameraPort; -typedef GPPortInfo CameraPortInfo; - typedef struct _CameraPrivateLibrary CameraPrivateLibrary; typedef struct _CameraPrivateCore CameraPrivateCore; @@ -327,6 +326,7 @@ int gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context); int gp_camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context); +int gp_camera_trigger_capture (Camera *camera, GPContext *context); int gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context); int gp_camera_wait_for_event (Camera *camera, int timeout, diff --git a/libgphoto2/gphoto2-camera.c b/libgphoto2/gphoto2-camera.c index 5d4835367..8e5afa8fe 100644 --- a/libgphoto2/gphoto2-camera.c +++ b/libgphoto2/gphoto2-camera.c @@ -1039,6 +1039,34 @@ gp_camera_capture (Camera *camera, CameraCaptureType type, } /** + * Triggers capture of one or more images. + * + * @param camera a #Camera + * @param context a #GPContext + * @return a gphoto2 error code + * + * This functions just remotely causes the shutter release and returns + * immediately. You will want to run #gp_camera_wait_event until a image + * is added which can be downloaded using #gp_camera_file_get. + **/ +int +gp_camera_trigger_capture (Camera *camera, GPContext *context) +{ + CHECK_NULL (camera); + CHECK_INIT (camera, context); + + if (!camera->functions->trigger_capture) { + gp_context_error (context, _("This camera can not trigger capture.")); + CAMERA_UNUSED (camera, context); + return (GP_ERROR_NOT_SUPPORTED); + } + CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->trigger_capture (camera, + context), context); + CAMERA_UNUSED (camera, context); + return (GP_OK); +} + +/** * Captures a preview that won't be stored on the camera but returned in * supplied file. * diff --git a/libgphoto2/libgphoto2.sym b/libgphoto2/libgphoto2.sym index dd26038d2..3cc67d946 100644 --- a/libgphoto2/libgphoto2.sym +++ b/libgphoto2/libgphoto2.sym @@ -44,6 +44,7 @@ gp_camera_set_port_speed gp_camera_set_timeout_funcs gp_camera_start_timeout gp_camera_stop_timeout +gp_camera_trigger_capture gp_camera_unref gp_camera_wait_for_event gp_camera_get_storageinfo |