libgphoto2 photo camera library (libgphoto2) API: gphoto2/gphoto2-context.h Source File

libgphoto2 photo camera library (libgphoto2) API 2.5.34

Loading...
Searching...
No Matches
gphoto2-context.h
Go to the documentation of this file.
1
24
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
41 typedef struct _GPContext GPContext;
42
43 GPContext *gp_context_new (void);
44
45void gp_context_ref (GPContext *context);
46void 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 */
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;
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);
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) */
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
GPContext
struct _GPContext GPContext
The gphoto context structure.
Definition gphoto2-context.h:41
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