libgphoto2 photo camera library (libgphoto2) Internals  2.5.23
gphoto2-camera.c
Go to the documentation of this file.
1 
27 #include "config.h"
28 #include <gphoto2/gphoto2-camera.h>
29 
30 #include <stdlib.h>
31 #include <string.h>
32 #include <stdarg.h>
33 #include <stdio.h>
34 
35 #include <ltdl.h>
36 
37 #include <gphoto2/gphoto2-result.h>
40 
41 #ifdef ENABLE_NLS
42 # include <libintl.h>
43 # undef _
44 # define _(String) dgettext (GETTEXT_PACKAGE, String)
45 # ifdef gettext_noop
46 # define N_(String) gettext_noop (String)
47 # else
48 # define N_(String) (String)
49 # endif
50 #else
51 # define textdomain(String) (String)
52 # define gettext(String) (String)
53 # define dgettext(Domain,Message) (Message)
54 # define dcgettext(Domain,Message,Type) (Message)
55 # define bindtextdomain(Domain,Directory) (Domain)
56 # define _(String) (String)
57 # define N_(String) (String)
58 #endif
59 
60 #define CAMERA_UNUSED(c,ctx) \
61 { \
62  (c)->pc->used--; \
63  if (!(c)->pc->used) { \
64  if ((c)->pc->exit_requested) \
65  gp_camera_exit ((c), (ctx)); \
66  if (!(c)->pc->ref_count) \
67  gp_camera_free (c); \
68  } \
69 }
70 
71 #define CR(c,result,ctx) \
72 { \
73  int r1 = (result); \
74  \
75  if (r1 < 0) { \
76  /* libgphoto2_port doesn't have a GPContext */ \
77  gp_context_error ((ctx), _("An error occurred " \
78  "in the io-library ('%s'): %s"), \
79  gp_port_result_as_string (r1), \
80  gp_port_get_error ((c) ? (c)->port : NULL)); \
81  if (c) \
82  CAMERA_UNUSED (c,ctx); \
83  return (r1); \
84  } \
85 }
86 
87 /*
88  * HAVE_MULTI
89  * ----------
90  *
91  * The problem: Several different programs (gtkam, gphoto2, gimp) accessing
92  * one camera.
93  * The solutions:
94  * (1) gp_port_open before each operation, gp_port_close after. This has
95  * shown to not work with some drivers (digita/dc240) for serial ports,
96  * because the camera will notice that [1],
97  * reset itself and will therefore need to be reinitialized. If you want
98  * this behaviour, #define HAVE_MULTI.
99  * (2) Leave it up to the frontend to release the camera by calling
100  * gp_camera_exit after camera operations. This is what is implemented
101  * right now. The drawback is that re-initialization takes more time than
102  * just reopening the port. However, it works for all camera drivers.
103  *
104  * [1] Marr <marr@shianet.org> writes:
105  *
106  * With the Digita-OS cameras at least, one of the RS-232 lines is tied
107  * to a 'Reset' signal on the camera. I quote from the Digita 'Host
108  * Interface Specification' document:
109  *
110  * "The Reset signal is a pulse on the Reset/Att line (which cooresponds
111  * [sic] to pin 2 at the camera side) sent from the host computer to the
112  * camera. This pulse must be at least 50us."
113  */
114 
115 #ifdef HAVE_MULTI
116 #define CHECK_OPEN(c,ctx) \
117 { \
118  int r2; \
119  \
120  if (strcmp ((c)->pc->a.model,"Directory Browse")) { \
121  r2 = gp_port_open ((c)->port); \
122  if (r2 < 0) { \
123  CAMERA_UNUSED (c,ctx); \
124  return (r2); \
125  } \
126  } \
127  if ((c)->functions->pre_func) { \
128  r2 = (c)->functions->pre_func (c,ctx); \
129  if (r2 < 0) { \
130  CAMERA_UNUSED (c,ctx); \
131  return (r2); \
132  } \
133  } \
134 }
135 #else
136 #define CHECK_OPEN(c,ctx) \
137 { \
138  if ((c)->functions->pre_func) { \
139  int r2 = (c)->functions->pre_func (c,ctx); \
140  if (r2 < 0) { \
141  CAMERA_UNUSED (c,ctx); \
142  return (r2); \
143  } \
144  } \
145 }
146 #endif
147 
148 #ifdef HAVE_MULTI
149 #define CHECK_CLOSE(c,ctx) \
150 { \
151  if (strcmp ((c)->pc->a.model,"Directory Browse")) \
152  gp_port_close ((c)->port); \
153  if ((c)->functions->post_func) { \
154  int r3 = (c)->functions->post_func (c,ctx); \
155  if (r3 < 0) { \
156  CAMERA_UNUSED (c,ctx); \
157  return (r3); \
158  } \
159  } \
160 }
161 #else
162 #define CHECK_CLOSE(c,ctx) \
163 { \
164  if ((c)->functions->post_func) { \
165  int r3 = (c)->functions->post_func (c,ctx); \
166  if (r3 < 0) { \
167  CAMERA_UNUSED (c,ctx); \
168  return (r3); \
169  } \
170  } \
171 }
172 #endif
173 
174 #define CRS(c,res,ctx) \
175 { \
176  int r4 = (res); \
177  \
178  if (r4 < 0) { \
179  CAMERA_UNUSED (c,ctx); \
180  return (r4); \
181  } \
182 }
183 
184 #define CRSL(c,res,ctx,list) \
185 { \
186  int r5 = (res); \
187  \
188  if (r5 < 0) { \
189  CAMERA_UNUSED (c,ctx); \
190  gp_list_free (list); \
191  return (r5); \
192  } \
193 }
194 
195 #define CHECK_RESULT_OPEN_CLOSE(c,result,ctx) \
196 { \
197  int r6; \
198  \
199  CHECK_OPEN (c,ctx); \
200  r6 = (result); \
201  if (r6 < 0) { \
202  GP_LOG_E ("'%s' failed: %d", #result, r6); \
203  CHECK_CLOSE (c,ctx); \
204  CAMERA_UNUSED (c,ctx); \
205  return (r6); \
206  } \
207  CHECK_CLOSE (c,ctx); \
208 }
209 
210 #define CHECK_INIT(c,ctx) \
211 { \
212  if ((c)->pc->used) \
213  return (GP_ERROR_CAMERA_BUSY); \
214  (c)->pc->used++; \
215  if (!(c)->pc->lh) \
216  CR((c), gp_camera_init (c, ctx), ctx); \
217 }
218 
220 
221  /* Some information about the port */
222  unsigned int speed;
223 
224  /* The abilities of this camera */
226 
227  /* Library handle */
228  lt_dlhandle lh;
229 
230  char error[2048];
231 
232  unsigned int ref_count;
233  unsigned char used;
234  unsigned char exit_requested;
235 
237 
238  /* Timeout functions */
242  unsigned int *timeout_ids;
243  unsigned int timeout_ids_len;
244 };
245 
246 
263 int
264 gp_camera_exit (Camera *camera, GPContext *context)
265 {
266  C_PARAMS (camera);
267 
268  GP_LOG_D ("Exiting camera ('%s')...", camera->pc->a.model);
269 
270  /*
271  * We have to postpone this operation if the camera is currently
272  * in use. gp_camera_exit will be called again if the
273  * camera->pc->used will drop to zero.
274  */
275  if (camera->pc->used) {
276  camera->pc->exit_requested = 1;
277  return (GP_OK);
278  }
279 
280  /* Remove every timeout that is still pending */
281  while (camera->pc->timeout_ids_len)
282  gp_camera_stop_timeout (camera, camera->pc->timeout_ids[0]);
283  free (camera->pc->timeout_ids);
284  camera->pc->timeout_ids = NULL;
285 
286  if (camera->functions->exit) {
287 #ifdef HAVE_MULTI
288  gp_port_open (camera->port);
289 #endif
290  camera->functions->exit (camera, context);
291  }
292  gp_port_close (camera->port);
293  memset (camera->functions, 0, sizeof (CameraFunctions));
294 
295  if (camera->pc->lh) {
296 #if !defined(VALGRIND)
297  lt_dlclose (camera->pc->lh);
298  lt_dlexit ();
299 #endif
300  camera->pc->lh = NULL;
301  }
302 
303  gp_filesystem_reset (camera->fs);
304 
305  return (GP_OK);
306 }
307 
308 
316 int
318 {
319  int result;
320 
321  C_PARAMS (camera);
322 
323  C_MEM (*camera = calloc (1, sizeof (Camera)));
324 
325  (*camera)->functions = calloc (1, sizeof (CameraFunctions));
326  (*camera)->pc = calloc (1, sizeof (CameraPrivateCore));
327  if (!(*camera)->functions || !(*camera)->pc) {
329  goto error;
330  }
331 
332  (*camera)->pc->ref_count = 1;
333 
334  /* Create the filesystem */
335  result = gp_filesystem_new (&(*camera)->fs);
336  if (result < GP_OK)
337  goto error;
338 
339  /* Create the port */
340  result = gp_port_new (&(*camera)->port);
341  if (result < GP_OK)
342  goto error;
343 
344  return(GP_OK);
345 
346 error:
347  gp_camera_free (*camera);
348  return result;
349 }
350 
351 
367 int
369 {
370  GP_LOG_D ("Setting abilities ('%s')...", abilities.model);
371 
372  C_PARAMS (camera);
373 
374  /*
375  * If the camera is currently initialized, terminate that connection.
376  * We don't care if we are successful or not.
377  */
378  if (camera->pc->lh)
379  gp_camera_exit (camera, NULL);
380 
381  memcpy (&camera->pc->a, &abilities, sizeof (CameraAbilities));
382 
383  return (GP_OK);
384 }
385 
386 
395 int
397 {
398  C_PARAMS (camera && abilities);
399 
400  memcpy (abilities, &camera->pc->a, sizeof (CameraAbilities));
401 
402  return (GP_OK);
403 }
404 
405 
406 int
408 {
409  C_PARAMS (camera && info);
410 
411  CR (camera, gp_port_get_info (camera->port, info), NULL);
412 
413  return (GP_OK);
414 }
415 
416 
417 int
419 {
420  char *name, *path;
421  C_PARAMS (camera);
422 
423  /*
424  * If the camera is currently initialized, terminate that connection.
425  * We don't care if we are successful or not.
426  */
427  if (camera->pc->lh)
428  gp_camera_exit (camera, NULL);
429 
430  gp_port_info_get_name (info, &name);
431  gp_port_info_get_path (info, &path);
432  GP_LOG_D ("Setting port info for port '%s' at '%s'...", name, path);
433  CR (camera, gp_port_set_info (camera->port, info), NULL);
434 
435  return (GP_OK);
436 }
437 
438 
455 int
456 gp_camera_set_port_speed (Camera *camera, int speed)
457 {
458  GPPortSettings settings;
459 
460  C_PARAMS (camera);
461 
462  C_PARAMS_MSG (camera->port,
463  "You need to set a port prior trying to set the speed");
464  C_PARAMS_MSG (camera->port->type == GP_PORT_SERIAL,
465  "You can specify a speed only with serial ports");
466 
467  /*
468  * If the camera is currently initialized, terminate that connection.
469  * We don't care if we are successful or not.
470  */
471  if (camera->pc->lh)
472  gp_camera_exit (camera, NULL);
473 
474  CR (camera, gp_port_get_settings (camera->port, &settings), NULL);
475  settings.serial.speed = speed;
476  CR (camera, gp_port_set_settings (camera->port, settings), NULL);
477  camera->pc->speed = speed;
478 
479  return (GP_OK);
480 }
481 
482 
490 int
492 {
493  C_PARAMS (camera);
494 
495  return (camera->pc->speed);
496 }
497 
498 
506 int
508 {
509  C_PARAMS (camera);
510 
511  camera->pc->ref_count += 1;
512 
513  return (GP_OK);
514 }
515 
516 
527 int
529 {
530  C_PARAMS (camera);
531 
532  if (!camera->pc->ref_count) {
533  GP_LOG_E ("gp_camera_unref on a camera with ref_count == 0 "
534  "should not happen at all");
535  return (GP_ERROR);
536  }
537 
538  camera->pc->ref_count -= 1;
539 
540  if (!camera->pc->ref_count) {
541 
542  /* We cannot free a camera that is currently in use */
543  if (!camera->pc->used)
544  gp_camera_free (camera);
545  }
546 
547  return (GP_OK);
548 }
549 
550 
561 int
563 {
564  C_PARAMS (camera);
565 
566  GP_LOG_D ("Freeing camera...");
567 
568  /*
569  * If the camera is currently initialized, close the connection.
570  * We don't care if we are successful or not.
571  */
572  if (camera->port && camera->pc && camera->pc->lh)
573  gp_camera_exit (camera, NULL);
574 
575  /* We don't care if anything goes wrong */
576  if (camera->port) {
577  gp_port_free (camera->port);
578  camera->port = NULL;
579  }
580 
581  if (camera->pc) {
582  free (camera->pc->timeout_ids);
583  free (camera->pc);
584  camera->pc = NULL;
585  }
586 
587  if (camera->fs) {
588  gp_filesystem_free (camera->fs);
589  camera->fs = NULL;
590  }
591 
592  if (camera->functions) {
593  free (camera->functions);
594  camera->functions = NULL;
595  }
596 
597  free (camera);
598 
599  return (GP_OK);
600 }
601 
617 int
619 {
620  CameraAbilitiesList *al = NULL;
621  GPPortInfoList *il = NULL;
622  int ret, i;
623  CameraList *xlist = NULL;
624 
625  ret = gp_list_new (&xlist);
626  if (ret < GP_OK) goto out;
627  if (!il) {
628  /* Load all the port drivers we have... */
629  ret = gp_port_info_list_new (&il);
630  if (ret < GP_OK) goto out;
631  ret = gp_port_info_list_load (il);
632  if (ret < 0) goto out;
633  ret = gp_port_info_list_count (il);
634  if (ret < 0) goto out;
635  }
636  /* Load all the camera drivers we have... */
637  ret = gp_abilities_list_new (&al);
638  if (ret < GP_OK) goto out;
639  ret = gp_abilities_list_load (al, context);
640  if (ret < GP_OK) goto out;
641 
642  /* ... and autodetect the currently attached cameras. */
643  ret = gp_abilities_list_detect (al, il, xlist, context);
644  if (ret < GP_OK) goto out;
645 
646  /* Filter out the "usb:" entry */
647  ret = gp_list_count (xlist);
648  if (ret < GP_OK) goto out;
649  for (i=0;i<ret;i++) {
650  const char *name, *value;
651 
652  gp_list_get_name (xlist, i, &name);
653  gp_list_get_value (xlist, i, &value);
654  if (!strcmp ("usb:",value)) continue;
655  gp_list_append (list, name, value);
656  }
657 out:
658  if (il) gp_port_info_list_free (il);
659  if (al) gp_abilities_list_free (al);
660  gp_list_free (xlist);
661  if (ret < GP_OK)
662  return ret;
663  return gp_list_count(list);
664 }
665 
682 int
683 gp_camera_init (Camera *camera, GPContext *context)
684 {
685  CameraAbilities a;
686  const char *model, *port;
687  CameraLibraryInitFunc init_func;
688  int result;
689 
690  GP_LOG_D ("Initializing camera...");
691 
692  C_PARAMS (camera);
693  /*
694  * Reset the exit_requested flag. If this flag is set,
695  * gp_camera_exit will be called as soon as the camera is no
696  * longer in use (used flag).
697  */
698  camera->pc->exit_requested = 0;
699 
700  /*
701  * If the model hasn't been indicated, try to
702  * figure it out (USB only). Beware of "Directory Browse".
703  */
704  if (strcasecmp (camera->pc->a.model, "Directory Browse") &&
705  !strcmp ("", camera->pc->a.model)) {
707  GPPortInfoList *il;
708  int m, p;
709  char *ppath;
710  GPPortType ptype;
711  GPPortInfo info;
712  CameraList *list;
713 
714  result = gp_list_new (&list);
715  if (result < GP_OK)
716  return result;
717 
718  GP_LOG_D ("Neither port nor model set. Trying auto-detection...");
719 
720  /* Call auto-detect and choose the first camera */
721  CRSL (camera, gp_abilities_list_new (&al), context, list);
722  CRSL (camera, gp_abilities_list_load (al, context), context, list);
723  CRSL (camera, gp_port_info_list_new (&il), context, list);
724  CRSL (camera, gp_port_info_list_load (il), context, list);
725  CRSL (camera, gp_abilities_list_detect (al, il, list, context), context, list);
726  if (!gp_list_count (list)) {
729  gp_context_error (context, _("Could not detect "
730  "any camera"));
731  gp_list_free (list);
732  return (GP_ERROR_MODEL_NOT_FOUND);
733  }
734  p = 0;
735  CRSL (camera, gp_port_get_info (camera->port, &info), context, list);
736  CRSL (camera, gp_port_info_get_path (info, &ppath), context, list);
737  CRSL (camera, gp_port_info_get_type (info, &ptype), context, list);
738  /* if the port was set before, then use that entry, but not if it is "usb:" */
739  if ((ptype == GP_PORT_USB) && strlen(ppath) && strcmp(ppath, "usb:")) {
740  for (p = gp_list_count (list);p--;) {
741  const char *xp;
742 
743  gp_list_get_value (list, p, &xp);
744  if (!strcmp (xp, ppath))
745  break;
746  }
747  if (p<0) {
750  gp_context_error (context, _("Could not detect any camera at port %s"), ppath);
751  gp_list_free (list);
752  return (GP_ERROR_FILE_NOT_FOUND);
753  }
754  }
755 
756  CRSL (camera, gp_list_get_name (list, p, &model), context, list);
757  m = gp_abilities_list_lookup_model (al, model);
758  CRSL (camera, m, context, list);
759  CRSL (camera, gp_abilities_list_get_abilities (al, m, &a), context, list);
761  CRSL (camera, gp_camera_set_abilities (camera, a), context, list);
762  CRSL (camera, gp_list_get_value (list, p, &port), context, list);
763  p = gp_port_info_list_lookup_path (il, port);
764  CRSL (camera, p, context, list);
765  CRSL (camera, gp_port_info_list_get_info (il, p, &info), context, list);
766  CRSL (camera, gp_camera_set_port_info (camera, info), context, list);
768  gp_list_free (list);
769  }
770 
771  if (strcasecmp (camera->pc->a.model, "Directory Browse")) {
772  switch (camera->port->type) {
773  case GP_PORT_NONE:
774  gp_context_error (context, _("You have to set the "
775  "port prior to initialization of the camera."));
776  return (GP_ERROR_UNKNOWN_PORT);
777  case GP_PORT_USB:
778  if (gp_port_usb_find_device (camera->port,
779  camera->pc->a.usb_vendor,
780  camera->pc->a.usb_product) != GP_OK) {
782  (camera->port,
783  camera->pc->a.usb_class,
784  camera->pc->a.usb_subclass,
785  camera->pc->a.usb_protocol), context);
786  }
787  break;
788  default:
789  break;
790  }
791  }
792 
793  /* Load the library. */
794  GP_LOG_D ("Loading '%s'...", camera->pc->a.library);
795  lt_dlinit ();
796  camera->pc->lh = lt_dlopenext (camera->pc->a.library);
797  if (!camera->pc->lh) {
798  gp_context_error (context, _("Could not load required "
799  "camera driver '%s' (%s)."), camera->pc->a.library,
800  lt_dlerror ());
801  lt_dlexit ();
802  return (GP_ERROR_LIBRARY);
803  }
804 
805  /* Initialize the camera */
806  init_func = lt_dlsym (camera->pc->lh, "camera_init");
807  if (!init_func) {
808  lt_dlclose (camera->pc->lh);
809  lt_dlexit ();
810  camera->pc->lh = NULL;
811  gp_context_error (context, _("Camera driver '%s' is "
812  "missing the 'camera_init' function."),
813  camera->pc->a.library);
814  return (GP_ERROR_LIBRARY);
815  }
816 
817  if (strcasecmp (camera->pc->a.model, "Directory Browse")) {
818  result = gp_port_open (camera->port);
819  if (result < 0) {
820  lt_dlclose (camera->pc->lh);
821  lt_dlexit ();
822  camera->pc->lh = NULL;
823  return (result);
824  }
825  }
826 
827  result = init_func (camera, context);
828  if (result < 0) {
829  gp_port_close (camera->port);
830  lt_dlclose (camera->pc->lh);
831  lt_dlexit ();
832  camera->pc->lh = NULL;
833  memset (camera->functions, 0, sizeof (CameraFunctions));
834  return (result);
835  }
836 
837  /* We don't care if that goes wrong */
838 #ifdef HAVE_MULTI
839  gp_port_close (camera->port);
840 #endif
841 
842  return (GP_OK);
843 }
844 
845 
857 int
858 gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
859 {
860  C_PARAMS (camera);
861  CHECK_INIT (camera, context);
862 
863  if (!camera->functions->get_config) {
864  gp_context_error (context, _("This camera does "
865  "not provide any configuration options."));
866  CAMERA_UNUSED (camera, context);
867  return (GP_ERROR_NOT_SUPPORTED);
868  }
869 
870  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->get_config (
871  camera, window, context), context);
872 
873  CAMERA_UNUSED (camera, context);
874  return (GP_OK);
875 }
876 
877 
890 int
891 gp_camera_get_single_config (Camera *camera, const char *name, CameraWidget **widget, GPContext *context)
892 {
893  CameraWidget *rootwidget, *child;
894  CameraWidgetType type;
895  const char *label;
896  int ret, ro;
897 
898  C_PARAMS (camera);
899  CHECK_INIT (camera, context);
900 
901  if (camera->functions->get_single_config) {
903  camera, name, widget, context), context);
904 
905  CAMERA_UNUSED (camera, context);
906  return GP_OK;
907  }
908 
909  if (!camera->functions->get_config) {
910  gp_context_error (context, _("This camera does not provide any configuration options."));
911  CAMERA_UNUSED (camera, context);
912  return GP_ERROR_NOT_SUPPORTED;
913  }
914  /* emulate it ... */
915  CHECK_OPEN (camera, context);
916 
917  ret = camera->functions->get_config ( camera, &rootwidget, context);
918  if (ret != GP_OK) {
919  CHECK_CLOSE (camera, context);
920  CAMERA_UNUSED (camera, context);
921  return ret;
922  }
923  ret = gp_widget_get_child_by_name (rootwidget, name, &child);
924  if (ret != GP_OK) {
925  gp_widget_free (rootwidget);
926  CHECK_CLOSE (camera, context);
927  CAMERA_UNUSED (camera, context);
928  return ret;
929  }
930 
931  /* We need to duplicate the widget, as we will free the widgettree */
932  gp_widget_get_type (child, &type);
933  gp_widget_get_label (child, &label);
934  gp_widget_get_readonly (child, &ro);
935 
936  ret = gp_widget_new (type, label, widget);
937  if (ret != GP_OK)
938  goto out;
939  gp_widget_set_name (*widget, name);
940  gp_widget_set_readonly (*widget, ro);
941 
942  switch (type) {
943  case GP_WIDGET_MENU:
944  case GP_WIDGET_RADIO: {
945  char *value;
946  int i, nrofchoices;
947 
948  nrofchoices = gp_widget_count_choices (child);
949  for (i = 0; i < nrofchoices; i++) {
950  const char *choice;
951 
952  gp_widget_get_choice (child, i, &choice);
953  gp_widget_add_choice (*widget, choice);
954  }
955  gp_widget_get_value (child, &value);
956  gp_widget_set_value (*widget, value);
957  break;
958  }
959  case GP_WIDGET_TEXT: {
960  char *value;
961 
962  gp_widget_get_value (child, &value);
963  gp_widget_set_value (*widget, value);
964  break;
965  }
966  case GP_WIDGET_RANGE: {
967  float value, rmin, rmax, rstep;
968 
969  gp_widget_get_range (child, &rmin, &rmax, &rstep);
970  gp_widget_set_range (*widget, rmin, rmax, rstep);
971  gp_widget_get_value (child, &value);
972  gp_widget_set_value (*widget, &value);
973  break;
974  }
975  case GP_WIDGET_TOGGLE:
976  case GP_WIDGET_DATE: {
977  int value;
978 
979  gp_widget_get_value (child, &value);
980  gp_widget_set_value (*widget, &value);
981  break;
982  }
983  case GP_WIDGET_BUTTON:
984  case GP_WIDGET_SECTION:
985  case GP_WIDGET_WINDOW:
986  default:
988  break;
989  }
990 out:
991  gp_widget_free (rootwidget);
992  CHECK_CLOSE (camera, context);
993  CAMERA_UNUSED (camera, context);
994  return ret;
995 }
996 
997 
1010 static void
1012 {
1013  CameraWidgetType type;
1014 
1015  gp_widget_get_type (widget, &type);
1016  switch (type) {
1017  case GP_WIDGET_MENU:
1018  case GP_WIDGET_RADIO:
1019  case GP_WIDGET_TEXT:
1020  case GP_WIDGET_RANGE:
1021  case GP_WIDGET_TOGGLE:
1022  case GP_WIDGET_DATE: {
1023  const char *name;
1024 
1025  gp_widget_get_name (widget, &name);
1026  gp_list_append (list, name, NULL);
1027  break;
1028  }
1029  case GP_WIDGET_SECTION:
1030  case GP_WIDGET_WINDOW: {
1031  int i, nrofchildren;
1032 
1033  nrofchildren = gp_widget_count_children (widget);
1034  for (i = 0; i < nrofchildren; i++) {
1035  CameraWidget *child;
1036 
1037  gp_widget_get_child (widget, i, &child);
1038  _get_widget_names (child, list);
1039  }
1040  break;
1041  }
1042  case GP_WIDGET_BUTTON:
1043  default:
1044  break;
1045  }
1046 
1047 }
1048 
1049 int
1051 {
1052  CameraWidget *rootwidget;
1053  int ret;
1054  C_PARAMS (camera);
1055  CHECK_INIT (camera, context);
1056 
1057  if (camera->functions->list_config) {
1058  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->list_config (
1059  camera, list, context), context);
1060 
1061  CAMERA_UNUSED (camera, context);
1062  return GP_OK;
1063  }
1064  if (!camera->functions->get_config) {
1065  gp_context_error (context, _("This camera does not provide any configuration options."));
1066  CAMERA_UNUSED (camera, context);
1067  return GP_ERROR_NOT_SUPPORTED;
1068  }
1069  /* emulate it ... */
1070  CHECK_OPEN (camera, context);
1071 
1072  ret = camera->functions->get_config ( camera, &rootwidget, context);
1073  if (ret != GP_OK) {
1074  CHECK_CLOSE (camera, context);
1075  CAMERA_UNUSED (camera, context);
1076  return ret;
1077  }
1078 
1079  _get_widget_names (rootwidget, list);
1080 
1081 
1082  gp_widget_free (rootwidget);
1083  CHECK_CLOSE (camera, context);
1084  CAMERA_UNUSED (camera, context);
1085  return ret;
1086 }
1087 
1088 
1101 int
1103 {
1104  C_PARAMS (camera && window);
1105  CHECK_INIT (camera, context);
1106 
1107  if (!camera->functions->set_config) {
1108  gp_context_error (context, _("This camera does "
1109  "not support setting configuration options."));
1110  CAMERA_UNUSED (camera, context);
1111  return (GP_ERROR_NOT_SUPPORTED);
1112  }
1113 
1114  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->set_config (camera,
1115  window, context), context);
1116 
1117  CAMERA_UNUSED (camera, context);
1118  return (GP_OK);
1119 }
1120 
1133 int
1134 gp_camera_set_single_config (Camera *camera, const char *name, CameraWidget *widget, GPContext *context)
1135 {
1136  CameraWidget *rootwidget, *child;
1137  CameraWidgetType type;
1138  int ret;
1139 
1140  C_PARAMS (camera);
1141  CHECK_INIT (camera, context);
1142 
1143  if (camera->functions->set_single_config) {
1145  camera, name, widget, context), context);
1146 
1147  CAMERA_UNUSED (camera, context);
1148  return GP_OK;
1149  }
1150 
1151  if (!camera->functions->set_config) {
1152  gp_context_error (context, _("This camera does not provide any configuration options."));
1153  CAMERA_UNUSED (camera, context);
1154  return GP_ERROR_NOT_SUPPORTED;
1155  }
1156  /* emulate single config with the full tree */
1157  CHECK_OPEN (camera, context);
1158 
1159  ret = camera->functions->get_config ( camera, &rootwidget, context);
1160  if (ret != GP_OK) {
1161  CHECK_CLOSE (camera, context);
1162  CAMERA_UNUSED (camera, context);
1163  return ret;
1164  }
1165  ret = gp_widget_get_child_by_name (rootwidget, name, &child);
1166  if (ret != GP_OK) {
1167  gp_widget_free (rootwidget);
1168  CHECK_CLOSE (camera, context);
1169  CAMERA_UNUSED (camera, context);
1170  return ret;
1171  }
1172 
1173  gp_widget_get_type (child, &type);
1174  ret = GP_OK;
1175  switch (type) {
1176  case GP_WIDGET_MENU:
1177  case GP_WIDGET_RADIO:
1178  case GP_WIDGET_TEXT: {
1179  char *value;
1180 
1181  gp_widget_get_value (widget, &value);
1182  gp_widget_set_value (child, value);
1183  break;
1184  }
1185  case GP_WIDGET_RANGE: {
1186  float value;
1187 
1188  gp_widget_get_value (widget, &value);
1189  gp_widget_set_value (child, &value);
1190  break;
1191  }
1192  case GP_WIDGET_TOGGLE:
1193  case GP_WIDGET_DATE: {
1194  int value;
1195 
1196  gp_widget_get_value (widget, &value);
1197  gp_widget_set_value (child, &value);
1198  break;
1199  }
1200  case GP_WIDGET_BUTTON:
1201  case GP_WIDGET_SECTION:
1202  case GP_WIDGET_WINDOW:
1203  default:
1205  break;
1206  }
1207  gp_widget_set_changed (child, 1);
1208 
1209  if (ret == GP_OK)
1210  ret = camera->functions->set_config (camera, rootwidget, context);
1211  gp_widget_free (rootwidget);
1212  CHECK_CLOSE (camera, context);
1213  CAMERA_UNUSED (camera, context);
1214  return ret;
1215 }
1216 
1217 
1230 int
1231 gp_camera_get_summary (Camera *camera, CameraText *summary, GPContext *context)
1232 {
1233  C_PARAMS (camera && summary);
1234  CHECK_INIT (camera, context);
1235 
1236  if (!camera->functions->summary) {
1237  gp_context_error (context, _("This camera does "
1238  "not support summaries."));
1239  CAMERA_UNUSED (camera, context);
1240  return (GP_ERROR_NOT_SUPPORTED);
1241  }
1242 
1243  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->summary (camera,
1244  summary, context), context);
1245 
1246  CAMERA_UNUSED (camera, context);
1247  return (GP_OK);
1248 }
1249 
1261 int
1262 gp_camera_get_manual (Camera *camera, CameraText *manual, GPContext *context)
1263 {
1264  C_PARAMS (camera && manual);
1265  CHECK_INIT (camera, context);
1266 
1267  if (!camera->functions->manual) {
1268  gp_context_error (context, _("This camera "
1269  "does not provide a manual."));
1270  CAMERA_UNUSED (camera, context);
1271  return (GP_ERROR_NOT_SUPPORTED);
1272  }
1273 
1274  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->manual (camera,
1275  manual, context), context);
1276 
1277  CAMERA_UNUSED (camera, context);
1278  return (GP_OK);
1279 }
1280 
1293 int
1294 gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context)
1295 {
1296  C_PARAMS (camera && about);
1297  CHECK_INIT (camera, context);
1298 
1299  if (!camera->functions->about) {
1300  gp_context_error (context, _("This camera does "
1301  "not provide information about the driver."));
1302  CAMERA_UNUSED (camera, context);
1303  return (GP_ERROR_NOT_SUPPORTED);
1304  }
1305 
1306  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->about (camera,
1307  about, context), context);
1308 
1309  CAMERA_UNUSED (camera, context);
1310  return (GP_OK);
1311 }
1312 
1326 int
1328  CameraFilePath *path, GPContext *context)
1329 {
1330  C_PARAMS (camera);
1331  CHECK_INIT (camera, context);
1332 
1333  if (!camera->functions->capture) {
1334  gp_context_error (context, _("This camera can not capture."));
1335  CAMERA_UNUSED (camera, context);
1336  return (GP_ERROR_NOT_SUPPORTED);
1337  }
1338 
1339  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->capture (camera,
1340  type, path, context), context);
1341 
1342  CAMERA_UNUSED (camera, context);
1343  return (GP_OK);
1344 }
1345 
1357 int
1359 {
1360  C_PARAMS (camera);
1361  CHECK_INIT (camera, context);
1362 
1363  if (!camera->functions->trigger_capture) {
1364  gp_context_error (context, _("This camera can not trigger capture."));
1365  CAMERA_UNUSED (camera, context);
1366  return (GP_ERROR_NOT_SUPPORTED);
1367  }
1368  CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->trigger_capture (camera,
1369  context), context);
1370  CAMERA_UNUSED (camera, context);
1371  return (GP_OK);
1372 }
1373 
1387 int
1389 {
1390  char *xname;
1391  C_PARAMS (camera && file);
1392  CHECK_INIT (camera, context);
1393 
1394  CR (camera, gp_file_clean (file), context);
1395 
1396  if (!camera->functions->capture_preview) {
1397  gp_context_error (context, _("This camera can "
1398  "not capture previews."));
1399  CAMERA_UNUSED (camera, context);
1400  return (GP_ERROR_NOT_SUPPORTED);
1401  }
1402 
1404  camera, file, context), context);
1405  gp_file_get_name_by_type (file, "capture_preview", GP_FILE_TYPE_NORMAL, &xname);
1406  /* FIXME: Marcus ... will go away, just keep compatible now. */
1407  gp_file_set_name (file, xname);
1408  free (xname);
1409 
1410  CAMERA_UNUSED (camera, context);
1411  return (GP_OK);
1412 }
1413 
1414 
1437 int
1438 gp_camera_wait_for_event (Camera *camera, int timeout,
1439  CameraEventType *eventtype, void **eventdata,
1440  GPContext *context)
1441 {
1442  C_PARAMS (camera);
1443  CHECK_INIT (camera, context);
1444 
1445  if (!camera->functions->wait_for_event) {
1446  CAMERA_UNUSED (camera, context);
1447  return (GP_ERROR_NOT_SUPPORTED);
1448  }
1450  camera, timeout, eventtype, eventdata,
1451  context), context);
1452  CAMERA_UNUSED (camera, context);
1453  return (GP_OK);
1454 }
1455 
1466 int
1467 gp_camera_folder_list_files (Camera *camera, const char *folder,
1468  CameraList *list, GPContext *context)
1469 {
1470  GP_LOG_D ("Listing files in '%s'...", folder);
1471 
1472  C_PARAMS (camera && folder && list);
1473  CHECK_INIT (camera, context);
1474  CR (camera, gp_list_reset (list), context);
1475 
1477  folder, list, context), context);
1478 
1479  CR (camera, gp_list_sort (list), context);
1480  CAMERA_UNUSED (camera, context);
1481  return (GP_OK);
1482 }
1483 
1494 int
1495 gp_camera_folder_list_folders (Camera *camera, const char* folder,
1496  CameraList *list, GPContext *context)
1497 {
1498  GP_LOG_D ("Listing folders in '%s'...", folder);
1499 
1500  C_PARAMS (camera && folder && list);
1501  CHECK_INIT (camera, context);
1502  CR (camera, gp_list_reset (list), context);
1503 
1505  camera->fs, folder, list, context), context);
1506 
1507  CR (camera, gp_list_sort (list), context);
1508  CAMERA_UNUSED (camera, context);
1509  return (GP_OK);
1510 }
1511 
1521 int
1522 gp_camera_folder_delete_all (Camera *camera, const char *folder,
1523  GPContext *context)
1524 {
1525  GP_LOG_D ("Deleting all files in '%s'...", folder);
1526 
1527  C_PARAMS (camera && folder);
1528  CHECK_INIT (camera, context);
1529 
1531  folder, context), context);
1532 
1533  CAMERA_UNUSED (camera, context);
1534  return (GP_OK);
1535 }
1536 
1547 int
1549  const char *folder, const char *filename,
1550  CameraFileType type,
1551  CameraFile *file, GPContext *context)
1552 {
1553  GP_LOG_D ("Uploading file into '%s'...",
1554  folder);
1555 
1556  C_PARAMS (camera && folder && file);
1557  CHECK_INIT (camera, context);
1558 
1560  folder, filename, type, file, context), context);
1561 
1562  CAMERA_UNUSED (camera, context);
1563  return (GP_OK);
1564 }
1565 
1577 int
1578 gp_camera_file_get_info (Camera *camera, const char *folder,
1579  const char *file, CameraFileInfo *info,
1580  GPContext *context)
1581 {
1582  int result = GP_OK;
1583  const char *mime_type;
1584  const char *data;
1585  /* long int size; */
1586  CameraFile *cfile;
1587 
1588  GP_LOG_D ("Getting file info for '%s' in '%s'...", file, folder);
1589 
1590  C_PARAMS (camera && folder && file && info);
1591  CHECK_INIT (camera, context);
1592 
1593  memset (info, 0, sizeof (CameraFileInfo));
1594 
1595  /* Check first if the camera driver supports the filesystem */
1596  CHECK_OPEN (camera, context);
1597  result = gp_filesystem_get_info (camera->fs, folder, file, info,
1598  context);
1599  CHECK_CLOSE (camera, context);
1600  if (result != GP_ERROR_NOT_SUPPORTED) {
1601  CAMERA_UNUSED (camera, context);
1602  return (result);
1603  }
1604 
1605  /*
1606  * The CameraFilesystem doesn't support file info. We simply get
1607  * the preview and the file and look for ourselves...
1608  */
1609 
1610  /* It takes too long to get the file */
1611  info->file.fields = GP_FILE_INFO_NONE;
1612 
1613  /* Get the preview */
1615  CRS (camera, gp_file_new (&cfile), context);
1616  if (gp_camera_file_get (camera, folder, file, GP_FILE_TYPE_PREVIEW,
1617  cfile, context) == GP_OK) {
1618  unsigned long size;
1620  gp_file_get_data_and_size (cfile, &data, &size);
1621  info->preview.size = size;
1622  gp_file_get_mime_type (cfile, &mime_type);
1623  strncpy (info->preview.type, mime_type,
1624  sizeof (info->preview.type));
1625  }
1626  gp_file_unref (cfile);
1627 
1628  CAMERA_UNUSED (camera, context);
1629  return (GP_OK);
1630 }
1631 
1643 int
1644 gp_camera_file_set_info (Camera *camera, const char *folder,
1645  const char *file, CameraFileInfo info,
1646  GPContext *context)
1647 {
1648  C_PARAMS (camera && folder && file);
1649  CHECK_INIT (camera, context);
1650 
1652  folder, file, info, context), context);
1653 
1654  CAMERA_UNUSED (camera, context);
1655  return (GP_OK);
1656 }
1657 
1670 int
1671 gp_camera_file_get (Camera *camera, const char *folder, const char *file,
1672  CameraFileType type, CameraFile *camera_file,
1673  GPContext *context)
1674 {
1675  GP_LOG_D ("Getting file '%s' in folder '%s'...", file, folder);
1676 
1677  C_PARAMS (camera && folder && file && camera_file);
1678  CHECK_INIT (camera, context);
1679 
1680  CR (camera, gp_file_clean (camera_file), context);
1681 
1682  /* Did we get reasonable foldername/filename? */
1683  if (strlen (folder) == 0) {
1684  CAMERA_UNUSED (camera, context);
1686  }
1687  if (strlen (file) == 0) {
1688  CAMERA_UNUSED (camera, context);
1689  return (GP_ERROR_FILE_NOT_FOUND);
1690  }
1691 
1693  folder, file, type, camera_file, context), context);
1694 
1695  CAMERA_UNUSED (camera, context);
1696  return (GP_OK);
1697 }
1698 
1713 int
1714 gp_camera_file_read (Camera *camera, const char *folder, const char *file,
1715  CameraFileType type,
1716  uint64_t offset, char *buf, uint64_t *size,
1717  GPContext *context)
1718 {
1719  GP_LOG_D ("Getting file '%s' in folder '%s'...", file, folder);
1720 
1721  C_PARAMS (camera && folder && file && buf && size);
1722  CHECK_INIT (camera, context);
1723 
1724  /* Did we get reasonable foldername/filename? */
1725  if (strlen (folder) == 0) {
1726  CAMERA_UNUSED (camera, context);
1728  }
1729  if (strlen (file) == 0) {
1730  CAMERA_UNUSED (camera, context);
1731  return (GP_ERROR_FILE_NOT_FOUND);
1732  }
1733 
1735  folder, file, type, offset, buf, size, context), context);
1736 
1737  CAMERA_UNUSED (camera, context);
1738  return (GP_OK);
1739 }
1740 
1751 int
1752 gp_camera_file_delete (Camera *camera, const char *folder, const char *file,
1753  GPContext *context)
1754 {
1755  GP_LOG_D ("Deleting file '%s' in folder '%s'...", file, folder);
1756 
1757  C_PARAMS (camera && folder && file);
1758  CHECK_INIT (camera, context);
1759 
1761  camera->fs, folder, file, context), context);
1762 
1763  CAMERA_UNUSED (camera, context);
1764  return (GP_OK);
1765 }
1766 
1777 int
1778 gp_camera_folder_make_dir (Camera *camera, const char *folder,
1779  const char *name, GPContext *context)
1780 {
1781  C_PARAMS (camera && folder && name);
1782  CHECK_INIT (camera, context);
1783 
1785  folder, name, context), context);
1786 
1787  CAMERA_UNUSED (camera, context);
1788  return (GP_OK);
1789 }
1790 
1801 int
1802 gp_camera_folder_remove_dir (Camera *camera, const char *folder,
1803  const char *name, GPContext *context)
1804 {
1805  C_PARAMS (camera && folder && name);
1806  CHECK_INIT (camera, context);
1807 
1809  folder, name, context), context);
1810 
1811  CAMERA_UNUSED (camera, context);
1812  return (GP_OK);
1813 }
1814 
1836 int
1838  Camera *camera, CameraStorageInformation **sifs,
1839  int *nrofsifs, GPContext *context)
1840 {
1841  C_PARAMS (camera && sifs && nrofsifs);
1842  CHECK_INIT (camera, context);
1843 
1844  CHECK_RESULT_OPEN_CLOSE (camera,
1846  camera->fs, sifs, nrofsifs, context
1847  ),
1848  context
1849  );
1850  CAMERA_UNUSED (camera, context);
1851  return (GP_OK);
1852 }
1853 
1866 void
1868  CameraTimeoutStopFunc stop_func,
1869  void *data)
1870 {
1871  if (!camera || !camera->pc)
1872  return;
1873 
1874  camera->pc->timeout_start_func = start_func;
1875  camera->pc->timeout_stop_func = stop_func;
1876  camera->pc->timeout_data = data;
1877 }
1878 
1879 
1892 int
1893 gp_camera_start_timeout (Camera *camera, unsigned int timeout,
1894  CameraTimeoutFunc func)
1895 {
1896  int id;
1897 
1898  C_PARAMS (camera && camera->pc);
1899 
1900  if (!camera->pc->timeout_start_func)
1901  return (GP_ERROR_NOT_SUPPORTED);
1902 
1903  /*
1904  * We remember the id here in order to automatically remove
1905  * the timeout on gp_camera_exit.
1906  */
1907  C_MEM (camera->pc->timeout_ids =
1908  realloc (camera->pc->timeout_ids, sizeof (int) *
1909  (camera->pc->timeout_ids_len + 1)));
1910 
1911  id = camera->pc->timeout_start_func (camera, timeout, func,
1912  camera->pc->timeout_data);
1913  if (id < 0)
1914  return (id);
1915  camera->pc->timeout_ids[camera->pc->timeout_ids_len] = id;
1916  camera->pc->timeout_ids_len++;
1917 
1918  return (id);
1919 }
1920 
1921 
1933 void
1934 gp_camera_stop_timeout (Camera *camera, unsigned int id)
1935 {
1936  unsigned int i;
1937 
1938  if (!camera || !camera->pc)
1939  return;
1940 
1941  if (!camera->pc->timeout_stop_func)
1942  return;
1943 
1944  /* Check if we know this id. If yes, remove it. */
1945  for (i = 0; i < camera->pc->timeout_ids_len; i++)
1946  if (camera->pc->timeout_ids[i] == id)
1947  break;
1948  if (i == camera->pc->timeout_ids_len)
1949  return;
1950  memmove (camera->pc->timeout_ids + i, camera->pc->timeout_ids + i + 1,
1951  sizeof (int) * (camera->pc->timeout_ids_len - i - 1));
1952  camera->pc->timeout_ids_len--;
1953  camera->pc->timeout_ids = realloc (camera->pc->timeout_ids,
1954  sizeof (int) * camera->pc->timeout_ids_len);
1955 
1956  camera->pc->timeout_stop_func (camera, id, camera->pc->timeout_data);
1957 }
gp_camera_get_port_info
int gp_camera_get_port_info(Camera *camera, GPPortInfo *info)
Definition: gphoto2-camera.c:407
gp_file_unref
int gp_file_unref(CameraFile *file)
Decrease reference counter for CameraFile object.
Definition: gphoto2-file.c:184
gp_abilities_list_detect
int gp_abilities_list_detect(CameraAbilitiesList *list, GPPortInfoList *info_list, CameraList *l, GPContext *context)
Definition: gphoto2-abilities-list.c:400
gp_camera_file_read
int gp_camera_file_read(Camera *camera, const char *folder, const char *file, CameraFileType type, uint64_t offset, char *buf, uint64_t *size, GPContext *context)
Definition: gphoto2-camera.c:1714
CameraAbilities
Describes the properties of a specific camera.
Definition: gphoto2-abilities-list.h:120
_GPPortInfo
Definition: gphoto2-port-info.h:32
gp_camera_capture_preview
int gp_camera_capture_preview(Camera *camera, CameraFile *file, GPContext *context)
Definition: gphoto2-camera.c:1388
gp_port_info_get_path
int gp_port_info_get_path(GPPortInfo info, char **path)
Get path of a specific port entry.
Definition: gphoto2-port-info-list.c:523
gp_widget_set_value
int gp_widget_set_value(CameraWidget *widget, const void *value)
Sets the value of the widget.
Definition: gphoto2-widget.c:384
_CameraPrivateCore
Definition: gphoto2-camera.c:219
gp_port_get_info
int gp_port_get_info(GPPort *port, GPPortInfo *info)
Retreives information about the port.
Definition: gphoto2-port.c:255
gp_camera_folder_remove_dir
int gp_camera_folder_remove_dir(Camera *camera, const char *folder, const char *name, GPContext *context)
Definition: gphoto2-camera.c:1802
gp_camera_set_port_speed
int gp_camera_set_port_speed(Camera *camera, int speed)
Definition: gphoto2-camera.c:456
gp_file_new
int gp_file_new(CameraFile **file)
Definition: gphoto2-file.c:83
gp_camera_ref
int gp_camera_ref(Camera *camera)
Definition: gphoto2-camera.c:507
gp_widget_count_children
int gp_widget_count_children(CameraWidget *widget)
Counts the children of the CameraWidget.
Definition: gphoto2-widget.c:529
gp_port_get_settings
int gp_port_get_settings(GPPort *port, GPPortSettings *settings)
Get the current port settings.
Definition: gphoto2-port.c:632
CameraAbilities::model
char model[128]
name of camera model
Definition: gphoto2-abilities-list.h:121
_CameraFunctions::set_single_config
CameraSetSingleConfigFunc set_single_config
Called for setting a single configuration widget.
Definition: gphoto2-camera.h:297
CameraAbilities::usb_vendor
int usb_vendor
USB Vendor D.
Definition: gphoto2-abilities-list.h:134
gp_camera_file_delete
int gp_camera_file_delete(Camera *camera, const char *folder, const char *file, GPContext *context)
Definition: gphoto2-camera.c:1752
CHECK_RESULT_OPEN_CLOSE
#define CHECK_RESULT_OPEN_CLOSE(c, result, ctx)
Definition: gphoto2-camera.c:195
gp_filesystem_get_info
int gp_filesystem_get_info(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo *info, GPContext *context)
Get information about the specified file.
Definition: gphoto2-filesys.c:1857
CAMERA_UNUSED
#define CAMERA_UNUSED(c, ctx)
Definition: gphoto2-camera.c:60
CHECK_CLOSE
#define CHECK_CLOSE(c, ctx)
Definition: gphoto2-camera.c:162
_GPPortInfoList
Definition: gphoto2-port-info-list.c:74
gp_list_get_name
int gp_list_get_name(CameraList *list, int index, const char **name)
Definition: gphoto2-list.c:280
gp_abilities_list_lookup_model
int gp_abilities_list_lookup_model(CameraAbilitiesList *list, const char *model)
Search the list for an entry of given model name.
Definition: gphoto2-abilities-list.c:607
gp_filesystem_make_dir
int gp_filesystem_make_dir(CameraFilesystem *fs, const char *folder, const char *name, GPContext *context)
Create a subfolder within a folder.
Definition: gphoto2-filesys.c:1183
GP_ERROR_FILE_NOT_FOUND
#define GP_ERROR_FILE_NOT_FOUND
Specified file was not found.
Definition: gphoto2-result.h:75
gp_camera_get_storageinfo
int gp_camera_get_storageinfo(Camera *camera, CameraStorageInformation **sifs, int *nrofsifs, GPContext *context)
Gets information on the camera attached storage.
Definition: gphoto2-camera.c:1837
CameraWidgetType
CameraWidgetType
Type of the widget to be created.
Definition: gphoto2-widget.h:54
_CameraFunctions::trigger_capture
CameraTriggerCaptureFunc trigger_capture
Remote control the camera to trigger capture.
Definition: gphoto2-camera.h:301
gp_port_info_list_lookup_path
int gp_port_info_list_lookup_path(GPPortInfoList *list, const char *path)
Lookup a specific path in the list.
Definition: gphoto2-port-info-list.c:336
gp_port_new
int gp_port_new(GPPort **port)
Create new GPPort.
Definition: gphoto2-port.c:94
GP_ERROR_UNKNOWN_PORT
#define GP_ERROR_UNKNOWN_PORT
Unknown libgphoto2 port passed.
Definition: gphoto2-port-result.h:50
gp_abilities_list_load
int gp_abilities_list_load(CameraAbilitiesList *list, GPContext *context)
Scans the system for camera drivers.
Definition: gphoto2-abilities-list.c:302
CR
#define CR(c, result, ctx)
Definition: gphoto2-camera.c:71
_CameraFileInfo::preview
CameraFileInfoPreview preview
Definition: gphoto2-filesys.h:142
gp_port_set_info
int gp_port_set_info(GPPort *port, GPPortInfo info)
Configure a port.
Definition: gphoto2-port.c:149
CameraFile
File structure.
GP_FILE_INFO_TYPE
@ GP_FILE_INFO_TYPE
The MIME type is set.
Definition: gphoto2-filesys.h:57
_CameraFunctions::get_config
CameraGetConfigFunc get_config
Called for requesting the configuration widgets.
Definition: gphoto2-camera.h:292
gp_camera_set_timeout_funcs
void gp_camera_set_timeout_funcs(Camera *camera, CameraTimeoutStartFunc start_func, CameraTimeoutStopFunc stop_func, void *data)
Definition: gphoto2-camera.c:1867
gp_list_count
int gp_list_count(CameraList *list)
Definition: gphoto2-list.c:229
gp_port_set_settings
int gp_port_set_settings(GPPort *port, GPPortSettings settings)
Set port settings.
Definition: gphoto2-port.c:590
_CameraPrivateCore::exit_requested
unsigned char exit_requested
Definition: gphoto2-camera.c:234
_CameraPrivateCore::error
char error[2048]
Definition: gphoto2-camera.c:230
gp_camera_file_get_info
int gp_camera_file_get_info(Camera *camera, const char *folder, const char *file, CameraFileInfo *info, GPContext *context)
Definition: gphoto2-camera.c:1578
_CameraPrivateCore::speed
unsigned int speed
Definition: gphoto2-camera.c:222
CameraAbilities::usb_product
int usb_product
USB Product ID.
Definition: gphoto2-abilities-list.h:135
gp_filesystem_reset
int gp_filesystem_reset(CameraFilesystem *fs)
Clear the filesystem.
Definition: gphoto2-filesys.c:631
GP_FILE_TYPE_PREVIEW
@ GP_FILE_TYPE_PREVIEW
Definition: gphoto2-file.h:74
_CameraFunctions::capture_preview
CameraCapturePreviewFunc capture_preview
Preview viewfinder content.
Definition: gphoto2-camera.h:302
gp_port_info_list_load
int gp_port_info_list_load(GPPortInfoList *list)
Load system ports.
Definition: gphoto2-port-info-list.c:274
CameraAbilities::library
char library[1024]
(Internal) library filename
Definition: gphoto2-abilities-list.h:141
gp_list_reset
int gp_list_reset(CameraList *list)
Definition: gphoto2-list.c:148
gp_widget_set_name
int gp_widget_set_name(CameraWidget *widget, const char *name)
Sets the name of the widget.
Definition: gphoto2-widget.c:250
GP_ERROR_NO_MEMORY
#define GP_ERROR_NO_MEMORY
Out of memory.
Definition: gphoto2-port-result.h:42
gp_camera_set_single_config
int gp_camera_set_single_config(Camera *camera, const char *name, CameraWidget *widget, GPContext *context)
Definition: gphoto2-camera.c:1134
_CameraFunctions::capture
CameraCaptureFunc capture
Remote control the camera to capture.
Definition: gphoto2-camera.h:300
CameraFileType
CameraFileType
The type of view on the specified file.
Definition: gphoto2-file.h:73
gp_file_get_data_and_size
int gp_file_get_data_and_size(CameraFile *file, const char **data, unsigned long int *size)
Definition: gphoto2-file.c:398
gp_list_get_value
int gp_list_get_value(CameraList *list, int index, const char **value)
Definition: gphoto2-list.c:301
gp_port_usb_find_device
int gp_port_usb_find_device(GPPort *port, int idvendor, int idproduct)
Find USB device by vendor/product.
Definition: gphoto2-port.c:790
result
int result
Definition: gphoto2-result.c:44
gp_file_set_name
int gp_file_set_name(CameraFile *file, const char *name)
Definition: gphoto2-file.c:996
gp_list_free
int gp_list_free(CameraList *list)
Definition: gphoto2-list.c:120
gp_port_open
int gp_port_open(GPPort *port)
Open a port.
Definition: gphoto2-port.c:273
_CameraPrivateCore::timeout_stop_func
CameraTimeoutStopFunc timeout_stop_func
Definition: gphoto2-camera.c:240
gp_filesystem_set_info
int gp_filesystem_set_info(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo info, GPContext *context)
Set information about a file.
Definition: gphoto2-filesys.c:2367
GP_ERROR_MODEL_NOT_FOUND
#define GP_ERROR_MODEL_NOT_FOUND
Specified camera model was not found.
Definition: gphoto2-result.h:59
gp_camera_new
int gp_camera_new(Camera **camera)
Definition: gphoto2-camera.c:317
gp_camera_get_port_speed
int gp_camera_get_port_speed(Camera *camera)
Definition: gphoto2-camera.c:491
gp_filesystem_delete_file
int gp_filesystem_delete_file(CameraFilesystem *fs, const char *folder, const char *filename, GPContext *context)
Delete a file from a folder.
Definition: gphoto2-filesys.c:1113
gp_port_free
int gp_port_free(GPPort *port)
Free the port structure.
Definition: gphoto2-port.c:341
gp_port_info_list_get_info
int gp_port_info_list_get_info(GPPortInfoList *list, int n, GPPortInfo *info)
Get port information of specific entry.
Definition: gphoto2-port-info-list.c:460
_CameraFileInfoPreview::fields
CameraFileInfoFields fields
Bitmask containing the set members.
Definition: gphoto2-filesys.h:113
CameraLibraryInitFunc
int(* CameraLibraryInitFunc)(Camera *camera, GPContext *context)
Initializes the camera.
Definition: gphoto2-library.h:65
gp_filesystem_free
int gp_filesystem_free(CameraFilesystem *fs)
Free filesystem struct.
Definition: gphoto2-filesys.c:686
GP_FILE_TYPE_NORMAL
@ GP_FILE_TYPE_NORMAL
Definition: gphoto2-file.h:75
_Camera
Definition: gphoto2-camera.h:325
_CameraFunctions::wait_for_event
CameraWaitForEvent wait_for_event
Wait for a specific event from the camera.
Definition: gphoto2-camera.h:310
gp_list_append
int gp_list_append(CameraList *list, const char *name, const char *value)
Definition: gphoto2-list.c:174
_CameraFileInfoFile::fields
CameraFileInfoFields fields
Bitmask containing the set members.
Definition: gphoto2-filesys.h:96
gp_widget_get_choice
int gp_widget_get_choice(CameraWidget *widget, int choice_number, const char **choice)
Retrieves the choice number choice_number.
Definition: gphoto2-widget.c:799
gp_widget_get_value
int gp_widget_get_value(CameraWidget *widget, void *value)
Retrieves the value of the CameraWidget.
Definition: gphoto2-widget.c:434
_GPPortSettings::serial
GPPortSettingsSerial serial
Serial specific settings.
Definition: gphoto2-port.h:115
gp_camera_folder_make_dir
int gp_camera_folder_make_dir(Camera *camera, const char *folder, const char *name, GPContext *context)
Definition: gphoto2-camera.c:1778
gp_filesystem_put_file
int gp_filesystem_put_file(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
Upload a file to a folder on the device filesystem.
Definition: gphoto2-filesys.c:1292
gphoto2-result.h
_CameraPrivateCore::ref_count
unsigned int ref_count
Definition: gphoto2-camera.c:232
CHECK_OPEN
#define CHECK_OPEN(c, ctx)
Definition: gphoto2-camera.c:136
_CameraPrivateCore::initialized
int initialized
Definition: gphoto2-camera.c:236
gp_widget_add_choice
int gp_widget_add_choice(CameraWidget *widget, const char *choice)
Adds a choice to the CameraWidget.
Definition: gphoto2-widget.c:760
_CameraFunctions::get_single_config
CameraGetSingleConfigFunc get_single_config
Called for requesteing a single widget.
Definition: gphoto2-camera.h:296
gp_camera_get_abilities
int gp_camera_get_abilities(Camera *camera, CameraAbilities *abilities)
Definition: gphoto2-camera.c:396
gp_abilities_list_new
int gp_abilities_list_new(CameraAbilitiesList **list)
Allocate the memory for a new abilities list.
Definition: gphoto2-abilities-list.c:101
gp_widget_get_type
int gp_widget_get_type(CameraWidget *widget, CameraWidgetType *type)
Retrieves the type of the CameraWidget.
Definition: gphoto2-widget.c:344
GP_WIDGET_DATE
@ GP_WIDGET_DATE
Date entering widget.
Definition: gphoto2-widget.h:65
GP_PORT_USB
@ GP_PORT_USB
USB port.
Definition: gphoto2-port-info-list.h:37
gp_camera_unref
int gp_camera_unref(Camera *camera)
Definition: gphoto2-camera.c:528
GP_ERROR_BAD_PARAMETERS
#define GP_ERROR_BAD_PARAMETERS
Bad parameters passed.
Definition: gphoto2-port-result.h:38
gp_port_info_list_free
int gp_port_info_list_free(GPPortInfoList *list)
Free a GPPortInfo list.
Definition: gphoto2-port-info-list.c:135
_CameraWidget
Definition: gphoto2-widget.c:38
_CameraPrivateCore::lh
lt_dlhandle lh
Definition: gphoto2-camera.c:228
_Camera::fs
CameraFilesystem * fs
Definition: gphoto2-camera.h:330
gp_filesystem_list_files
int gp_filesystem_list_files(CameraFilesystem *fs, const char *folder, CameraList *list, GPContext *context)
Get the list of files in a folder.
Definition: gphoto2-filesys.c:952
_CameraFileInfoPreview::size
uint64_t size
Size of the preview.
Definition: gphoto2-filesys.h:115
_CameraAbilitiesList
Definition: gphoto2-abilities-list.c:62
gp_filesystem_read_file
int gp_filesystem_read_file(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, uint64_t offset, char *buf, uint64_t *size, GPContext *context)
Get partial file data from the filesystem.
Definition: gphoto2-filesys.c:1767
GP_OK
#define GP_OK
Everything is OK.
Definition: gphoto2-port-result.h:30
_CameraFunctions::exit
CameraExitFunc exit
Function called on closing the camera.
Definition: gphoto2-camera.h:289
gp_camera_trigger_capture
int gp_camera_trigger_capture(Camera *camera, GPContext *context)
Definition: gphoto2-camera.c:1358
gp_camera_get_config
int gp_camera_get_config(Camera *camera, CameraWidget **window, GPContext *context)
Definition: gphoto2-camera.c:858
CameraEventType
CameraEventType
Specify what event we received from the camera.
Definition: gphoto2-camera.h:103
gp_port_close
int gp_port_close(GPPort *port)
Close a port.
Definition: gphoto2-port.c:297
gp_file_get_mime_type
int gp_file_get_mime_type(CameraFile *file, const char **mime_type)
Definition: gphoto2-file.c:979
GP_WIDGET_SECTION
@ GP_WIDGET_SECTION
Section widget (think Tab)
Definition: gphoto2-widget.h:58
_CameraPrivateCore::timeout_ids
unsigned int * timeout_ids
Definition: gphoto2-camera.c:242
gp_widget_count_choices
int gp_widget_count_choices(CameraWidget *widget)
Counts the choices of the CameraWidget.
Definition: gphoto2-widget.c:780
gp_camera_get_about
int gp_camera_get_about(Camera *camera, CameraText *about, GPContext *context)
Definition: gphoto2-camera.c:1294
gp_widget_set_readonly
int gp_widget_set_readonly(CameraWidget *widget, int readonly)
Tells that the widget is readonly.
Definition: gphoto2-widget.c:310
gp_camera_capture
int gp_camera_capture(Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
Definition: gphoto2-camera.c:1327
gp_camera_get_single_config
int gp_camera_get_single_config(Camera *camera, const char *name, CameraWidget **widget, GPContext *context)
Definition: gphoto2-camera.c:891
gp_widget_set_changed
int gp_widget_set_changed(CameraWidget *widget, int changed)
Tells that the widget has been changed.
Definition: gphoto2-widget.c:289
gp_file_clean
int gp_file_clean(CameraFile *file)
Definition: gphoto2-file.c:699
gp_widget_get_label
int gp_widget_get_label(CameraWidget *widget, const char **label)
Retrieves the label of the CameraWidget.
Definition: gphoto2-widget.c:361
_Camera::port
GPPort * port
Definition: gphoto2-camera.h:329
gp_list_sort
int gp_list_sort(CameraList *list)
Definition: gphoto2-list.c:213
gp_widget_get_child
int gp_widget_get_child(CameraWidget *widget, int child_number, CameraWidget **child)
Retrieves the child number child_number of the parent.
Definition: gphoto2-widget.c:546
GP_WIDGET_TOGGLE
@ GP_WIDGET_TOGGLE
Toggle widget (think check box)
Definition: gphoto2-widget.h:61
gp_port_info_get_name
int gp_port_info_get_name(GPPortInfo info, char **name)
Get name of a specific port entry.
Definition: gphoto2-port-info-list.c:492
gp_camera_autodetect
int gp_camera_autodetect(CameraList *list, GPContext *context)
Definition: gphoto2-camera.c:618
gp_camera_stop_timeout
void gp_camera_stop_timeout(Camera *camera, unsigned int id)
Definition: gphoto2-camera.c:1934
gp_port_info_list_new
int gp_port_info_list_new(GPPortInfoList **list)
Create a new GPPortInfoList.
Definition: gphoto2-port-info-list.c:111
_CameraFunctions::about
CameraAboutFunc about
A little About text, including authors and credits.
Definition: gphoto2-camera.h:307
gp_camera_list_config
int gp_camera_list_config(Camera *camera, CameraList *list, GPContext *context)
Definition: gphoto2-camera.c:1050
gp_widget_get_range
int gp_widget_get_range(CameraWidget *range, float *min, float *max, float *increment)
Retrieves some range parameters of the CameraWidget.
Definition: gphoto2-widget.c:738
gp_port_info_get_type
int gp_port_info_get_type(GPPortInfo info, GPPortType *type)
Get type of a specific port entry.
Definition: gphoto2-port-info-list.c:554
_CameraFileInfo
File information structure.
Definition: gphoto2-filesys.h:141
GP_WIDGET_RANGE
@ GP_WIDGET_RANGE
Slider widget.
Definition: gphoto2-widget.h:60
gphoto2-camera.h
Implement Camera object representing a camera attached to the system.
GP_PORT_NONE
@ GP_PORT_NONE
No specific type associated.
Definition: gphoto2-port-info-list.h:35
GP_ERROR
#define GP_ERROR
Generic Error.
Definition: gphoto2-port-result.h:34
CameraTimeoutStartFunc
unsigned int(* CameraTimeoutStartFunc)(Camera *camera, unsigned int timeout, CameraTimeoutFunc func, void *data)
Definition: gphoto2-camera.h:464
_CameraFileInfoPreview::type
char type[64]
MIME type of the preview.
Definition: gphoto2-filesys.h:116
gp_camera_init
int gp_camera_init(Camera *camera, GPContext *context)
Definition: gphoto2-camera.c:683
gp_camera_exit
int gp_camera_exit(Camera *camera, GPContext *context)
Definition: gphoto2-camera.c:264
CRSL
#define CRSL(c, res, ctx, list)
Definition: gphoto2-camera.c:184
gp_abilities_list_free
int gp_abilities_list_free(CameraAbilitiesList *list)
Free the given CameraAbilitiesList object.
Definition: gphoto2-abilities-list.c:125
_CameraPrivateCore::timeout_data
void * timeout_data
Definition: gphoto2-camera.c:241
GP_WIDGET_WINDOW
@ GP_WIDGET_WINDOW
Window widget This is the toplevel configuration widget. It should likely contain multiple GP_WIDGET_...
Definition: gphoto2-widget.h:55
gp_port_info_list_count
int gp_port_info_list_count(GPPortInfoList *list)
Number of ports in the list.
Definition: gphoto2-port-info-list.c:305
gp_widget_new
int gp_widget_new(CameraWidgetType type, const char *label, CameraWidget **widget)
Create a new widget.
Definition: gphoto2-widget.c:93
GP_PORT_SERIAL
@ GP_PORT_SERIAL
Serial port.
Definition: gphoto2-port-info-list.h:36
gp_camera_get_summary
int gp_camera_get_summary(Camera *camera, CameraText *summary, GPContext *context)
Definition: gphoto2-camera.c:1231
gp_filesystem_new
int gp_filesystem_new(CameraFilesystem **fs)
Create a new filesystem struct.
Definition: gphoto2-filesys.c:655
CameraTimeoutStopFunc
void(* CameraTimeoutStopFunc)(Camera *camera, unsigned int id, void *data)
Definition: gphoto2-camera.h:468
_get_widget_names
static void _get_widget_names(CameraWidget *widget, CameraList *list)
Definition: gphoto2-camera.c:1011
gp_camera_wait_for_event
int gp_camera_wait_for_event(Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)
Definition: gphoto2-camera.c:1438
gp_widget_get_readonly
int gp_widget_get_readonly(CameraWidget *widget, int *readonly)
Retrieves the readonly state of the CameraWidget.
Definition: gphoto2-widget.c:327
_GPPortSettings
Union of port settings.
Definition: gphoto2-port.h:114
CHECK_INIT
#define CHECK_INIT(c, ctx)
Definition: gphoto2-camera.c:210
_Camera::functions
CameraFunctions * functions
Definition: gphoto2-camera.h:331
CameraFilePath
A structure created by the capture operation.
Definition: gphoto2-camera.h:79
gp_context_error
void gp_context_error(GPContext *context, const char *format,...)
Definition: gphoto2-context.c:203
_
#define _(String)
Definition: gphoto2-camera.c:56
gp_list_new
int gp_list_new(CameraList **list)
Creates a new CameraList.
Definition: gphoto2-list.c:63
GP_WIDGET_TEXT
@ GP_WIDGET_TEXT
Text widget.
Definition: gphoto2-widget.h:59
gp_camera_free
int gp_camera_free(Camera *camera)
Definition: gphoto2-camera.c:562
CameraAbilities::usb_class
int usb_class
USB device class.
Definition: gphoto2-abilities-list.h:136
gp_camera_folder_put_file
int gp_camera_folder_put_file(Camera *camera, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
Definition: gphoto2-camera.c:1548
_CameraPrivateCore::timeout_start_func
CameraTimeoutStartFunc timeout_start_func
Definition: gphoto2-camera.c:239
gp_camera_file_set_info
int gp_camera_file_set_info(Camera *camera, const char *folder, const char *file, CameraFileInfo info, GPContext *context)
Definition: gphoto2-camera.c:1644
GP_FILE_INFO_SIZE
@ GP_FILE_INFO_SIZE
The filesize is set.
Definition: gphoto2-filesys.h:58
CameraAbilities::usb_protocol
int usb_protocol
USB device protocol.
Definition: gphoto2-abilities-list.h:138
gp_camera_folder_list_files
int gp_camera_folder_list_files(Camera *camera, const char *folder, CameraList *list, GPContext *context)
Definition: gphoto2-camera.c:1467
GP_WIDGET_RADIO
@ GP_WIDGET_RADIO
Radio button widget.
Definition: gphoto2-widget.h:62
_CameraList
Definition: gphoto2-list.c:47
gphoto2-port-log.h
gp_abilities_list_get_abilities
int gp_abilities_list_get_abilities(CameraAbilitiesList *list, int index, CameraAbilities *abilities)
Retrieve the camera abilities of entry with supplied index number.
Definition: gphoto2-abilities-list.c:636
gp_filesystem_get_file
int gp_filesystem_get_file(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
Get file data from the filesystem.
Definition: gphoto2-filesys.c:1634
CameraTimeoutFunc
int(* CameraTimeoutFunc)(Camera *camera, GPContext *context)
Definition: gphoto2-camera.h:462
_CameraFunctions::manual
CameraManualFunc manual
Give a brief manual about any specific items a user has to know, translated.
Definition: gphoto2-camera.h:306
CameraText
CameraText structure used in various functions.
Definition: gphoto2-camera.h:68
_CameraPrivateCore::a
CameraAbilities a
Definition: gphoto2-camera.c:225
GP_ERROR_LIBRARY
#define GP_ERROR_LIBRARY
Error in the camera driver.
Definition: gphoto2-port-result.h:46
gp_port_usb_find_device_by_class
int gp_port_usb_find_device_by_class(GPPort *port, int mainclass, int subclass, int protocol)
Find USB device by interface class.
Definition: gphoto2-port.c:814
gp_camera_get_manual
int gp_camera_get_manual(Camera *camera, CameraText *manual, GPContext *context)
Definition: gphoto2-camera.c:1262
gp_widget_get_name
int gp_widget_get_name(CameraWidget *widget, const char **name)
Gets the name of the widget.
Definition: gphoto2-widget.c:233
gp_camera_set_port_info
int gp_camera_set_port_info(Camera *camera, GPPortInfo info)
Definition: gphoto2-camera.c:418
gp_filesystem_remove_dir
int gp_filesystem_remove_dir(CameraFilesystem *fs, const char *folder, const char *name, GPContext *context)
Remove a subfolder from within a folder.
Definition: gphoto2-filesys.c:1217
gp_filesystem_get_storageinfo
int gp_filesystem_get_storageinfo(CameraFilesystem *fs, CameraStorageInformation **storageinfo, int *nrofstorageinfos, GPContext *context)
Get the storage information about this filesystem.
Definition: gphoto2-filesys.c:2449
_CameraFunctions
Various camera specific functions.
Definition: gphoto2-camera.h:285
CameraAbilities::usb_subclass
int usb_subclass
USB device subclass.
Definition: gphoto2-abilities-list.h:137
gp_camera_folder_list_folders
int gp_camera_folder_list_folders(Camera *camera, const char *folder, CameraList *list, GPContext *context)
Definition: gphoto2-camera.c:1495
GP_FILE_INFO_NONE
@ GP_FILE_INFO_NONE
No fields set.
Definition: gphoto2-filesys.h:56
gp_widget_get_child_by_name
int gp_widget_get_child_by_name(CameraWidget *widget, const char *name, CameraWidget **child)
Retrieves the child with name name of the widget.
Definition: gphoto2-widget.c:638
CameraCaptureType
CameraCaptureType
Type of the capture to do.
Definition: gphoto2-camera.h:90
gp_camera_set_config
int gp_camera_set_config(Camera *camera, CameraWidget *window, GPContext *context)
Definition: gphoto2-camera.c:1102
gp_filesystem_delete_all
int gp_filesystem_delete_all(CameraFilesystem *fs, const char *folder, GPContext *context)
Delete all files in specified folder.
Definition: gphoto2-filesys.c:891
_CameraFunctions::summary
CameraSummaryFunc summary
Give a summary about the current camera status, translated.
Definition: gphoto2-camera.h:305
CRS
#define CRS(c, res, ctx)
Definition: gphoto2-camera.c:174
gp_camera_set_abilities
int gp_camera_set_abilities(Camera *camera, CameraAbilities abilities)
Sets the camera abilities.
Definition: gphoto2-camera.c:368
_CameraFunctions::set_config
CameraSetConfigFunc set_config
Called after a configuration was changed.
Definition: gphoto2-camera.h:293
gp_widget_free
int gp_widget_free(CameraWidget *widget)
Frees a CameraWidget.
Definition: gphoto2-widget.c:132
_Camera::pc
CameraPrivateCore * pc
Definition: gphoto2-camera.h:335
_CameraFileInfo::file
CameraFileInfoFile file
Definition: gphoto2-filesys.h:143
_CameraPrivateCore::timeout_ids_len
unsigned int timeout_ids_len
Definition: gphoto2-camera.c:243
gp_widget_set_range
int gp_widget_set_range(CameraWidget *range, float min, float max, float increment)
Sets some range parameters of the CameraWidget.
Definition: gphoto2-widget.c:715
gp_camera_folder_delete_all
int gp_camera_folder_delete_all(Camera *camera, const char *folder, GPContext *context)
Definition: gphoto2-camera.c:1522
_GPPort::type
GPPortType type
Actual type of this port.
Definition: gphoto2-port.h:145
gp_filesystem_list_folders
int gp_filesystem_list_folders(CameraFilesystem *fs, const char *folder, CameraList *list, GPContext *context)
List all subfolders within a filesystem folder.
Definition: gphoto2-filesys.c:1018
_CameraFunctions::list_config
CameraListConfigFunc list_config
Called for listing the available configuration widgets.
Definition: gphoto2-camera.h:295
gphoto2-library.h
Camery driver header.
GP_WIDGET_BUTTON
@ GP_WIDGET_BUTTON
Button press widget.
Definition: gphoto2-widget.h:64
_CameraPrivateCore::used
unsigned char used
Definition: gphoto2-camera.c:233
GP_ERROR_DIRECTORY_NOT_FOUND
#define GP_ERROR_DIRECTORY_NOT_FOUND
Specified directory was not found.
Definition: gphoto2-result.h:67
gp_file_get_name_by_type
int gp_file_get_name_by_type(CameraFile *file, const char *basename, CameraFileType type, char **newname)
Definition: gphoto2-file.c:899
GP_ERROR_NOT_SUPPORTED
#define GP_ERROR_NOT_SUPPORTED
Functionality not supported.
Definition: gphoto2-port-result.h:54
gp_camera_start_timeout
int gp_camera_start_timeout(Camera *camera, unsigned int timeout, CameraTimeoutFunc func)
Definition: gphoto2-camera.c:1893
_GPContext
Definition: gphoto2-context.c:39
gp_camera_file_get
int gp_camera_file_get(Camera *camera, const char *folder, const char *file, CameraFileType type, CameraFile *camera_file, GPContext *context)
Definition: gphoto2-camera.c:1671
GP_WIDGET_MENU
@ GP_WIDGET_MENU
Menu widget (same as RADIO).
Definition: gphoto2-widget.h:63
_GPPortSettingsSerial::speed
int speed
Definition: gphoto2-port.h:68
_CameraStorageInformation
Storage information structue.
Definition: gphoto2-filesys.h:214
GPPortType
GPPortType
The gphoto port type.
Definition: gphoto2-port-info-list.h:34