Upgrade ofono to 1.2
[profile/ivi/ofono.git] / gatchat / gatio.h
1 /*
2  *
3  *  AT chat library with GLib integration
4  *
5  *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifndef __GATIO_H
23 #define __GATIO_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include "gat.h"
30
31 struct _GAtIO;
32
33 typedef struct _GAtIO GAtIO;
34
35 struct ring_buffer;
36
37 typedef void (*GAtIOReadFunc)(struct ring_buffer *buffer, gpointer user_data);
38 typedef gboolean (*GAtIOWriteFunc)(gpointer user_data);
39
40 GAtIO *g_at_io_new(GIOChannel *channel);
41 GAtIO *g_at_io_new_blocking(GIOChannel *channel);
42
43 GIOChannel *g_at_io_get_channel(GAtIO *io);
44
45 GAtIO *g_at_io_ref(GAtIO *io);
46 void g_at_io_unref(GAtIO *io);
47
48 gboolean g_at_io_set_read_handler(GAtIO *io, GAtIOReadFunc read_handler,
49                                         gpointer user_data);
50 gboolean g_at_io_set_write_handler(GAtIO *io, GAtIOWriteFunc write_handler,
51                                         gpointer user_data);
52 void g_at_io_set_write_done(GAtIO *io, GAtDisconnectFunc func,
53                                 gpointer user_data);
54
55 void g_at_io_drain_ring_buffer(GAtIO *io, guint len);
56
57 gsize g_at_io_write(GAtIO *io, const gchar *data, gsize count);
58
59 gboolean g_at_io_set_disconnect_function(GAtIO *io,
60                         GAtDisconnectFunc disconnect, gpointer user_data);
61
62 gboolean g_at_io_set_debug(GAtIO *io, GAtDebugFunc func, gpointer user_data);
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* __GATIO_H */