3 * AT chat library with GLib integration
5 * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
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.
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.
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
29 enum _GAtSyntaxExpectHint {
30 G_AT_SYNTAX_EXPECT_PDU,
31 G_AT_SYNTAX_EXPECT_MULTILINE,
32 G_AT_SYNTAX_EXPECT_PROMPT
35 typedef enum _GAtSyntaxExpectHint GAtSyntaxExpectHint;
37 enum _GAtSyntaxResult {
38 G_AT_SYNTAX_RESULT_UNRECOGNIZED,
39 G_AT_SYNTAX_RESULT_UNSURE,
40 G_AT_SYNTAX_RESULT_LINE,
41 G_AT_SYNTAX_RESULT_MULTILINE,
42 G_AT_SYNTAX_RESULT_PDU,
43 G_AT_SYNTAX_RESULT_PROMPT,
46 typedef enum _GAtSyntaxResult GAtSyntaxResult;
48 typedef struct _GAtSyntax GAtSyntax;
50 typedef void (*GAtSyntaxSetHintFunc)(GAtSyntax *syntax,
51 GAtSyntaxExpectHint hint);
52 typedef GAtSyntaxResult (*GAtSyntaxFeedFunc)(GAtSyntax *syntax,
53 const char *bytes, gsize *len);
58 GAtSyntaxSetHintFunc set_hint;
59 GAtSyntaxFeedFunc feed;
63 GAtSyntax *g_at_syntax_new_full(GAtSyntaxFeedFunc feed,
64 GAtSyntaxSetHintFunc hint,
67 /* This syntax implements very strict checking of 27.007 standard, which means
68 * it might not work with a majority of modems. However, it does handle echo
69 * properly and can be used to detect a modem's deviations from the relevant
72 GAtSyntax *g_at_syntax_new_gsmv1();
74 /* This syntax implements an extremely lax parser that can handle a variety
75 * of modems. Unfortunately it does not deal with echo at all, so echo must
76 * be explicitly turned off before using the parser
78 GAtSyntax *g_at_syntax_new_gsm_permissive();
80 GAtSyntax *g_at_syntax_ref(GAtSyntax *syntax);
81 void g_at_syntax_unref(GAtSyntax *syntax);
87 #endif /* __GATSYNTAX_H */