3 * AT chat library with GLib integration
5 * Copyright (C) 2008-2011 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,
33 G_AT_SYNTAX_EXPECT_SHORT_PROMPT
36 typedef enum _GAtSyntaxExpectHint GAtSyntaxExpectHint;
38 enum _GAtSyntaxResult {
39 G_AT_SYNTAX_RESULT_UNRECOGNIZED,
40 G_AT_SYNTAX_RESULT_UNSURE,
41 G_AT_SYNTAX_RESULT_LINE,
42 G_AT_SYNTAX_RESULT_MULTILINE,
43 G_AT_SYNTAX_RESULT_PDU,
44 G_AT_SYNTAX_RESULT_PROMPT,
47 typedef enum _GAtSyntaxResult GAtSyntaxResult;
49 typedef struct _GAtSyntax GAtSyntax;
51 typedef void (*GAtSyntaxSetHintFunc)(GAtSyntax *syntax,
52 GAtSyntaxExpectHint hint);
53 typedef GAtSyntaxResult (*GAtSyntaxFeedFunc)(GAtSyntax *syntax,
54 const char *bytes, gsize *len);
59 GAtSyntaxSetHintFunc set_hint;
60 GAtSyntaxFeedFunc feed;
64 GAtSyntax *g_at_syntax_new_full(GAtSyntaxFeedFunc feed,
65 GAtSyntaxSetHintFunc hint,
68 /* This syntax implements very strict checking of 27.007 standard, which means
69 * it might not work with a majority of modems. However, it does handle echo
70 * properly and can be used to detect a modem's deviations from the relevant
73 GAtSyntax *g_at_syntax_new_gsmv1(void);
75 /* This syntax implements an extremely lax parser that can handle a variety
76 * of modems. Unfortunately it does not deal with echo at all, so echo must
77 * be explicitly turned off before using the parser
79 GAtSyntax *g_at_syntax_new_gsm_permissive(void);
81 GAtSyntax *g_at_syntax_ref(GAtSyntax *syntax);
82 void g_at_syntax_unref(GAtSyntax *syntax);
88 #endif /* __GATSYNTAX_H */