3 * AT chat library with GLib integration
5 * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
6 * Copyright (C) 2009 Trolltech ASA.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 typedef struct _GAtMux GAtMux;
35 typedef struct _GAtMuxDriver GAtMuxDriver;
36 typedef enum _GAtMuxChannelStatus GAtMuxChannelStatus;
37 typedef void (*GAtMuxSetupFunc)(GAtMux *mux, gpointer user_data);
39 enum _GAtMuxDlcStatus {
40 G_AT_MUX_DLC_STATUS_RTC = 0x02,
41 G_AT_MUX_DLC_STATUS_RTR = 0x04,
42 G_AT_MUX_DLC_STATUS_IC = 0x08,
43 G_AT_MUX_DLC_STATUS_DV = 0x80,
46 struct _GAtMuxDriver {
47 void (*remove)(GAtMux *mux);
48 gboolean (*startup)(GAtMux *mux);
49 gboolean (*shutdown)(GAtMux *mux);
50 gboolean (*open_dlc)(GAtMux *mux, guint8 dlc);
51 gboolean (*close_dlc)(GAtMux *mux, guint8 dlc);
52 void (*set_status)(GAtMux *mux, guint8 dlc, guint8 status);
53 void (*write)(GAtMux *mux, guint8 dlc, const void *data, int towrite);
54 int (*feed_data)(GAtMux *mux, void *data, int len);
57 GAtMux *g_at_mux_new(GIOChannel *channel, const GAtMuxDriver *driver);
58 GAtMux *g_at_mux_new_gsm0710_basic(GIOChannel *channel, int framesize);
59 GAtMux *g_at_mux_new_gsm0710_advanced(GIOChannel *channel, int framesize);
61 GAtMux *g_at_mux_ref(GAtMux *mux);
62 void g_at_mux_unref(GAtMux *mux);
64 gboolean g_at_mux_start(GAtMux *mux);
65 gboolean g_at_mux_shutdown(GAtMux *mux);
67 gboolean g_at_mux_set_disconnect_function(GAtMux *mux,
68 GAtDisconnectFunc disconnect, gpointer user_data);
70 gboolean g_at_mux_set_debug(GAtMux *mux, GAtDebugFunc func, gpointer user_data);
72 GIOChannel *g_at_mux_create_channel(GAtMux *mux);
75 * Multiplexer driver integration functions
77 void g_at_mux_set_dlc_status(GAtMux *mux, guint8 dlc, int status);
78 void g_at_mux_feed_dlc_data(GAtMux *mux, guint8 dlc,
79 const void *data, int tofeed);
81 int g_at_mux_raw_write(GAtMux *mux, const void *data, int towrite);
83 void g_at_mux_set_data(GAtMux *mux, void *data);
84 void *g_at_mux_get_data(GAtMux *mux);
87 * Uses the passed in GAtChat to setup a GSM 07.10 style multiplexer on the
88 * channel used by GAtChat. This function queries the multiplexer capability,
89 * preferring advanced mode over basic. If supported, the best available
90 * multiplexer mode is entered. If this is successful, the chat is
91 * shutdown and unrefed. The chat's channel will be transferred to the
92 * resulting multiplexer object.
94 gboolean g_at_mux_setup_gsm0710(GAtChat *chat,
95 GAtMuxSetupFunc notify, gpointer user_data,
96 GDestroyNotify destroy);
102 #endif /* __GATMUX_H */