ports: rename 'MMMbimPort' to 'MMPortMbim'

This commit is contained in:
Aleksander Morgado
2014-02-13 13:40:07 +01:00
parent 403e013f15
commit c236e18692
10 changed files with 95 additions and 95 deletions
+2 -2
View File
@@ -106,8 +106,8 @@ endif
# Additional MBIM support in libserial
if WITH_MBIM
libserial_la_SOURCES += \
mm-mbim-port.c \
mm-mbim-port.h
mm-port-mbim.c \
mm-port-mbim.h
libserial_la_CPPFLAGS += $(MBIM_CFLAGS)
endif
+13 -13
View File
@@ -252,7 +252,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
#endif
#if defined WITH_MBIM
if (!port && ptype == MM_PORT_TYPE_MBIM)
port = MM_PORT (mm_mbim_port_new (name));
port = MM_PORT (mm_port_mbim_new (name));
#endif
if (!port) {
g_set_error (error,
@@ -720,41 +720,41 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
#if defined WITH_MBIM
MMMbimPort *
MMPortMbim *
mm_base_modem_get_port_mbim (MMBaseModem *self)
{
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
/* First MBIM port in the list is the primary one always */
return (self->priv->mbim ? ((MMMbimPort *)g_object_ref (self->priv->mbim->data)) : NULL);
return (self->priv->mbim ? ((MMPortMbim *)g_object_ref (self->priv->mbim->data)) : NULL);
}
MMMbimPort *
MMPortMbim *
mm_base_modem_peek_port_mbim (MMBaseModem *self)
{
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
/* First MBIM port in the list is the primary one always */
return (self->priv->mbim ? (MMMbimPort *)self->priv->mbim->data : NULL);
return (self->priv->mbim ? (MMPortMbim *)self->priv->mbim->data : NULL);
}
MMMbimPort *
MMPortMbim *
mm_base_modem_get_port_mbim_for_data (MMBaseModem *self,
MMPort *data,
GError **error)
{
MMMbimPort *mbim;
MMPortMbim *mbim;
mbim = mm_base_modem_peek_port_mbim_for_data (self, data, error);
return (mbim ? (MMMbimPort *)g_object_ref (mbim) : NULL);
return (mbim ? (MMPortMbim *)g_object_ref (mbim) : NULL);
}
MMMbimPort *
MMPortMbim *
mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self,
MMPort *data,
GError **error)
{
MMMbimPort *found;
MMPortMbim *found;
GUdevClient *client;
GUdevDevice *data_device;
GUdevDevice *data_device_parent;
@@ -834,7 +834,7 @@ mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self,
if (g_str_equal (g_udev_device_get_sysfs_path (data_device_parent),
g_udev_device_get_sysfs_path (mbim_device_parent)))
found = MM_MBIM_PORT (l->data);
found = MM_PORT_MBIM (l->data);
g_object_unref (mbim_device_parent);
}
@@ -853,7 +853,7 @@ mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self,
mm_info ("Assuming MBIM port '%s' is associated to net/%s",
mm_port_get_device (MM_PORT (self->priv->mbim->data)),
mm_port_get_device (data));
found = MM_MBIM_PORT (self->priv->mbim->data);
found = MM_PORT_MBIM (self->priv->mbim->data);
} else {
g_set_error (error,
MM_CORE_ERROR,
@@ -1599,7 +1599,7 @@ dispose (GObject *object)
#endif
#if defined WITH_MBIM
/* We need to close the MBIM port cleanly when disposing the modem object */
g_list_foreach (self->priv->mbim, (GFunc)mm_mbim_port_close, NULL);
g_list_foreach (self->priv->mbim, (GFunc)mm_port_mbim_close, NULL);
g_list_free_full (self->priv->mbim, g_object_unref);
self->priv->mbim = NULL;
#endif
+5 -5
View File
@@ -39,7 +39,7 @@
#endif
#if defined WITH_MBIM
#include "mm-mbim-port.h"
#include "mm-port-mbim.h"
#endif
#define MM_TYPE_BASE_MODEM (mm_base_modem_get_type ())
@@ -134,8 +134,8 @@ MMPortQmi *mm_base_modem_peek_port_qmi (MMBaseModem *self);
MMPortQmi *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif
#if defined WITH_MBIM
MMMbimPort *mm_base_modem_peek_port_mbim (MMBaseModem *self);
MMMbimPort *mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self, MMPort *data, GError **error);
MMPortMbim *mm_base_modem_peek_port_mbim (MMBaseModem *self);
MMPortMbim *mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif
MMPortSerialAt *mm_base_modem_peek_best_at_port (MMBaseModem *self, GError **error);
MMPort *mm_base_modem_peek_best_data_port (MMBaseModem *self, MMPortType type);
@@ -151,8 +151,8 @@ MMPortQmi *mm_base_modem_get_port_qmi (MMBaseModem *self);
MMPortQmi *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif
#if defined WITH_MBIM
MMMbimPort *mm_base_modem_get_port_mbim (MMBaseModem *self);
MMMbimPort *mm_base_modem_get_port_mbim_for_data (MMBaseModem *self, MMPort *data, GError **error);
MMPortMbim *mm_base_modem_get_port_mbim (MMBaseModem *self);
MMPortMbim *mm_base_modem_get_port_mbim_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif
MMPortSerialAt *mm_base_modem_get_best_at_port (MMBaseModem *self, GError **error);
MMPort *mm_base_modem_get_best_data_port (MMBaseModem *self, MMPortType type);
+2 -2
View File
@@ -66,7 +66,7 @@ peek_ports (gpointer self,
g_assert (MM_IS_BASE_MODEM (modem));
if (o_device) {
MMMbimPort *port;
MMPortMbim *port;
port = mm_base_modem_peek_port_mbim (modem);
if (!port) {
@@ -80,7 +80,7 @@ peek_ports (gpointer self,
return FALSE;
}
*o_device = mm_mbim_port_peek_device (port);
*o_device = mm_port_mbim_peek_device (port);
}
if (o_data) {
+12 -12
View File
@@ -81,7 +81,7 @@ peek_device (gpointer self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMMbimPort *port;
MMPortMbim *port;
port = mm_base_modem_peek_port_mbim (MM_BASE_MODEM (self));
if (!port) {
@@ -94,7 +94,7 @@ peek_device (gpointer self,
return FALSE;
}
*o_device = mm_mbim_port_peek_device (port);
*o_device = mm_port_mbim_peek_device (port);
return TRUE;
}
@@ -1226,7 +1226,7 @@ enabling_started (MMBroadbandModem *self,
typedef struct {
MMBroadbandModem *self;
GSimpleAsyncResult *result;
MMMbimPort *mbim;
MMPortMbim *mbim;
} InitializationStartedContext;
static void
@@ -1285,13 +1285,13 @@ parent_initialization_started (InitializationStartedContext *ctx)
}
static void
mbim_port_open_ready (MMMbimPort *mbim,
mbim_port_open_ready (MMPortMbim *mbim,
GAsyncResult *res,
InitializationStartedContext *ctx)
{
GError *error = NULL;
if (!mm_mbim_port_open_finish (mbim, res, &error)) {
if (!mm_port_mbim_open_finish (mbim, res, &error)) {
g_simple_async_result_take_error (ctx->result, error);
initialization_started_context_complete_and_free (ctx);
return;
@@ -1326,14 +1326,14 @@ initialization_started (MMBroadbandModem *self,
return;
}
if (mm_mbim_port_is_open (ctx->mbim)) {
if (mm_port_mbim_is_open (ctx->mbim)) {
/* Nothing to be done, just launch parent's callback */
parent_initialization_started (ctx);
return;
}
/* Now open our MBIM port */
mm_mbim_port_open (ctx->mbim,
mm_port_mbim_open (ctx->mbim,
NULL,
(GAsyncReadyCallback)mbim_port_open_ready,
ctx);
@@ -1698,14 +1698,14 @@ static void
sms_notification_read_alert_sms (MMBroadbandModemMbim *self,
guint32 index)
{
MMMbimPort *port;
MMPortMbim *port;
MbimDevice *device;
MbimMessage *message;
port = mm_base_modem_peek_port_mbim (MM_BASE_MODEM (self));
if (!port)
return;
device = mm_mbim_port_peek_device (port);
device = mm_port_mbim_peek_device (port);
if (!device)
return;
@@ -2669,7 +2669,7 @@ mm_broadband_modem_mbim_init (MMBroadbandModemMbim *self)
static void
finalize (GObject *object)
{
MMMbimPort *mbim;
MMPortMbim *mbim;
MMBroadbandModemMbim *self = MM_BROADBAND_MODEM_MBIM (object);
g_free (self->priv->caps_device_id);
@@ -2679,8 +2679,8 @@ finalize (GObject *object)
mbim = mm_base_modem_peek_port_mbim (MM_BASE_MODEM (self));
/* If we did open the MBIM port during initialization, close it now */
if (mbim && mm_mbim_port_is_open (mbim)) {
mm_mbim_port_close (mbim, NULL, NULL);
if (mbim && mm_port_mbim_is_open (mbim)) {
mm_port_mbim_close (mbim, NULL, NULL);
}
G_OBJECT_CLASS (mm_broadband_modem_mbim_parent_class)->finalize (object);
+24 -24
View File
@@ -19,12 +19,12 @@
#include <ModemManager.h>
#include <mm-errors-types.h>
#include "mm-mbim-port.h"
#include "mm-port-mbim.h"
#include "mm-log.h"
G_DEFINE_TYPE (MMMbimPort, mm_mbim_port, MM_TYPE_PORT)
G_DEFINE_TYPE (MMPortMbim, mm_port_mbim, MM_TYPE_PORT)
struct _MMMbimPortPrivate {
struct _MMPortMbimPrivate {
gboolean in_progress;
MbimDevice *mbim_device;
};
@@ -32,7 +32,7 @@ struct _MMMbimPortPrivate {
/*****************************************************************************/
typedef struct {
MMMbimPort *self;
MMPortMbim *self;
GSimpleAsyncResult *result;
GCancellable *cancellable;
} PortContext;
@@ -49,7 +49,7 @@ port_context_complete_and_free (PortContext *ctx)
}
static PortContext *
port_context_new (MMMbimPort *self,
port_context_new (MMPortMbim *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -69,7 +69,7 @@ port_context_new (MMMbimPort *self,
/*****************************************************************************/
gboolean
mm_mbim_port_open_finish (MMMbimPort *self,
mm_port_mbim_open_finish (MMPortMbim *self,
GAsyncResult *res,
GError **error)
{
@@ -118,7 +118,7 @@ mbim_device_new_ready (GObject *unused,
}
void
mm_mbim_port_open (MMMbimPort *self,
mm_port_mbim_open (MMPortMbim *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -127,7 +127,7 @@ mm_mbim_port_open (MMMbimPort *self,
gchar *fullpath;
PortContext *ctx;
g_return_if_fail (MM_IS_MBIM_PORT (self));
g_return_if_fail (MM_IS_PORT_MBIM (self));
ctx = port_context_new (self, cancellable, callback, user_data);
@@ -162,9 +162,9 @@ mm_mbim_port_open (MMMbimPort *self,
/*****************************************************************************/
gboolean
mm_mbim_port_is_open (MMMbimPort *self)
mm_port_mbim_is_open (MMPortMbim *self)
{
g_return_val_if_fail (MM_IS_MBIM_PORT (self), FALSE);
g_return_val_if_fail (MM_IS_PORT_MBIM (self), FALSE);
return !!self->priv->mbim_device;
}
@@ -172,7 +172,7 @@ mm_mbim_port_is_open (MMMbimPort *self)
/*****************************************************************************/
gboolean
mm_mbim_port_close_finish (MMMbimPort *self,
mm_port_mbim_close_finish (MMPortMbim *self,
GAsyncResult *res,
GError **error)
{
@@ -198,13 +198,13 @@ mbim_device_close_ready (MbimDevice *device,
}
void
mm_mbim_port_close (MMMbimPort *self,
mm_port_mbim_close (MMPortMbim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
PortContext *ctx;
g_return_if_fail (MM_IS_MBIM_PORT (self));
g_return_if_fail (MM_IS_PORT_MBIM (self));
ctx = port_context_new (self, NULL, callback, user_data);
@@ -235,19 +235,19 @@ mm_mbim_port_close (MMMbimPort *self,
/*****************************************************************************/
MbimDevice *
mm_mbim_port_peek_device (MMMbimPort *self)
mm_port_mbim_peek_device (MMPortMbim *self)
{
g_return_val_if_fail (MM_IS_MBIM_PORT (self), NULL);
g_return_val_if_fail (MM_IS_PORT_MBIM (self), NULL);
return self->priv->mbim_device;
}
/*****************************************************************************/
MMMbimPort *
mm_mbim_port_new (const gchar *name)
MMPortMbim *
mm_port_mbim_new (const gchar *name)
{
return MM_MBIM_PORT (g_object_new (MM_TYPE_MBIM_PORT,
return MM_PORT_MBIM (g_object_new (MM_TYPE_PORT_MBIM,
MM_PORT_DEVICE, name,
MM_PORT_SUBSYS, MM_PORT_SUBSYS_USB,
MM_PORT_TYPE, MM_PORT_TYPE_MBIM,
@@ -255,28 +255,28 @@ mm_mbim_port_new (const gchar *name)
}
static void
mm_mbim_port_init (MMMbimPort *self)
mm_port_mbim_init (MMPortMbim *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_MBIM_PORT, MMMbimPortPrivate);
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_PORT_MBIM, MMPortMbimPrivate);
}
static void
dispose (GObject *object)
{
MMMbimPort *self = MM_MBIM_PORT (object);
MMPortMbim *self = MM_PORT_MBIM (object);
/* Clear device object */
g_clear_object (&self->priv->mbim_device);
G_OBJECT_CLASS (mm_mbim_port_parent_class)->dispose (object);
G_OBJECT_CLASS (mm_port_mbim_parent_class)->dispose (object);
}
static void
mm_mbim_port_class_init (MMMbimPortClass *klass)
mm_port_mbim_class_init (MMPortMbimClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMMbimPortPrivate));
g_type_class_add_private (object_class, sizeof (MMPortMbimPrivate));
/* Virtual methods */
object_class->dispose = dispose;
+23 -23
View File
@@ -13,8 +13,8 @@
* Copyright (C) 2013 Aleksander Morgado <aleksander@gnu.org>
*/
#ifndef MM_MBIM_PORT_H
#define MM_MBIM_PORT_H
#ifndef MM_PORT_MBIM_H
#define MM_PORT_MBIM_H
#include <glib.h>
#include <glib-object.h>
@@ -24,45 +24,45 @@
#include "mm-port.h"
#define MM_TYPE_MBIM_PORT (mm_mbim_port_get_type ())
#define MM_MBIM_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MBIM_PORT, MMMbimPort))
#define MM_MBIM_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MBIM_PORT, MMMbimPortClass))
#define MM_IS_MBIM_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MBIM_PORT))
#define MM_IS_MBIM_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_MBIM_PORT))
#define MM_MBIM_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MBIM_PORT, MMMbimPortClass))
#define MM_TYPE_PORT_MBIM (mm_port_mbim_get_type ())
#define MM_PORT_MBIM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PORT_MBIM, MMPortMbim))
#define MM_PORT_MBIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PORT_MBIM, MMPortMbimClass))
#define MM_IS_PORT_MBIM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PORT_MBIM))
#define MM_IS_PORT_MBIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PORT_MBIM))
#define MM_PORT_MBIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PORT_MBIM, MMPortMbimClass))
typedef struct _MMMbimPort MMMbimPort;
typedef struct _MMMbimPortClass MMMbimPortClass;
typedef struct _MMMbimPortPrivate MMMbimPortPrivate;
typedef struct _MMPortMbim MMPortMbim;
typedef struct _MMPortMbimClass MMPortMbimClass;
typedef struct _MMPortMbimPrivate MMPortMbimPrivate;
struct _MMMbimPort {
struct _MMPortMbim {
MMPort parent;
MMMbimPortPrivate *priv;
MMPortMbimPrivate *priv;
};
struct _MMMbimPortClass {
struct _MMPortMbimClass {
MMPortClass parent;
};
GType mm_mbim_port_get_type (void);
GType mm_port_mbim_get_type (void);
MMMbimPort *mm_mbim_port_new (const gchar *name);
MMPortMbim *mm_port_mbim_new (const gchar *name);
void mm_mbim_port_open (MMMbimPort *self,
void mm_port_mbim_open (MMPortMbim *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_mbim_port_open_finish (MMMbimPort *self,
gboolean mm_port_mbim_open_finish (MMPortMbim *self,
GAsyncResult *res,
GError **error);
gboolean mm_mbim_port_is_open (MMMbimPort *self);
void mm_mbim_port_close (MMMbimPort *self,
gboolean mm_port_mbim_is_open (MMPortMbim *self);
void mm_port_mbim_close (MMPortMbim *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_mbim_port_close_finish (MMMbimPort *self,
gboolean mm_port_mbim_close_finish (MMPortMbim *self,
GAsyncResult *res,
GError **error);
MbimDevice *mm_mbim_port_peek_device (MMMbimPort *self);
MbimDevice *mm_port_mbim_peek_device (MMPortMbim *self);
#endif /* MM_MBIM_PORT_H */
#endif /* MM_PORT_MBIM_H */
+10 -10
View File
@@ -41,7 +41,7 @@
#endif
#if defined WITH_MBIM
#include "mm-mbim-port.h"
#include "mm-port-mbim.h"
#endif
/*
@@ -114,7 +114,7 @@ typedef struct {
#if defined WITH_MBIM
/* ---- MBIM probing specific context ---- */
MMMbimPort *mbim_port;
MMPortMbim *mbim_port;
#endif
} PortProbeRunTask;
@@ -348,7 +348,7 @@ port_probe_run_task_free (PortProbeRunTask *task)
#if defined WITH_MBIM
if (task->mbim_port) {
/* We should have closed it cleanly before */
g_assert (!mm_mbim_port_is_open (task->mbim_port));
g_assert (!mm_port_mbim_is_open (task->mbim_port));
g_object_unref (task->mbim_port);
}
#endif
@@ -471,20 +471,20 @@ wdm_probe_qmi (MMPortProbe *self)
#if defined WITH_MBIM
static void
mbim_port_close_ready (MMMbimPort *mbim_port,
mbim_port_close_ready (MMPortMbim *mbim_port,
GAsyncResult *res,
MMPortProbe *self)
{
PortProbeRunTask *task = self->priv->task;
mm_mbim_port_close_finish (mbim_port, res, NULL);
mm_port_mbim_close_finish (mbim_port, res, NULL);
/* Keep on */
task->source_id = g_idle_add ((GSourceFunc)wdm_probe, self);
}
static void
mbim_port_open_ready (MMMbimPort *mbim_port,
mbim_port_open_ready (MMPortMbim *mbim_port,
GAsyncResult *res,
MMPortProbe *self)
{
@@ -492,7 +492,7 @@ mbim_port_open_ready (MMMbimPort *mbim_port,
GError *error = NULL;
gboolean is_mbim;
is_mbim = mm_mbim_port_open_finish (mbim_port, res, &error);
is_mbim = mm_port_mbim_open_finish (mbim_port, res, &error);
if (!is_mbim) {
mm_dbg ("(%s/%s) error checking MBIM support: '%s'",
g_udev_device_get_subsystem (self->priv->port),
@@ -504,7 +504,7 @@ mbim_port_open_ready (MMMbimPort *mbim_port,
/* Set probing result */
mm_port_probe_set_result_mbim (self, is_mbim);
mm_mbim_port_close (task->mbim_port,
mm_port_mbim_close (task->mbim_port,
(GAsyncReadyCallback)mbim_port_close_ready,
self);
}
@@ -517,8 +517,8 @@ mbim_sleep_ready (MMPortProbe *self)
task->source_id = 0;
/* Create a port and try to open it */
task->mbim_port = mm_mbim_port_new (g_udev_device_get_name (self->priv->port));
mm_mbim_port_open (task->mbim_port,
task->mbim_port = mm_port_mbim_new (g_udev_device_get_name (self->priv->port));
mm_port_mbim_open (task->mbim_port,
NULL,
(GAsyncReadyCallback)mbim_port_open_ready,
self);
+2 -2
View File
@@ -39,7 +39,7 @@ peek_device (gpointer self,
gpointer user_data)
{
MMBaseModem *modem = NULL;
MMMbimPort *port;
MMPortMbim *port;
g_object_get (G_OBJECT (self),
MM_SIM_MODEM, &modem,
@@ -59,7 +59,7 @@ peek_device (gpointer self,
return FALSE;
}
*o_device = mm_mbim_port_peek_device (port);
*o_device = mm_port_mbim_peek_device (port);
return TRUE;
}
+2 -2
View File
@@ -49,7 +49,7 @@ peek_device (gpointer self,
g_assert (MM_IS_BASE_MODEM (modem));
if (o_device) {
MMMbimPort *port;
MMPortMbim *port;
port = mm_base_modem_peek_port_mbim (modem);
if (!port) {
@@ -63,7 +63,7 @@ peek_device (gpointer self,
return FALSE;
}
*o_device = mm_mbim_port_peek_device (port);
*o_device = mm_port_mbim_peek_device (port);
}
g_object_unref (modem);