libgphoto2 photo camera library (libgphoto2) Internals
2.5.23
|
Context callback operation functions. More...
#include <stdarg.h>
Go to the source code of this file.
Typedefs | |
typedef struct _GPContext | GPContext |
The gphoto context structure. More... | |
typedef enum _GPContextFeedback | GPContextFeedback |
Return codes that can be returned by progress handling. More... | |
typedef void(* | GPContextIdleFunc) (GPContext *context, void *data) |
typedef void(* | GPContextErrorFunc) (GPContext *context, const char *text, void *data) |
typedef void(* | GPContextStatusFunc) (GPContext *context, const char *text, void *data) |
typedef void(* | GPContextMessageFunc) (GPContext *context, const char *text, void *data) |
typedef GPContextFeedback(* | GPContextQuestionFunc) (GPContext *context, const char *text, void *data) |
typedef GPContextFeedback(* | GPContextCancelFunc) (GPContext *context, void *data) |
typedef unsigned int(* | GPContextProgressStartFunc) (GPContext *context, float target, const char *text, void *data) |
typedef void(* | GPContextProgressUpdateFunc) (GPContext *context, unsigned int id, float current, void *data) |
typedef void(* | GPContextProgressStopFunc) (GPContext *context, unsigned int id, void *data) |
Enumerations | |
enum | _GPContextFeedback { GP_CONTEXT_FEEDBACK_OK, GP_CONTEXT_FEEDBACK_CANCEL } |
Return codes that can be returned by progress handling. More... | |
Functions | |
GPContext * | gp_context_new (void) |
Creates a new context. More... | |
void | gp_context_ref (GPContext *context) |
void | gp_context_unref (GPContext *context) |
Decrements reference count of a context. More... | |
void | gp_context_set_idle_func (GPContext *context, GPContextIdleFunc func, void *data) |
void | gp_context_set_progress_funcs (GPContext *context, GPContextProgressStartFunc start_func, GPContextProgressUpdateFunc update_func, GPContextProgressStopFunc stop_func, void *data) |
void | gp_context_set_error_func (GPContext *context, GPContextErrorFunc func, void *data) |
void | gp_context_set_status_func (GPContext *context, GPContextStatusFunc func, void *data) |
void | gp_context_set_question_func (GPContext *context, GPContextQuestionFunc func, void *data) |
void | gp_context_set_cancel_func (GPContext *context, GPContextCancelFunc func, void *data) |
void | gp_context_set_message_func (GPContext *context, GPContextMessageFunc func, void *data) |
void | gp_context_idle (GPContext *context) |
Notify frontend of a brief idle time. More... | |
void | gp_context_error (GPContext *context, const char *format,...) |
void | gp_context_status (GPContext *context, const char *format,...) |
void | gp_context_message (GPContext *context, const char *format,...) |
Print a message to the context. More... | |
GPContextFeedback | gp_context_question (GPContext *context, const char *format,...) |
Ask frontend user a question. More... | |
GPContextFeedback | gp_context_cancel (GPContext *context) |
unsigned int | gp_context_progress_start (GPContext *context, float target, const char *format,...) |
Start progress tracking. More... | |
void | gp_context_progress_update (GPContext *context, unsigned int id, float current) |
void | gp_context_progress_stop (GPContext *context, unsigned int id) |
Context callback operation functions.
Definition in file gphoto2-context.h.
typedef struct _GPContext GPContext |
The gphoto context structure.
This structure allows callback handling, passing error contexts back, progress handling and download cancellation and similar things. It is usually passed around the functions.
Definition at line 1 of file gphoto2-context.h.
typedef GPContextFeedback(* GPContextCancelFunc) (GPContext *context, void *data) |
Definition at line 67 of file gphoto2-context.h.
typedef void(* GPContextErrorFunc) (GPContext *context, const char *text, void *data) |
Definition at line 62 of file gphoto2-context.h.
typedef enum _GPContextFeedback GPContextFeedback |
Return codes that can be returned by progress handling.
An application can return special values back to the libgphoto2 progress callback handling functions. If "Cancel" is selected, libgphoto2 and the camera driver will try to cancel transfer.
typedef void(* GPContextIdleFunc) (GPContext *context, void *data) |
Definition at line 61 of file gphoto2-context.h.
typedef void(* GPContextMessageFunc) (GPContext *context, const char *text, void *data) |
Definition at line 64 of file gphoto2-context.h.
typedef unsigned int(* GPContextProgressStartFunc) (GPContext *context, float target, const char *text, void *data) |
Definition at line 69 of file gphoto2-context.h.
typedef void(* GPContextProgressStopFunc) (GPContext *context, unsigned int id, void *data) |
Definition at line 77 of file gphoto2-context.h.
typedef void(* GPContextProgressUpdateFunc) (GPContext *context, unsigned int id, float current, void *data) |
Definition at line 73 of file gphoto2-context.h.
typedef GPContextFeedback(* GPContextQuestionFunc) (GPContext *context, const char *text, void *data) |
Definition at line 65 of file gphoto2-context.h.
typedef void(* GPContextStatusFunc) (GPContext *context, const char *text, void *data) |
Definition at line 63 of file gphoto2-context.h.
enum _GPContextFeedback |
Return codes that can be returned by progress handling.
An application can return special values back to the libgphoto2 progress callback handling functions. If "Cancel" is selected, libgphoto2 and the camera driver will try to cancel transfer.
Enumerator | |
---|---|
GP_CONTEXT_FEEDBACK_OK | Everything ok... proceed. |
GP_CONTEXT_FEEDBACK_CANCEL | Please cancel the current transfer if possible. |
Definition at line 55 of file gphoto2-context.h.
GPContextFeedback gp_context_cancel | ( | GPContext * | context | ) |
gp_context_cancel: @context: a GPContext
Gives the frontend the possibility to cancel the current operation that is executed in this @context.
Return value: a GPContextFeedback.
Definition at line 323 of file gphoto2-context.c.
References _GPContext::cancel_func, _GPContext::cancel_func_data, and GP_CONTEXT_FEEDBACK_OK.
Referenced by gp_abilities_list_load_dir().
void gp_context_error | ( | GPContext * | context, |
const char * | format, | ||
... | |||
) |
Definition at line 203 of file gphoto2-context.c.
References _GPContext::error_func, _GPContext::error_func_data, gp_log(), GP_LOG_ERROR, and gpi_vsnprintf().
Referenced by gp_abilities_list_load_dir(), gp_camera_capture(), gp_camera_capture_preview(), gp_camera_get_about(), gp_camera_get_config(), gp_camera_get_manual(), gp_camera_get_single_config(), gp_camera_get_summary(), gp_camera_init(), gp_camera_list_config(), gp_camera_set_config(), gp_camera_set_single_config(), gp_camera_trigger_capture(), gp_filesystem_delete_file(), gp_filesystem_get_file_impl(), gp_filesystem_get_folder(), gp_filesystem_get_info(), gp_filesystem_get_storageinfo(), gp_filesystem_lru_update(), gp_filesystem_name(), gp_filesystem_number(), gp_filesystem_put_file(), gp_filesystem_remove_dir(), gp_filesystem_set_file_noop(), and gp_filesystem_set_info().
void gp_context_idle | ( | GPContext * | context | ) |
Notify frontend of a brief idle time.
Tells the frontend that it can do other processing at this moment, like refresh the UI. Backends should call this function every time when an interruption of the transfer is possible.
context | a GPContext |
Definition at line 135 of file gphoto2-context.c.
References _GPContext::idle_func, and _GPContext::idle_func_data.
void gp_context_message | ( | GPContext * | context, |
const char * | format, | ||
... | |||
) |
Print a message to the context.
This sends a message to the passed context, to be printed by it in some kind of way, but do no other action.
To be used by camera drivers.
context | A GPContext |
format | A sprintf style format string |
... | variable argument list depending on format string |
Definition at line 257 of file gphoto2-context.c.
References gpi_vsnprintf(), _GPContext::message_func, and _GPContext::message_func_data.
GPContext* gp_context_new | ( | void | ) |
Creates a new context.
To be used by the frontend.
Definition at line 74 of file gphoto2-context.c.
References _GPContext::ref_count.
unsigned int gp_context_progress_start | ( | GPContext * | context, |
float | target, | ||
const char * | format, | ||
... | |||
) |
Start progress tracking.
This function starts up a new progress tracking for a specified context. Several nested progress reports can happen at once, depending on the backend.
context | The context in which to start the progress. |
target | The 100% value. |
format | A sprintf style string to print out, including the following variable arguments. |
Definition at line 155 of file gphoto2-context.c.
References gpi_vsnprintf(), _GPContext::progress_func_data, and _GPContext::progress_start_func.
Referenced by gp_abilities_list_load_dir().
void gp_context_progress_stop | ( | GPContext * | context, |
unsigned int | id | ||
) |
Definition at line 192 of file gphoto2-context.c.
References _GPContext::progress_func_data, and _GPContext::progress_stop_func.
Referenced by gp_abilities_list_load_dir().
void gp_context_progress_update | ( | GPContext * | context, |
unsigned int | id, | ||
float | current | ||
) |
Definition at line 181 of file gphoto2-context.c.
References _GPContext::progress_func_data, and _GPContext::progress_update_func.
Referenced by gp_abilities_list_load_dir().
GPContextFeedback gp_context_question | ( | GPContext * | context, |
const char * | format, | ||
... | |||
) |
Ask frontend user a question.
Asks the user a question that he must answer either with "Ok" or "Cancel".
To be used by a camera driver. (So far no camera driver is using it, but this might change later.)
context | a GPContext |
format | a sprintf format string |
... | variable arguments for format string |
Definition at line 291 of file gphoto2-context.c.
References GP_CONTEXT_FEEDBACK_OK, gpi_vsnprintf(), _GPContext::question_func, and _GPContext::question_func_data.
void gp_context_ref | ( | GPContext * | context | ) |
Increments the reference count of the context.
context | The context to bump the reference |
Definition at line 93 of file gphoto2-context.c.
References _GPContext::ref_count.
void gp_context_set_cancel_func | ( | GPContext * | context, |
GPContextCancelFunc | func, | ||
void * | data | ||
) |
Definition at line 396 of file gphoto2-context.c.
References _GPContext::cancel_func, and _GPContext::cancel_func_data.
void gp_context_set_error_func | ( | GPContext * | context, |
GPContextErrorFunc | func, | ||
void * | data | ||
) |
Definition at line 363 of file gphoto2-context.c.
References _GPContext::error_func, and _GPContext::error_func_data.
void gp_context_set_idle_func | ( | GPContext * | context, |
GPContextIdleFunc | func, | ||
void * | data | ||
) |
Definition at line 336 of file gphoto2-context.c.
References _GPContext::idle_func, and _GPContext::idle_func_data.
void gp_context_set_message_func | ( | GPContext * | context, |
GPContextMessageFunc | func, | ||
void * | data | ||
) |
Definition at line 407 of file gphoto2-context.c.
References _GPContext::message_func, and _GPContext::message_func_data.
void gp_context_set_progress_funcs | ( | GPContext * | context, |
GPContextProgressStartFunc | start_func, | ||
GPContextProgressUpdateFunc | update_func, | ||
GPContextProgressStopFunc | stop_func, | ||
void * | data | ||
) |
Definition at line 347 of file gphoto2-context.c.
References _GPContext::progress_func_data, _GPContext::progress_start_func, _GPContext::progress_stop_func, and _GPContext::progress_update_func.
void gp_context_set_question_func | ( | GPContext * | context, |
GPContextQuestionFunc | func, | ||
void * | data | ||
) |
Definition at line 374 of file gphoto2-context.c.
References _GPContext::question_func, and _GPContext::question_func_data.
void gp_context_set_status_func | ( | GPContext * | context, |
GPContextStatusFunc | func, | ||
void * | data | ||
) |
Definition at line 385 of file gphoto2-context.c.
References _GPContext::status_func, and _GPContext::status_func_data.
void gp_context_status | ( | GPContext * | context, |
const char * | format, | ||
... | |||
) |
Definition at line 224 of file gphoto2-context.c.
References gpi_vsnprintf(), _GPContext::status_func, and _GPContext::status_func_data.
void gp_context_unref | ( | GPContext * | context | ) |
Decrements reference count of a context.
Decrement the reference count of a context and free if it goes to 0.
context | The context to drop the reference count. |
Definition at line 115 of file gphoto2-context.c.
References gp_context_free(), and _GPContext::ref_count.