[PATCH 1/3] libmbim-glib: mbim-device: Emit MBIM_DEVICE_SIGNAL_REMOVED when device is removed
Greg Suarez
gpsuarez2512 at gmail.com
Wed Jul 23 14:21:23 PDT 2014
Emit the MBIM_DEVICE_SIGNAL_REMOVED when G_IO_HUP is received on the
GIOChannel.
---
src/libmbim-glib/mbim-device.c | 20 ++++++++++++++++++++
src/libmbim-glib/mbim-device.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index eab3933..59d2e05 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -71,6 +71,7 @@ static GParamSpec *properties[PROP_LAST];
enum {
SIGNAL_INDICATE_STATUS,
SIGNAL_ERROR,
+ SIGNAL_REMOVED,
SIGNAL_LAST
};
@@ -633,6 +634,7 @@ data_available (GIOChannel *source,
g_byte_array_remove_range (self->priv->response, 0, self->priv->response->len);
mbim_device_close_force (self, NULL);
+ g_signal_emit (self, signals[SIGNAL_REMOVED], 0 );
return FALSE;
}
@@ -2172,4 +2174,22 @@ mbim_device_class_init (MbimDeviceClass *klass)
G_TYPE_NONE,
1,
G_TYPE_ERROR);
+
+ /**
+ * MbimDevice::device-removed:
+ * @self: the #MbimDevice
+ * @message: None
+ *
+ * The ::device-removed signal is emitted when an unexpected port hang-up is received.
+ */
+ signals[SIGNAL_REMOVED] =
+ g_signal_new (MBIM_DEVICE_SIGNAL_REMOVED,
+ G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 0);
}
diff --git a/src/libmbim-glib/mbim-device.h b/src/libmbim-glib/mbim-device.h
index 93ef77d..abbfd29 100644
--- a/src/libmbim-glib/mbim-device.h
+++ b/src/libmbim-glib/mbim-device.h
@@ -51,6 +51,7 @@ typedef struct _MbimDevicePrivate MbimDevicePrivate;
#define MBIM_DEVICE_SIGNAL_INDICATE_STATUS "device-indicate-status"
#define MBIM_DEVICE_SIGNAL_ERROR "device-error"
+#define MBIM_DEVICE_SIGNAL_REMOVED "device-removed"
/**
* MbimDevice:
--
1.9.3
More information about the libmbim-devel
mailing list