summaryrefslogtreecommitdiff
path: root/src/mm-callback-info.c
diff options
context:
space:
mode:
authorTambet Ingo <tambet@gmail.com>2008-09-11 08:35:32 +0300
committerTambet Ingo <tambet@gmail.com>2008-09-11 08:35:32 +0300
commitac4409e7cea29e03d311e6b805a084837d8bb70f (patch)
tree6b534ff91a3976a0268a89c858543bc973b17f8c /src/mm-callback-info.c
parentbb874acea0c8552f86932084e222b45a94119f29 (diff)
downloadModemManager-ac4409e7cea29e03d311e6b805a084837d8bb70f.tar.gz
Rewrite serial device communications.
Instead of vague "send something, wait something" the responses are now analyzed by (overridable) parsers. Makes all the modem implementations much easier since each caller knows without any code whether the call succeeded or failed. Another thing that makes modem code simpler (and the whole thing more robust), is the queueing of sent commands. Each queued command has a command and a callback which is quaranteed to get called, even if sending failed. Define and implement error reporting.
Diffstat (limited to 'src/mm-callback-info.c')
-rw-r--r--src/mm-callback-info.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/mm-callback-info.c b/src/mm-callback-info.c
index d016aad44..61283b268 100644
--- a/src/mm-callback-info.c
+++ b/src/mm-callback-info.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "mm-callback-info.h"
-#include "mm-modem-error.h"
+#include "mm-errors.h"
static void
callback_info_done (gpointer user_data)
@@ -23,9 +23,10 @@ callback_info_done (gpointer user_data)
if (info->error)
g_error_free (info->error);
- g_object_unref (info->modem);
- g_datalist_clear (&info->qdata);
+ if (info->modem)
+ g_object_unref (info->modem);
+ g_datalist_clear (&info->qdata);
g_slice_free (MMCallbackInfo, info);
}
@@ -43,15 +44,6 @@ mm_callback_info_schedule (MMCallbackInfo *info)
info->pending_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, callback_info_do, info, callback_info_done);
}
-void
-mm_callback_info_cancel (MMCallbackInfo *info)
-{
- if (info->pending_id) {
- info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s", "Call cancelled");
- mm_callback_info_schedule (info);
- }
-}
-
MMCallbackInfo *
mm_callback_info_new (MMModem *modem, MMModemFn callback, gpointer user_data)
{