libgphoto2 photo camera library (libgphoto2) API 2.5.30

gphoto2-context.h
Go to the documentation of this file.
1
25#ifndef LIBGPHOTO2_GPHOTO2_CONTEXT_H
26#define LIBGPHOTO2_GPHOTO2_CONTEXT_H
27
28#include <stdarg.h>
29
30#ifdef __cplusplus
31 extern "C" {
32#endif /* __cplusplus */
33
41 typedef struct _GPContext GPContext;
42
43 GPContext *gp_context_new (void);
44
45 void gp_context_ref (GPContext *context);
46 void gp_context_unref (GPContext *context);
47
55 typedef enum _GPContextFeedback {
56 GP_CONTEXT_FEEDBACK_OK,
57 GP_CONTEXT_FEEDBACK_CANCEL
58} GPContextFeedback;
59
60/* Functions */
61 typedef void (* GPContextIdleFunc) (GPContext *context, void *data);
62 typedef void (* GPContextErrorFunc) (GPContext *context, const char *text, void *data);
63 typedef void (* GPContextStatusFunc) (GPContext *context, const char *text, void *data);
64 typedef void (* GPContextMessageFunc) (GPContext *context, const char *text, void *data);
65 typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context,
66 const char *text, void *data);
67 typedef GPContextFeedback (* GPContextCancelFunc) (GPContext *context,
68 void *data);
69 typedef unsigned int (* GPContextProgressStartFunc) (GPContext *context,
70 float target,
71 const char *text,
72 void *data);
73 typedef void (* GPContextProgressUpdateFunc) (GPContext *context,
74 unsigned int id,
75 float current,
76 void *data);
77 typedef void (* GPContextProgressStopFunc) (GPContext *context,
78 unsigned int id,
79 void *data);
80
81/* Setting those functions (frontends) */
82 void gp_context_set_idle_func (GPContext *context,
83 GPContextIdleFunc func, void *data);
84 void gp_context_set_progress_funcs (GPContext *context,
85 GPContextProgressStartFunc start_func,
86 GPContextProgressUpdateFunc update_func,
87 GPContextProgressStopFunc stop_func,
88 void *data);
89 void gp_context_set_error_func (GPContext *context,
90 GPContextErrorFunc func, void *data);
91 void gp_context_set_status_func (GPContext *context,
92 GPContextStatusFunc func, void *data);
93 void gp_context_set_question_func (GPContext *context,
94 GPContextQuestionFunc func, void *data);
95 void gp_context_set_cancel_func (GPContext *context,
96 GPContextCancelFunc func, void *data);
97 void gp_context_set_message_func (GPContext *context,
98 GPContextMessageFunc func, void *data);
99
100/* Calling those functions (backends) */
101 void gp_context_idle (GPContext *context);
102 void gp_context_error (GPContext *context, const char *format, ...)
103#ifdef __GNUC__
104 __attribute__((__format__(printf,2,3)))
105#endif
106;
107 void gp_context_status (GPContext *context, const char *format, ...)
108#ifdef __GNUC__
109 __attribute__((__format__(printf,2,3)))
110#endif
111;
112 void gp_context_message (GPContext *context, const char *format, ...)
113#ifdef __GNUC__
114 __attribute__((__format__(printf,2,3)))
115#endif
116;
117 GPContextFeedback gp_context_question (GPContext *context, const char *format,
118 ...)
119#ifdef __GNUC__
120 __attribute__((__format__(printf,2,3)))
121#endif
122;
123 GPContextFeedback gp_context_cancel (GPContext *context);
124 unsigned int gp_context_progress_start (GPContext *context, float target,
125 const char *format, ...)
126#ifdef __GNUC__
127 __attribute__((__format__(printf,3,4)))
128#endif
129;
130 void gp_context_progress_update (GPContext *context, unsigned int id,
131 float current);
132 void gp_context_progress_stop (GPContext *context, unsigned int id);
133
134#ifdef __cplusplus
135}
136#endif /* __cplusplus */
137
138#endif /* !defined(LIBGPHOTO2_GPHOTO2_CONTEXT_H) */
gp_context_question
GPContextFeedback gp_context_question(GPContext *context, const char *format,...)
Ask frontend user a question.
Definition: gphoto2-context.c:291
gp_context_cancel
GPContextFeedback gp_context_cancel(GPContext *context)
Definition: gphoto2-context.c:323
GPContextFeedback
enum _GPContextFeedback GPContextFeedback
Return codes that can be returned by progress handling.
gp_context_progress_start
unsigned int gp_context_progress_start(GPContext *context, float target, const char *format,...)
Start progress tracking.
Definition: gphoto2-context.c:155
gp_context_ref
void gp_context_ref(GPContext *context)
Definition: gphoto2-context.c:93
gp_context_message
void gp_context_message(GPContext *context, const char *format,...)
Print a message to the context.
Definition: gphoto2-context.c:257
gp_context_unref
void gp_context_unref(GPContext *context)
Decrements reference count of a context.
Definition: gphoto2-context.c:115
gp_context_new
GPContext * gp_context_new(void)
Creates a new context.
Definition: gphoto2-context.c:74
_GPContextFeedback
_GPContextFeedback
Return codes that can be returned by progress handling.
Definition: gphoto2-context.h:55
GP_CONTEXT_FEEDBACK_OK
@ GP_CONTEXT_FEEDBACK_OK
Definition: gphoto2-context.h:56
GP_CONTEXT_FEEDBACK_CANCEL
@ GP_CONTEXT_FEEDBACK_CANCEL
Definition: gphoto2-context.h:57
gp_context_idle
void gp_context_idle(GPContext *context)
Notify frontend of a brief idle time.
Definition: gphoto2-context.c:135
_GPContext
Definition: gphoto2-context.c:39