Debug

GSM_Error GSM_SetDebugFunction(GSM_Log_Function info, void *data, GSM_Debug_Info *privdi)

Sets logging function.

Parameters:
  • info – Function to call.

  • data – User data to pass as a second parameter to callback.

  • privdi – Pointer to debug information data.

Returns:

Error code.

GSM_Error GSM_SetDebugFile(const char *info, GSM_Debug_Info *privdi)

Sets debug file.

Parameters:
  • info – File path.

  • privdi – Pointer to debug information data.

Returns:

Error code.

GSM_Error GSM_SetDebugFileDescriptor(FILE *fd, gboolean closable, GSM_Debug_Info *privdi)

Sets debug file.

Parameters:
  • fd – File descriptor.

  • privdi – Pointer to debug information data.

  • closable – Whether Gammu can close the file when it is no longer needed for debug output. Please note that stderr or stdout are never closed.

Returns:

Error code.

GSM_Debug_Info *GSM_GetGlobalDebug(void)

Returns global debug settings.

Returns:

Pointer to global settings.

GSM_Debug_Info *GSM_GetDebug(GSM_StateMachine *s)

Gets debug information for state machine.

Parameters:
  • s – State machine data

Returns:

Debug information.

GSM_Debug_Info *GSM_GetDI(GSM_StateMachine *s)

Returns debug information active for state machine. Please note that it can be either global debug or state machine debug structure, depending on use_global flag. For configuring usite GSM_GetDebug.

Parameters:
  • s – State machine data

Returns:

Debug information.

gboolean GSM_SetDebugLevel(const char *info, GSM_Debug_Info *privdi)

Sets debug level.

Parameters:
  • info – Level as text.

  • privdi – Pointer to debug information data.

Returns:

True on success.

gboolean GSM_SetDebugCoding(const char *info, GSM_Debug_Info *privdi)

Sets debug encoding.

Parameters:
  • info – Encoding to set.

  • privdi – Pointer to debug information data.

Returns:

True on success.

gboolean GSM_SetDebugGlobal(gboolean info, GSM_Debug_Info *privdi)

Enables using of global debugging configuration. Makes no effect on global debug configuration.

Parameters:
  • info – Enable global debug usage..

  • privdi – Pointer to debug information data.

Returns:

True on success.

void GSM_LogError(GSM_StateMachine *s, const char *message, const GSM_Error err)

Logs error to debug log with additional message.

Parameters:
  • s – State machine structure pointer.

  • message – String to be show in message.

  • err – Error code.

int smprintf(GSM_StateMachine *s, const char *format, ...)

Prints string to defined debug log.

Parameters:
  • s – State machine, where to print.

  • format – Format string as for printf.

Returns:

Upon successful return, these functions return the number of characters printed (as printf).

typedef struct _GSM_Debug_Info GSM_Debug_Info

Debugging configuration.