libgphoto2 photo camera library (libgphoto2) API  2.5.0
gphoto2-context.h
Go to the documentation of this file.
00001 
00025 #ifndef __GPHOTO2_CONTEXT_H__
00026 #define __GPHOTO2_CONTEXT_H__
00027 
00028 #include <stdarg.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif /* __cplusplus */
00033 
00041 typedef struct _GPContext GPContext;
00042 
00043 GPContext *gp_context_new (void);
00044 
00045 void gp_context_ref   (GPContext *context);
00046 void gp_context_unref (GPContext *context);
00047 
00055 typedef enum _GPContextFeedback {
00056         GP_CONTEXT_FEEDBACK_OK,         
00057         GP_CONTEXT_FEEDBACK_CANCEL      
00058 } GPContextFeedback;
00059 
00060 /* Functions */
00061 typedef void (* GPContextIdleFunc)     (GPContext *context, void *data);
00062 typedef void (* GPContextErrorFunc)    (GPContext *context, const char *text, void *data);
00063 typedef void (* GPContextStatusFunc)   (GPContext *context, const char *text, void *data);
00064 typedef void (* GPContextMessageFunc)  (GPContext *context, const char *text, void *data);
00065 typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context,
00066                                                      const char *text, void *data);
00067 typedef GPContextFeedback (* GPContextCancelFunc)   (GPContext *context,
00068                                                      void *data);
00069 typedef unsigned int (* GPContextProgressStartFunc)  (GPContext *context,
00070                                                       float target,
00071                                                       const char *text,
00072                                                       void *data);
00073 typedef void         (* GPContextProgressUpdateFunc) (GPContext *context,
00074                                                       unsigned int id,
00075                                                       float current,
00076                                                       void *data);
00077 typedef void         (* GPContextProgressStopFunc)   (GPContext *context,
00078                                                       unsigned int id,
00079                                                       void *data);
00080 
00081 /* Setting those functions (frontends) */
00082 void gp_context_set_idle_func      (GPContext *context,
00083                                     GPContextIdleFunc func,     void *data);
00084 void gp_context_set_progress_funcs (GPContext *context,
00085                                     GPContextProgressStartFunc  start_func,
00086                                     GPContextProgressUpdateFunc update_func,
00087                                     GPContextProgressStopFunc   stop_func,
00088                                     void *data);
00089 void gp_context_set_error_func     (GPContext *context,
00090                                     GPContextErrorFunc func,    void *data);
00091 void gp_context_set_status_func    (GPContext *context,
00092                                     GPContextStatusFunc func,   void *data);
00093 void gp_context_set_question_func  (GPContext *context,
00094                                     GPContextQuestionFunc func, void *data);
00095 void gp_context_set_cancel_func    (GPContext *context,
00096                                     GPContextCancelFunc func,   void *data);
00097 void gp_context_set_message_func   (GPContext *context,
00098                                     GPContextMessageFunc func,  void *data);
00099 
00100 /* Calling those functions (backends) */
00101 void gp_context_idle     (GPContext *context);
00102 void gp_context_error    (GPContext *context, const char *format, ...)
00103 #ifdef __GNUC__
00104         __attribute__((__format__(printf,2,3)))
00105 #endif
00106 ;
00107 void gp_context_status   (GPContext *context, const char *format, ...)
00108 #ifdef __GNUC__
00109         __attribute__((__format__(printf,2,3)))
00110 #endif
00111 ;
00112 void gp_context_message  (GPContext *context, const char *format, ...)
00113 #ifdef __GNUC__
00114         __attribute__((__format__(printf,2,3)))
00115 #endif
00116 ;
00117 GPContextFeedback gp_context_question (GPContext *context, const char *format,
00118                                        ...)
00119 #ifdef __GNUC__
00120         __attribute__((__format__(printf,2,3)))
00121 #endif
00122 ;
00123 GPContextFeedback gp_context_cancel   (GPContext *context);
00124 unsigned int gp_context_progress_start  (GPContext *context, float target,
00125                                          const char *format, ...)
00126 #ifdef __GNUC__
00127         __attribute__((__format__(printf,3,4)))
00128 #endif
00129 ;
00130 void         gp_context_progress_update (GPContext *context, unsigned int id,
00131                                          float current);
00132 void         gp_context_progress_stop   (GPContext *context, unsigned int id);
00133 
00134 #ifdef __cplusplus
00135 }
00136 #endif /* __cplusplus */
00137 
00138 #endif /* __GPHOTO2_CONTEXT_H__ */