7 #ifndef __gammu_debug_h
8 #define __gammu_debug_h
11 * \defgroup Debug Debug
17 #include <gammu-error.h>
18 #include <gammu-misc.h>
21 * Debugging configuration.
24 typedef struct _GSM_Debug_Info GSM_Debug_Info
;
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.
36 GSM_Error
GSM_SetDebugFunction(GSM_Log_Function info
, void *data
,
37 GSM_Debug_Info
* privdi
);
42 * \param info File path.
43 * \param privdi Pointer to debug information data.
48 GSM_Error
GSM_SetDebugFile(const char *info
, GSM_Debug_Info
* privdi
);
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
62 GSM_Error
GSM_SetDebugFileDescriptor(FILE * fd
, gboolean closable
,
63 GSM_Debug_Info
* privdi
);
66 * Returns global debug settings.
68 * \return Pointer to global settings.
72 GSM_Debug_Info
*GSM_GetGlobalDebug(void);
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
);
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
);
99 * \param info Level as text.
100 * \param privdi Pointer to debug information data.
101 * \return True on success.
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.
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.
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.
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).
152 int smprintf(GSM_StateMachine
* s
, const char *format
, ...);
156 /* Editor configuration
157 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: