Translated using Weblate.
[gammu.git] / include / gammu-debug.h
blob8bc0516e675dc3b1e192d533a4092002678fda55
1 /**
2 * \file gammu-debug.h
3 * \author Michal Čihař
5 * Debuging handling.
6 */
7 #ifndef __gammu_debug_h
8 #define __gammu_debug_h
10 /**
11 * \defgroup Debug Debug
12 * Debuging handling.
15 #include <stdio.h>
17 #include <gammu-error.h>
18 #include <gammu-misc.h>
20 /**
21 * Debugging configuration.
22 * \ingroup Debug
24 typedef struct _GSM_Debug_Info GSM_Debug_Info;
26 /**
27 * Sets logging function.
29 * \param info Function to call.
30 * \param data User data to pass as a second parameter to callback.
31 * \param privdi Pointer to debug information data.
32 * \return Error code.
34 * \ingroup Debug
36 GSM_Error GSM_SetDebugFunction(GSM_Log_Function info, void *data,
37 GSM_Debug_Info * privdi);
39 /**
40 * Sets debug file.
42 * \param info File path.
43 * \param privdi Pointer to debug information data.
44 * \return Error code.
46 * \ingroup Debug
48 GSM_Error GSM_SetDebugFile(const char *info, GSM_Debug_Info * privdi);
50 /**
51 * Sets debug file.
53 * \param fd File descriptor.
54 * \param privdi Pointer to debug information data.
55 * \param closable Whether Gammu can close the file when it is no longer
56 * needed for debug output. Please note that stderr or stdout are never
57 * closed.
58 * \return Error code.
60 * \ingroup Debug
62 GSM_Error GSM_SetDebugFileDescriptor(FILE * fd, gboolean closable,
63 GSM_Debug_Info * privdi);
65 /**
66 * Returns global debug settings.
68 * \return Pointer to global settings.
70 * \ingroup Debug
72 GSM_Debug_Info *GSM_GetGlobalDebug(void);
74 /**
75 * Gets debug information for state machine.
77 * \param s State machine data
78 * \return Debug information.
80 * \ingroup StateMachine
82 GSM_Debug_Info *GSM_GetDebug(GSM_StateMachine * s);
84 /**
85 * Returns debug information active for state machine. Please note that
86 * it can be either global debug or state machine debug structure,
87 * depending on use_global flag. For configuring usite GSM_GetDebug.
89 * \param s State machine data
90 * \return Debug information.
92 * \ingroup StateMachine
94 GSM_Debug_Info *GSM_GetDI(GSM_StateMachine * s);
96 /**
97 * Sets debug level.
99 * \param info Level as text.
100 * \param privdi Pointer to debug information data.
101 * \return True on success.
103 * \ingroup Debug
105 gboolean GSM_SetDebugLevel(const char *info, GSM_Debug_Info * privdi);
108 * Sets debug encoding.
110 * \param info Encoding to set.
111 * \param privdi Pointer to debug information data.
112 * \return True on success.
114 * \ingroup Debug
116 gboolean GSM_SetDebugCoding(const char *info, GSM_Debug_Info * privdi);
119 * Enables using of global debugging configuration. Makes no effect on
120 * global debug configuration.
122 * \param info Enable global debug usage..
123 * \param privdi Pointer to debug information data.
124 * \return True on success.
126 * \ingroup Debug
128 gboolean GSM_SetDebugGlobal(gboolean info, GSM_Debug_Info * privdi);
131 * Logs error to debug log with additional message.
133 * \param s State machine structure pointer.
134 * \param message String to be show in message.
135 * \param err Error code.
137 * \ingroup Debug
139 void GSM_LogError(GSM_StateMachine * s, const char *message,
140 const GSM_Error err);
143 * Prints string to defined debug log.
145 * \param s State machine, where to print.
146 * \param format Format string as for printf.
147 * \return Upon successful return, these functions return the number of characters printed (as printf).
149 * \ingroup Debug
151 PRINTF_STYLE(2, 3)
152 int smprintf(GSM_StateMachine * s, const char *format, ...);
154 #endif
156 /* Editor configuration
157 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: