Commit Graph

85 Commits

Author SHA1 Message Date
Martin Hundebøll e69a30f1df gatchat: add g_at_chat_retry()
The current API doesn't support canceling an in-progress command;
instead g_at_chat_cancel() simply removes the callback.

In cases where the modem doesn't respond at all to a command, a chat is
simply stalled without any way to write new commands to the modem.

Support that case by adding a g_at_chat_retry() function to the API. The
function does nothing if the command is not yet in-progress, or if the
command is finished. Otherwise, it resets the bytes-written counter to
re-write the command string.
2019-08-13 02:09:09 -05:00
John Ernberg a34bf08359 gatchat: Use g_slist_free_full 2016-04-22 15:23:22 -05:00
Marcel Holtmann b2b67fa74e gatchat: Fix compiler warning with logical expression
CC       gatchat/gatchat.o
gatchat/gatchat.c: In function ‘have_line’:
gatchat/gatchat.c:586:28: error: logical not is only applied to the left hand side of comparison [-Werror=logical-not-parentheses]
  if (!strncmp(str, "AT", 2) == TRUE)
                            ^
2015-07-07 11:35:54 +02:00
Denis Kenzior bce5d9579c gatchat: Introduce g_at_chat_get_userdata 2015-05-13 09:57:52 -05:00
Marcel Holtmann f83233d295 gatchat: Fix handling of WRITE_SCHEDULER_DEBUG 2014-01-19 16:48:04 -08:00
Marcel Holtmann 17828ce9c9 gatchat: Avoid shadowing variables 2012-07-15 20:14:12 -03:00
Marcel Holtmann 21f9da9916 gatchat: Update copyright information 2011-10-10 13:39:25 -07:00
Denis Kenzior 0471e3ec8d gatchat: Add terminator blacklisting 2011-07-25 03:44:56 +02:00
Marcel Holtmann 6d426a19a6 gatchat: Fix memory leak with notify nodes list
The list itself needs to be freed as well and not only its elements.
2011-05-06 09:19:54 -07:00
Denis Kenzior be5aadc16f gatchat: Add support for short prompt send variant 2011-03-28 18:06:59 -05:00
Denis Kenzior d841fc868a gatchat: Fix minor style issues 2011-02-25 10:55:08 -06:00
Vinicius Costa Gomes 2702a2e349 gatchat: fix canceling in progress commands
As g_queue_peek_head() returns the node data field, we have to compare
it against the actual command, not against the pointer to the queue node.
2010-12-07 12:16:20 -06:00
Lucas De Marchi 521071a785 gatchat: explicitly compare pointers to NULL
This patch was generated by the following semantic patch
(http://coccinelle.lip6.fr/)

// <smpl>
@fix disable is_null,isnt_null1@
expression *E;
@@

- !E
+ E == NULL
// </smpl>
2010-11-29 12:05:29 -06:00
Marcel Holtmann 79e23355a4 gatchat: Fix missing return value for g_at_chat_set_slave 2010-10-21 20:34:13 +02:00
Marcel Holtmann 7492223f49 gatchat: Add support for slave chat instances
This adds support to assign a slave chat instance to an existing chat
instance. The slave chat is now additionally bound by the lifetime of
its master chat instance.

In case the master is cloned, the slave chat instance will also be
cloned as well.

With this it is possible to suspend the master while still have an
active slave for notifications or extra commands.
2010-10-21 18:41:38 +02:00
Denis Kenzior 1e1ddfcf1b gatchat: Fix calling unregister from callbacks
This fixes the issues with SIM hotswap on infineon
2010-10-14 09:42:42 -05:00
Denis Kenzior fd113f7204 gatchat: break out the remove_if logic
And make unregister_group use the new function
2010-10-14 09:42:42 -05:00
Denis Kenzior 7fd86cf94f gatchat: quit early if the group id doesn't match
If the ID of the notify matches but the group id does not match it means
that the unregister is being called with an id that does not belong to
that particular group.  Checking further entries is no longer necessary.
2010-10-14 09:42:42 -05:00
Denis Kenzior 54c75c47f8 gatchat: Skip string contents in extract_line 2010-08-16 13:11:44 -05:00
Denis Kenzior 5f47eca7ed gatchat: Add g_at_chat_clone
This function will clone a chat object, but will create a new group
internally.
2010-08-12 16:06:32 -05:00
Denis Kenzior 2356ebf9ef gatchat: Make GAtChat a facade for struct at_chat
Each GAtChat object is now simply a representation of a set of
outstanding commands and registered unsolicited notification handlers.
This makes it easy to cancel entire groups, e.g. by canceling the
GAtChat object itself rather than forcing the user into tracking all
relevant g_at_chat_register and g_at_chat_send ids.
2010-08-12 16:06:27 -05:00
Denis Kenzior 719842ea39 gatchat: Check for disconnection when resuming
If the internal GAtIO is no longer valid, treat it as if our channel was
disconnected.
2010-06-07 19:32:26 -05:00
Marcel Holtmann 6178173160 Restore GAtChat disconnect handling when resuming a chat session 2010-06-07 02:18:39 -07:00
Kristen Carlson Accardi 72c38f7adb gatchat: implement g_at_chat_get_io() 2010-05-10 15:41:39 -05:00
Denis Kenzior e088f3c2bb gatchat: Don't try to cleanup twice
In case we get unrefed from the disconnect callback
2010-04-28 17:27:35 -05:00
Denis Kenzior 0845dc3b5d gatchat: Use GAtIO for write watchers 2010-04-28 17:27:34 -05:00
Denis Kenzior 85448aac8c gatchat: get_channel should return one from GAtIO 2010-04-28 17:27:34 -05:00
Denis Kenzior 19115e0a15 gatchat: Channel is now setup by GAtIO 2010-04-28 17:27:34 -05:00
Denis Kenzior 033b576593 gatchat: Better re-entrancy handling 2010-04-28 17:27:34 -05:00
Denis Kenzior f9b2e5cf5a gatchat: Only set debug on IO if we have it 2010-04-28 17:27:33 -05:00
Denis Kenzior 3aa1faddef gatchat: Replace shutdown by suspend/resume
Shutdown was actually pointless and according to Marcel he only had it
in mind for PPP useage.
2010-04-28 17:27:33 -05:00
Denis Kenzior 7b8f4f5dc8 gatchat: port gatchat to use gatio 2010-04-28 17:27:33 -05:00
Denis Kenzior f09ce13ad7 gatchat: Remove g_at_chat_set_syntax
Never used and too unsafe in its current form
2010-04-28 17:27:32 -05:00
Marcel Holtmann 8f05535bb2 Add offset parameter to ring_buffer_write_ptr() function 2010-04-24 18:59:44 +02:00
Marcel Holtmann a977ecf260 Remove various GDestroyNotify function casting 2010-04-12 17:48:20 -07:00
Marcel Holtmann 2dab6bc3a6 The user data pointer variable should be called user_data 2010-04-11 17:42:40 +02:00
Marcel Holtmann 764501482e Fix some cases where g_try_new should be used 2010-04-02 19:20:53 -07:00
Denis Kenzior 1905d4deda Fix: Make CONNECT <baud> responses work 2010-03-24 19:42:16 -05:00
Gustavo F. Padovan ed4cf758b7 Remove dead assignments at gatchat 2010-02-03 00:12:49 -06:00
Denis Kenzior 0767f1dbd8 Fix: Check if the command is still pending 2010-02-01 17:59:28 -06:00
Denis Kenzior e6ccc74504 Style: No need for the extra line 2010-02-01 17:59:28 -06:00
Marcel Holtmann 4f3b99e189 Use 3 read attempts when in non-blocking mode 2010-01-28 22:24:04 +01:00
Marcel Holtmann c9a37e4a9a Add new constructor for fully blocking operation 2010-01-28 22:05:44 +01:00
Denis Kenzior fb918d39ba Fix: Take care of uninitialized variable condition
In some (impossible) circumstances rbytes and err might be used
uninitialized.  Here we make a check that a read was actually attempted
before checking those variables.
2010-01-28 14:38:59 -06:00
Marcel Holtmann 839988cfa3 Limit the number of continues read attempts 2010-01-28 12:41:31 +01:00
Denis Kenzior aebda1ac94 Refactor: Reorder argument order
The order of arguments was a bit confusing, reorder them to make more
logical sense.
2010-01-20 14:21:22 -06:00
Zhenhua Zhang 7145edd3a4 Add gatutil.c to share common APIs with GAtServer
Add gatutil.c/h gat.h and move shared typedef and APIs into it.
So that they can be shared by GAtServer and GAtChat.
2010-01-20 14:13:57 -06:00
Denis Kenzior e8d18946b9 Fix: One more fix for disconnect detection
In situations where lots of data is generated by the remote side (e.g.
phonebook is being read) we can get our ring buffer filled up.  In this
case setting rbytes to zero first and then breaking out of the loop
leads to an erroneous disconnect detection.  The fix is to move setting
of rbytes after we know we still have some space.
2010-01-15 10:24:01 -06:00
Denis Kenzior aec5b8a44f Fix: Make remote disconnect detection work 2010-01-14 10:26:12 -06:00
Denis Kenzior 687c84a1ff Style: Various issues 2010-01-12 17:54:37 -06:00