Add functions for disconnect and debug handling

This commit is contained in:
Marcel Holtmann 2009-09-06 00:31:26 +02:00
parent c9ba0e7df5
commit 094fdd4e71
2 changed files with 36 additions and 2 deletions

View File

@ -35,8 +35,12 @@
#include "gatmux.h"
struct _GAtMux {
gint ref_count; /* Ref count */
GIOChannel *channel; /* channel */
gint ref_count; /* Ref count */
GIOChannel *channel; /* channel */
GAtDisconnectFunc user_disconnect; /* user disconnect func */
gpointer user_disconnect_data; /* user disconnect data */
GAtDebugFunc debugf; /* debugging output function */
gpointer debug_data; /* Data to pass to debug func */
};
GAtMux *g_at_mux_new(GIOChannel *channel)
@ -125,3 +129,26 @@ gboolean g_at_mux_shutdown(GAtMux *mux)
return TRUE;
}
gboolean g_at_mux_set_disconnect_function(GAtMux *mux,
GAtDisconnectFunc disconnect, gpointer user_data)
{
if (mux == NULL)
return FALSE;
mux->user_disconnect = disconnect;
mux->user_disconnect_data = user_data;
return TRUE;
}
gboolean g_at_mux_set_debug(GAtMux *mux, GAtDebugFunc func, gpointer user)
{
if (mux == NULL)
return FALSE;
mux->debugf = func;
mux->debug_data = user;
return TRUE;
}

View File

@ -26,6 +26,8 @@
extern "C" {
#endif
#include "gatchat.h"
struct _GAtMux;
typedef struct _GAtMux GAtMux;
@ -38,6 +40,11 @@ void g_at_mux_unref(GAtMux *mux);
gboolean g_at_mux_shutdown(GAtMux *mux);
gboolean g_at_mux_set_disconnect_function(GAtMux *mux,
GAtDisconnectFunc disconnect, gpointer user_data);
gboolean g_at_mux_set_debug(GAtMux *mux, GAtDebugFunc func, gpointer user);
#ifdef __cplusplus
}
#endif