libgphoto2 photo camera library (libgphoto2) API  2.4.11
gphoto2-context.h
Go to the documentation of this file.
1 
25 #ifndef __GPHOTO2_CONTEXT_H__
26 #define __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 
44 
45 void gp_context_ref (GPContext *context);
46 void gp_context_unref (GPContext *context);
47 
55 typedef enum _GPContextFeedback {
59 
60 /* Functions */
61 typedef void (* GPContextIdleFunc) (GPContext *context, void *data);
62 typedef void (* GPContextErrorFunc) (GPContext *context, const char *format,
63  va_list args, void *data)
64 #if (__GNUC__ >= 3)
65  __attribute__((__format__(printf,2,0)))
66 #endif
67 ;
68 typedef void (* GPContextStatusFunc) (GPContext *context, const char *format,
69  va_list args, void *data)
70 #if (__GNUC__ >= 3)
71  __attribute__((__format__(printf,2,0)))
72 #endif
73 ;
74 typedef void (* GPContextMessageFunc) (GPContext *context, const char *format,
75  va_list args, void *data)
76 #if (__GNUC__ >= 3)
77  __attribute__((__format__(printf,2,0)))
78 #endif
79 ;
80 typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context,
81  const char *format,
82  va_list args, void *data)
83 #if (__GNUC__ >= 3)
84  __attribute__((__format__(printf,2,0)))
85 #endif
86 ;
87 typedef GPContextFeedback (* GPContextCancelFunc) (GPContext *context,
88  void *data);
89 typedef unsigned int (* GPContextProgressStartFunc) (GPContext *context,
90  float target,
91  const char *format,
92  va_list args, void *data)
93 #if (__GNUC__ >= 3)
94  __attribute__((__format__(printf,3,0)))
95 #endif
96 ;
97 typedef void (* GPContextProgressUpdateFunc) (GPContext *context,
98  unsigned int id,
99  float current,
100  void *data);
101 typedef void (* GPContextProgressStopFunc) (GPContext *context,
102  unsigned int id,
103  void *data);
104 
105 /* Setting those functions (frontends) */
106 void gp_context_set_idle_func (GPContext *context,
107  GPContextIdleFunc func, void *data);
108 void gp_context_set_progress_funcs (GPContext *context,
109  GPContextProgressStartFunc start_func,
110  GPContextProgressUpdateFunc update_func,
111  GPContextProgressStopFunc stop_func,
112  void *data);
113 void gp_context_set_error_func (GPContext *context,
114  GPContextErrorFunc func, void *data);
115 void gp_context_set_status_func (GPContext *context,
116  GPContextStatusFunc func, void *data);
117 void gp_context_set_question_func (GPContext *context,
118  GPContextQuestionFunc func, void *data);
119 void gp_context_set_cancel_func (GPContext *context,
120  GPContextCancelFunc func, void *data);
121 void gp_context_set_message_func (GPContext *context,
122  GPContextMessageFunc func, void *data);
123 
124 /* Calling those functions (backends) */
125 void gp_context_idle (GPContext *context);
126 void gp_context_error (GPContext *context, const char *format, ...)
127 #ifdef __GNUC__
128  __attribute__((__format__(printf,2,3)))
129 #endif
130 ;
131 void gp_context_status (GPContext *context, const char *format, ...)
132 #ifdef __GNUC__
133  __attribute__((__format__(printf,2,3)))
134 #endif
135 ;
136 void gp_context_message (GPContext *context, const char *format, ...)
137 #ifdef __GNUC__
138  __attribute__((__format__(printf,2,3)))
139 #endif
140 ;
141 GPContextFeedback gp_context_question (GPContext *context, const char *format,
142  ...)
143 #ifdef __GNUC__
144  __attribute__((__format__(printf,2,3)))
145 #endif
146 ;
148 unsigned int gp_context_progress_start (GPContext *context, float target,
149  const char *format, ...)
150 #ifdef __GNUC__
151  __attribute__((__format__(printf,3,4)))
152 #endif
153 ;
154 void gp_context_progress_update (GPContext *context, unsigned int id,
155  float current);
156 void gp_context_progress_stop (GPContext *context, unsigned int id);
157 
158 #ifdef __cplusplus
159 }
160 #endif /* __cplusplus */
161 
162 #endif /* __GPHOTO2_CONTEXT_H__ */
GPContext * gp_context_new(void)
Creates a new context.
Definition: gphoto2-context.c:71
void gp_context_idle(GPContext *context)
Notify frontend of a brief idle time.
Definition: gphoto2-context.c:136
void gp_context_ref(GPContext *context)
Definition: gphoto2-context.c:91
GPContextFeedback gp_context_cancel(GPContext *context)
Definition: gphoto2-context.c:315
GPContextFeedback gp_context_question(GPContext *context, const char *format,...)
Ask frontend user a question.
Definition: gphoto2-context.c:287
enum _GPContextFeedback GPContextFeedback
Return codes that can be returned by progress handling.
Definition: gphoto2-context.h:56
Definition: gphoto2-context.h:57
_GPContextFeedback
Return codes that can be returned by progress handling.
Definition: gphoto2-context.h:55
void gp_context_unref(GPContext *context)
Decrements reference count of a context.
Definition: gphoto2-context.c:116
void gp_context_message(GPContext *context, const char *format,...)
Print a message to the context.
Definition: gphoto2-context.c:253
Definition: gphoto2-context.c:35
unsigned int gp_context_progress_start(GPContext *context, float target, const char *format,...)
Start progress tracking.
Definition: gphoto2-context.c:156