aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-03-15 14:51:18 -0700
committerDan Williams <dcbw@redhat.com>2010-03-15 14:51:18 -0700
commitd9a47ef2e81fe0b7c3aa9f05af3233181e5a73a1 (patch)
treee9ce76f552126680c9b6ba7c8cb647e25a8269c0 /src
parent3151e0e2987d8505a56c5a6a0f486e3a7e8ada71 (diff)
core: fix serial port base class callback types
Diffstat (limited to 'src')
-rw-r--r--src/mm-at-serial-port.c4
-rw-r--r--src/mm-qcdm-serial-port.c4
-rw-r--r--src/mm-serial-port.c22
-rw-r--r--src/mm-serial-port.h10
4 files changed, 30 insertions, 10 deletions
diff --git a/src/mm-at-serial-port.c b/src/mm-at-serial-port.c
index 40fbd448..d038c50c 100644
--- a/src/mm-at-serial-port.c
+++ b/src/mm-at-serial-port.c
@@ -238,7 +238,7 @@ mm_at_serial_port_queue_command (MMAtSerialPort *self,
buf,
TRUE,
timeout_seconds,
- G_CALLBACK (callback),
+ (MMSerialResponseFn) callback,
user_data);
}
@@ -262,7 +262,7 @@ mm_at_serial_port_queue_command_cached (MMAtSerialPort *self,
buf,
TRUE,
timeout_seconds,
- G_CALLBACK (callback),
+ (MMSerialResponseFn) callback,
user_data);
}
diff --git a/src/mm-qcdm-serial-port.c b/src/mm-qcdm-serial-port.c
index 51d7c189..14ccf561 100644
--- a/src/mm-qcdm-serial-port.c
+++ b/src/mm-qcdm-serial-port.c
@@ -104,7 +104,7 @@ mm_qcdm_serial_port_queue_command (MMQcdmSerialPort *self,
command,
TRUE,
timeout_seconds,
- G_CALLBACK (callback),
+ (MMSerialResponseFn) callback,
user_data);
}
@@ -124,7 +124,7 @@ mm_qcdm_serial_port_queue_command_cached (MMQcdmSerialPort *self,
command,
TRUE,
timeout_seconds,
- G_CALLBACK (callback),
+ (MMSerialResponseFn) callback,
user_data);
}
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 29505a21..bdef2784 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -492,6 +493,18 @@ mm_serial_port_schedule_queue_process (MMSerialPort *self)
}
static void
+real_handle_response (MMSerialPort *self,
+ GByteArray *response,
+ GError *error,
+ GCallback callback,
+ gpointer callback_data)
+{
+ MMSerialResponseFn response_callback = (MMSerialResponseFn) callback;
+
+ response_callback (self, response, error, callback_data);
+}
+
+static void
mm_serial_port_got_response (MMSerialPort *self, GError *error)
{
MMSerialPortPrivate *priv = MM_SERIAL_PORT_GET_PRIVATE (self);
@@ -825,7 +838,7 @@ internal_queue_command (MMSerialPort *self,
gboolean take_command,
gboolean cached,
guint32 timeout_seconds,
- GCallback callback,
+ MMSerialResponseFn callback,
gpointer user_data)
{
MMSerialPortPrivate *priv = MM_SERIAL_PORT_GET_PRIVATE (self);
@@ -843,7 +856,7 @@ internal_queue_command (MMSerialPort *self,
}
info->cached = cached;
info->timeout = timeout_seconds;
- info->callback = callback;
+ info->callback = (GCallback) callback;
info->user_data = user_data;
/* Clear the cached value for this command if not asking for cached value */
@@ -861,7 +874,7 @@ mm_serial_port_queue_command (MMSerialPort *self,
GByteArray *command,
gboolean take_command,
guint32 timeout_seconds,
- GCallback callback,
+ MMSerialResponseFn callback,
gpointer user_data)
{
internal_queue_command (self, command, take_command, FALSE, timeout_seconds, callback, user_data);
@@ -872,7 +885,7 @@ mm_serial_port_queue_command_cached (MMSerialPort *self,
GByteArray *command,
gboolean take_command,
guint32 timeout_seconds,
- GCallback callback,
+ MMSerialResponseFn callback,
gpointer user_data)
{
internal_queue_command (self, command, take_command, TRUE, timeout_seconds, callback, user_data);
@@ -1202,6 +1215,7 @@ mm_serial_port_class_init (MMSerialPortClass *klass)
object_class->finalize = finalize;
klass->config_fd = real_config_fd;
+ klass->handle_response = real_handle_response;
/* Properties */
g_object_class_install_property
diff --git a/src/mm-serial-port.h b/src/mm-serial-port.h
index a8ee8bee..a757c932 100644
--- a/src/mm-serial-port.h
+++ b/src/mm-serial-port.h
@@ -43,6 +43,12 @@ typedef void (*MMSerialFlashFn) (MMSerialPort *port,
GError *error,
gpointer user_data);
+typedef void (*MMSerialResponseFn) (MMSerialPort *port,
+ GByteArray *response,
+ GError *error,
+ gpointer user_data);
+
+
struct _MMSerialPort {
MMPort parent;
};
@@ -106,14 +112,14 @@ void mm_serial_port_queue_command (MMSerialPort *self,
GByteArray *command,
gboolean take_command,
guint32 timeout_seconds,
- GCallback callback,
+ MMSerialResponseFn callback,
gpointer user_data);
void mm_serial_port_queue_command_cached (MMSerialPort *self,
GByteArray *command,
gboolean take_command,
guint32 timeout_seconds,
- GCallback callback,
+ MMSerialResponseFn callback,
gpointer user_data);
#endif /* MM_SERIAL_PORT_H */