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