From eb6e4dfedb4ffa3eca4f5517ecc109a9b4dfc269 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 19 Feb 2016 13:37:22 +0100 Subject: add new apis gp_camera_list_config, gp_camera_set_single_config, gp_camera_get_single_config --- libgphoto2/gphoto2-camera.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ libgphoto2/libgphoto2.sym | 3 ++ 2 files changed, 101 insertions(+) (limited to 'libgphoto2') diff --git a/libgphoto2/gphoto2-camera.c b/libgphoto2/gphoto2-camera.c index 2ff39fcb6..80effe435 100644 --- a/libgphoto2/gphoto2-camera.c +++ b/libgphoto2/gphoto2-camera.c @@ -875,6 +875,71 @@ gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context) } +/** + * Retrieve a single configuration \c widget for the \c camera. + * + * @param camera a #Camera + * @param name the name of a configuration widget + * @param widget a #CameraWidget + * @param context a #GPContext + * @return gphoto2 error code + * + * This \c widget will then contain the current and the possible values and the type. + * + */ +int +gp_camera_get_single_config (Camera *camera, const char *name, CameraWidget **widget, GPContext *context) +{ + C_PARAMS (camera); + CHECK_INIT (camera, context); + + if (!camera->functions->get_single_config) { + gp_context_error (context, _("This camera does " + "not provide any configuration options.")); + CAMERA_UNUSED (camera, context); + return (GP_ERROR_NOT_SUPPORTED); + } + + CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->get_single_config ( + camera, name, widget, context), context); + + CAMERA_UNUSED (camera, context); + return (GP_OK); +} + + +/** + * Retrieve a configuration \c list for the \c camera. + * + * @param camera a #Camera + * @param list a #CameraList + * @param context a #GPContext + * @return gphoto2 error code + * + * The names in list can be used for the single set and get configuration calls. + * + */ +int +gp_camera_list_config (Camera *camera, CameraList *list, GPContext *context) +{ + C_PARAMS (camera); + CHECK_INIT (camera, context); + + if (!camera->functions->list_config) { + gp_context_error (context, _("This camera does " + "not provide any configuration options.")); + CAMERA_UNUSED (camera, context); + return (GP_ERROR_NOT_SUPPORTED); + } + + CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->list_config ( + camera, list, context), context); + + CAMERA_UNUSED (camera, context); + return (GP_OK); +} + + /** * Sets the configuration. * @@ -907,6 +972,39 @@ gp_camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) return (GP_OK); } +/** + * Set a single configuration \c widget for the \c camera. + * + * @param camera a #Camera + * @param name the name of a configuration widget + * @param widget a #CameraWidget + * @param context a #GPContext + * @return gphoto2 error code + * + * This \c widget contains the new value of the widget to set. + * + */ +int +gp_camera_set_single_config (Camera *camera, const char *name, CameraWidget *widget, GPContext *context) +{ + C_PARAMS (camera); + CHECK_INIT (camera, context); + + if (!camera->functions->set_single_config) { + gp_context_error (context, _("This camera does " + "not provide any configuration options.")); + CAMERA_UNUSED (camera, context); + return (GP_ERROR_NOT_SUPPORTED); + } + + CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->set_single_config ( + camera, name, widget, context), context); + + CAMERA_UNUSED (camera, context); + return (GP_OK); +} + + /** * Retrieves a camera summary. * diff --git a/libgphoto2/libgphoto2.sym b/libgphoto2/libgphoto2.sym index 96fbc19d7..3f7067344 100644 --- a/libgphoto2/libgphoto2.sym +++ b/libgphoto2/libgphoto2.sym @@ -32,15 +32,18 @@ gp_camera_free gp_camera_get_abilities gp_camera_get_about gp_camera_get_config +gp_camera_get_single_config gp_camera_get_manual gp_camera_get_port_info gp_camera_get_port_speed gp_camera_get_summary gp_camera_init +gp_camera_list_config gp_camera_new gp_camera_ref gp_camera_set_abilities gp_camera_set_config +gp_camera_set_single_config gp_camera_set_port_info gp_camera_set_port_speed gp_camera_set_timeout_funcs -- cgit v1.2.1