| 1 | /******************************************************************************* |
| 2 | Copyright(c) 2009 Geoffrey Hausheer. All rights reserved. |
| 3 | Copyright(c) 2012-2016 Jasem Mutlaq. All rights reserved. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it |
| 6 | under the terms of the GNU General Public License as published by the Free |
| 7 | Software Foundation; either version 2 of the License, or (at your option) |
| 8 | any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License along with |
| 16 | this program; if not, write to the Free Software Foundation, Inc., 59 |
| 17 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | |
| 19 | The full GNU General Public License is included in this distribution in the |
| 20 | file called LICENSE. |
| 21 | *******************************************************************************/ |
| 22 | |
| 23 | #pragma once |
| 24 | |
| 25 | #include <gphoto2/gphoto2.h> |
| 26 | |
| 27 | #define GP_UPLOAD_CLIENT 0 |
| 28 | #define GP_UPLOAD_SDCARD 1 |
| 29 | #define GP_UPLOAD_ALL 2 |
| 30 | |
| 31 | typedef enum |
| 32 | { |
| 33 | SAVE_IMAGE, |
| 34 | DELETE_IMAGE, |
| 35 | IGNORE_IMAGE |
| 36 | |
| 37 | } CameraImageHandling; |
| 38 | |
| 39 | typedef struct |
| 40 | { |
| 41 | CameraWidget *widget; |
| 42 | CameraWidgetType type; |
| 43 | const char *name; |
| 44 | const char *parent; |
| 45 | int readonly; |
| 46 | union |
| 47 | { |
| 48 | int toggle; |
| 49 | char index; |
| 50 | char *text; |
| 51 | float num; |
| 52 | int date; |
| 53 | } value; |
| 54 | int choice_cnt; |
| 55 | char **choices; |
| 56 | float min; |
| 57 | float max; |
| 58 | float step; |
| 59 | } gphoto_widget; |
| 60 | |
| 61 | // EOS Release buttons settings |
| 62 | enum |
| 63 | { |
| 64 | EOS_NONE, |
| 65 | EOS_PRESS_HALF, |
| 66 | EOS_PRESS_FULL, |
| 67 | EOS_RELEASE_HALF, |
| 68 | EOS_RELEASE_FULL, |
| 69 | EOS_IMMEDIATE, |
| 70 | EOS_PRESS_1, |
| 71 | EOS_PRESS_2, |
| 72 | EOS_PRESS_3, |
| 73 | EOS_RELEASE_1, |
| 74 | EOS_RELEASE_2, |
| 75 | EOS_RELEASE_3 |
| 76 | }; |
| 77 | |
| 78 | struct _gphoto_driver; |
| 79 | typedef struct _gphoto_driver gphoto_driver; |
| 80 | |
| 81 | struct _gphoto_widget_list; |
| 82 | typedef struct _gphoto_widget_list gphoto_widget_list; |
| 83 | |
| 84 | int gphoto_start_exposure(gphoto_driver *gphoto, uint32_t exptime_usec, int mirror_lock); |
| 85 | int gphoto_read_exposure(gphoto_driver *gphoto); |
| 86 | int gphoto_abort_exposure(gphoto_driver *gphoto); |
| 87 | int gphoto_read_exposure_fd(gphoto_driver *gphoto, int fd); |
| 88 | void gphoto_set_upload_settings(gphoto_driver *gphoto, int setting); |
| 89 | void gphoto_get_minmax_exposure(gphoto_driver *gphoto, double *min, double *max); |
| 90 | char **gphoto_get_formats(gphoto_driver *gphoto, int *cnt); |
| 91 | char **gphoto_get_iso(gphoto_driver *gphoto, int *cnt); |
| 92 | char **gphoto_get_exposure_presets(gphoto_driver *gphoto, int *cnt); |
| 93 | void gphoto_set_iso(gphoto_driver *gphoto, int iso); |
| 94 | void gphoto_set_format(gphoto_driver *gphoto, int format); |
| 95 | int gphoto_get_format_current(gphoto_driver *gphoto); |
| 96 | int gphoto_get_iso_current(gphoto_driver *gphoto); |
| 97 | gphoto_driver *gphoto_open(Camera *camera, GPContext *context, const char *model, const char *port, |
| 98 | const char *shutter_release_port); |
| 99 | int gphoto_close(gphoto_driver *gphoto); |
| 100 | void gphoto_get_buffer(gphoto_driver *gphoto, const char **buffer, unsigned long *size); |
| 101 | void gphoto_free_buffer(gphoto_driver *gphoto); |
| 102 | const char *gphoto_get_file_extension(gphoto_driver *gphoto); |
| 103 | void gphoto_show_options(gphoto_driver *gphoto); |
| 104 | gphoto_widget_list *gphoto_find_all_widgets(gphoto_driver *gphoto); |
| 105 | gphoto_widget *gphoto_get_widget_info(gphoto_driver *gphoto, gphoto_widget_list **iter); |
| 106 | int gphoto_set_widget_num(gphoto_driver *gphoto, gphoto_widget *widget, float value); |
| 107 | int gphoto_set_widget_text(gphoto_driver *gphoto, gphoto_widget *widget, const char *str); |
| 108 | int gphoto_read_widget(gphoto_widget *widget); |
| 109 | int gphoto_widget_changed(gphoto_widget *widget); |
| 110 | int gphoto_get_dimensions(gphoto_driver *gphoto, int *width, int *height); |
| 111 | int gphoto_auto_focus(gphoto_driver *gphoto, char *errMsg); |
| 112 | int gphoto_manual_focus(gphoto_driver *gphoto, int speed, char *errMsg); |
| 113 | bool gphoto_can_focus(gphoto_driver *gphoto); |
| 114 | int gphoto_capture_preview(gphoto_driver *gphoto, CameraFile *previewFile, char *errMsg); |
| 115 | int gphoto_stop_preview(gphoto_driver *gphoto); |
| 116 | int gphoto_start_preview(gphoto_driver *gphoto); |
| 117 | int gphoto_get_capture_target(gphoto_driver *gphoto, int *capture_target); |
| 118 | int gphoto_set_capture_target(gphoto_driver *gphoto, int capture_target); |
| 119 | void gphoto_set_debug(const char *name); |
| 120 | int gphoto_mirrorlock(gphoto_driver *gphoto, int msec); |
| 121 | const char *gphoto_get_manufacturer(gphoto_driver *gphoto); |
| 122 | const char *gphoto_get_model(gphoto_driver *gphoto); |
| 123 | int gphoto_handle_sdcard_image(gphoto_driver *gphoto, CameraImageHandling handling); |
| 124 | bool gphoto_supports_temperature(gphoto_driver *gphoto); |
| 125 | float gphoto_get_last_sensor_temperature(gphoto_driver *gphoto); |
| 126 | void gphoto_force_bulb(gphoto_driver *gphoto, bool enabled); |
| 127 | void gphoto_set_view_finder(gphoto_driver *gphoto, bool enabled); |