libgphoto2 photo camera library (libgphoto2) Internals  2.5.23
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 *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);
66  const char *text, void *data);
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);
85  GPContextProgressStartFunc start_func,
86  GPContextProgressUpdateFunc update_func,
87  GPContextProgressStopFunc stop_func,
88  void *data);
90  GPContextErrorFunc func, void *data);
92  GPContextStatusFunc func, void *data);
94  GPContextQuestionFunc func, void *data);
96  GPContextCancelFunc func, void *data);
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 ;
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 /* __GPHOTO2_CONTEXT_H__ */
gp_context_set_question_func
void gp_context_set_question_func(GPContext *context, GPContextQuestionFunc func, void *data)
Definition: gphoto2-context.c:374
gp_context_ref
void gp_context_ref(GPContext *context)
Definition: gphoto2-context.c:93
gp_context_set_status_func
void gp_context_set_status_func(GPContext *context, GPContextStatusFunc func, void *data)
Definition: gphoto2-context.c:385
gp_context_question
GPContextFeedback gp_context_question(GPContext *context, const char *format,...)
Ask frontend user a question.
Definition: gphoto2-context.c:291
gp_context_set_progress_funcs
void gp_context_set_progress_funcs(GPContext *context, GPContextProgressStartFunc start_func, GPContextProgressUpdateFunc update_func, GPContextProgressStopFunc stop_func, void *data)
Definition: gphoto2-context.c:347
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_set_message_func
void gp_context_set_message_func(GPContext *context, GPContextMessageFunc func, void *data)
Definition: gphoto2-context.c:407
GPContextMessageFunc
void(* GPContextMessageFunc)(GPContext *context, const char *text, void *data)
Definition: gphoto2-context.h:64
gp_context_set_error_func
void gp_context_set_error_func(GPContext *context, GPContextErrorFunc func, void *data)
Definition: gphoto2-context.c:363
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_cancel
GPContextFeedback gp_context_cancel(GPContext *context)
Definition: gphoto2-context.c:323
GPContextProgressStopFunc
void(* GPContextProgressStopFunc)(GPContext *context, unsigned int id, void *data)
Definition: gphoto2-context.h:77
GPContextProgressStartFunc
unsigned int(* GPContextProgressStartFunc)(GPContext *context, float target, const char *text, void *data)
Definition: gphoto2-context.h:69
gp_context_progress_update
void gp_context_progress_update(GPContext *context, unsigned int id, float current)
Definition: gphoto2-context.c:181
gp_context_progress_stop
void gp_context_progress_stop(GPContext *context, unsigned int id)
Definition: gphoto2-context.c:192
gp_context_status
void gp_context_status(GPContext *context, const char *format,...)
Definition: gphoto2-context.c:224
GPContextIdleFunc
void(* GPContextIdleFunc)(GPContext *context, void *data)
Definition: gphoto2-context.h:61
GPContextProgressUpdateFunc
void(* GPContextProgressUpdateFunc)(GPContext *context, unsigned int id, float current, void *data)
Definition: gphoto2-context.h:73
gp_context_unref
void gp_context_unref(GPContext *context)
Decrements reference count of a context.
Definition: gphoto2-context.c:115
GPContextCancelFunc
GPContextFeedback(* GPContextCancelFunc)(GPContext *context, void *data)
Definition: gphoto2-context.h:67
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_FEEDBACK_CANCEL
@ GP_CONTEXT_FEEDBACK_CANCEL
Definition: gphoto2-context.h:57
GPContextErrorFunc
void(* GPContextErrorFunc)(GPContext *context, const char *text, void *data)
Definition: gphoto2-context.h:62
GP_CONTEXT_FEEDBACK_OK
@ GP_CONTEXT_FEEDBACK_OK
Definition: gphoto2-context.h:56
gp_context_idle
void gp_context_idle(GPContext *context)
Notify frontend of a brief idle time.
Definition: gphoto2-context.c:135
gp_context_set_cancel_func
void gp_context_set_cancel_func(GPContext *context, GPContextCancelFunc func, void *data)
Definition: gphoto2-context.c:396
gp_context_error
void gp_context_error(GPContext *context, const char *format,...)
Definition: gphoto2-context.c:203
GPContextStatusFunc
void(* GPContextStatusFunc)(GPContext *context, const char *text, void *data)
Definition: gphoto2-context.h:63
gp_context_set_idle_func
void gp_context_set_idle_func(GPContext *context, GPContextIdleFunc func, void *data)
Definition: gphoto2-context.c:336
GPContextFeedback
enum _GPContextFeedback GPContextFeedback
Return codes that can be returned by progress handling.
GPContextQuestionFunc
GPContextFeedback(* GPContextQuestionFunc)(GPContext *context, const char *text, void *data)
Definition: gphoto2-context.h:65
_GPContext
Definition: gphoto2-context.c:39