Commit Graph

89 Commits

Author SHA1 Message Date
Denis Kenzior 9ed01bfecd Refactor: Simplify parsing logic
It isn't actually necessary to check the basic command prefixes, if the
extended prefix doesn't match we try to parse it like a basic command.
That one does the same exact check anyway.  If that fails, then this is
not a recognized command line anyway.
2010-03-24 19:41:19 -05:00
Denis Kenzior a9c089ab34 Refactor basic command parsing
Make more bullet proof and efficient
2010-03-24 19:37:18 -05:00
Denis Kenzior 644d5922b2 Style: foo[0] is preferable to *foo 2010-03-24 16:28:42 -05:00
Denis Kenzior 005ecd5dd9 Fix: Be more paranoid in basic command parsing 2010-03-24 16:28:19 -05:00
Zhenhua Zhang 7c8fa919fa Add basic command parsing 2010-03-24 16:02:10 -05:00
Denis Kenzior a8a720d983 Fix: extract line should use S3, not hardcode CR 2010-03-22 12:59:04 -05:00
Denis Kenzior 2583ff626b Refactor: Command line extraction 2010-03-22 12:59:04 -05:00
Denis Kenzior c78805a91b Refactor: Extended command parsing
Make the code more bullet proof and easier to follow
2010-03-22 12:59:04 -05:00
Zhenhua Zhang 7633a54ffd Add g_at_server_register and unregister callback 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 60cf097ffd Add notify at command callback 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 8850d3dc9e Add server at command data structure 2010-03-22 12:59:04 -05:00
Zhenhua Zhang c7828602d4 Add extended command parsing 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 3d4af3eee6 Add framework of server parser
a. The parser fetch and parse one command per loop. The prefix is
the command prefix without parameter. For example, the prefix of
"AT+CLIP=1" is "+CLIP".

b. Search registered notification node in command_list. Invoke the
callback if found.

c. Termiate the execution if the result is an error. Otherwise,
parse next command.
2010-03-22 12:59:04 -05:00
Denis Kenzior 5d8bbb9e5f Fix: Echo everything as soon as received 2010-03-18 14:47:34 -05:00
Zhenhua Zhang 73d92263a6 Refactor add is_basic_command_prefix function 2010-03-18 13:25:56 -05:00
Zhenhua Zhang c57be559d6 Rename parse_v250_settings
To parse_basic_command
2010-03-18 13:24:56 -05:00
Zhenhua Zhang 05209cb701 Rename parse_at_command
To parse_extended_command
2010-03-18 13:24:36 -05:00
Zhenhua Zhang 171a4117fc Rename is_at_command_prefix
To is_extended_command_prefix
2010-03-18 13:24:24 -05:00
Zhenhua Zhang 074c7ff920 Rename g_at_server_send_result
To g_at_server_send_final
2010-03-18 13:24:06 -05:00
Denis Kenzior 4cbb33fcbd Fix: Use the proper enum type 2010-03-03 13:07:24 -06:00
Zhenhua Zhang 72851607e1 Add command echo back if ATE=1 2010-03-03 13:01:34 -06:00
Denis Kenzior 7be80ef131 Fix: Simplify write-again logic 2010-02-26 16:17:57 -06:00
Denis Kenzior 988fed5951 Fix: Don't allocate buffers if we don't need to 2010-02-26 16:16:46 -06:00
Zhenhua Zhang c6f4d051b2 Add write server response into non-blocking IO
Write server response into non-blocking GIOChannel when we have
G_IO_OUT signal.
2010-02-26 16:10:19 -06:00
Zhenhua Zhang 534898f164 Add write buffer queue for non-blocking write
The head of the queue is the data to be written, the tail is the
free buffer to cache data into.

If the tail of queue is full, allocate a new free buffer and
append it at the tail.
2010-02-26 16:07:33 -06:00
Zhenhua Zhang e96293d5bb Add define for read and write buffer size 2010-02-26 16:04:52 -06:00
Zhenhua Zhang 79b480166c Do not trigger user disconnect at g_at_shutdown
Similar to gatchat, introduce read_watcher_destroy_notify and do
not trigger user disconnect at g_at_shutdown. Delay destroy of
gatserver until read_watcher is destroyed.
2010-02-26 16:04:36 -06:00
Zhenhua Zhang c4073fca00 Rename server_io to channel
To make it consistent with GAtChat.
2010-02-10 16:41:31 -06:00
Zhenhua Zhang c5f962cb18 Replace sprintf with snprintf 2010-02-10 16:41:31 -06:00
Zhenhua Zhang d80bba564e Rename buf to read_buf in GAtServer
Because we may introduce write_buf for sever response buffer.
2010-02-10 16:41:31 -06:00
Zhenhua Zhang 2a58101807 Fix change state immediately when meet the slash
According to V.250 spec section 5.2.4 Repeating a command line, if
the prefix "A/" or "a/" is received, we should execute the last
command immediately. No need to meet \r.
2010-02-02 11:31:23 -06:00
Denis Kenzior a4b681f02f Fix: Remove unused label 2010-02-01 18:02:40 -06:00
Denis Kenzior 321bb02ee3 Fix: Skip whitespace in AT command line 2010-02-01 17:59:29 -06:00
Denis Kenzior 57d62a0b42 Refactor: Use more flexible parser framework 2010-02-01 17:59:29 -06:00
Denis Kenzior 263044721e Fix: Don't set variables to NULL/0
These were already set to 0 by g_try_new0
2010-02-01 17:59:28 -06:00
Denis Kenzior b6961b0d68 Refactor: Support max_read attempts like GAtChat 2010-02-01 17:59:28 -06:00
Denis Kenzior 1514997ff1 Fix: Use a function instead of a table 2010-02-01 17:59:28 -06:00
Denis Kenzior cd1845da6b Fix: Make compile 2010-02-01 17:59:28 -06:00
Zhenhua Zhang df7b1b30dc Add GAtServer basic parsing support
It's the basic skeleton of GAtServer, including new/shutdown, ref/
unref, received_data/parse_buffer and set_discuss/set_debug.

GAtServer is to emulate the server side of AT conversation. It
complies with V.250 and 27.007 spec to accept AT command like
ATV1, ATE0 and extended command like AT+CLCC. Upper layer could
create customize server to expose TTY, tcp or unix socket to
client side application.
2010-02-01 17:59:27 -06:00