icera: new `MMBroadbandBearerIcera'
This commit is contained in:
@@ -26,7 +26,9 @@ udevrules_DATA =
|
|||||||
noinst_LTLIBRARIES = libmm-utils-icera.la
|
noinst_LTLIBRARIES = libmm-utils-icera.la
|
||||||
libmm_utils_icera_la_SOURCES = \
|
libmm_utils_icera_la_SOURCES = \
|
||||||
icera/mm-iface-icera.h \
|
icera/mm-iface-icera.h \
|
||||||
icera/mm-iface-icera.c
|
icera/mm-iface-icera.c \
|
||||||
|
icera/mm-broadband-bearer-icera.h \
|
||||||
|
icera/mm-broadband-bearer-icera.c
|
||||||
libmm_utils_icera_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
libmm_utils_icera_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||||
libmm_utils_icera_la_LIBADD = $(GUDEV_LDFLAGS)
|
libmm_utils_icera_la_LIBADD = $(GUDEV_LDFLAGS)
|
||||||
|
|
||||||
|
84
plugins/icera/mm-broadband-bearer-icera.c
Normal file
84
plugins/icera/mm-broadband-bearer-icera.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/* -*- 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Google, Inc.
|
||||||
|
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <ModemManager.h>
|
||||||
|
#include <libmm-common.h>
|
||||||
|
|
||||||
|
#include "mm-broadband-bearer-icera.h"
|
||||||
|
#include "mm-base-modem-at.h"
|
||||||
|
#include "mm-log.h"
|
||||||
|
#include "mm-modem-helpers.h"
|
||||||
|
#include "mm-utils.h"
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MMBroadbandBearerIcera, mm_broadband_bearer_icera, MM_TYPE_BROADBAND_BEARER);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
MMBearer *
|
||||||
|
mm_broadband_bearer_icera_new_finish (GAsyncResult *res,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
GObject *source;
|
||||||
|
GObject *bearer;
|
||||||
|
|
||||||
|
source = g_async_result_get_source_object (res);
|
||||||
|
bearer = g_async_initable_new_finish (G_ASYNC_INITABLE (source), res, error);
|
||||||
|
g_object_unref (source);
|
||||||
|
|
||||||
|
if (!bearer)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Only export valid bearers */
|
||||||
|
mm_bearer_export (MM_BEARER (bearer));
|
||||||
|
|
||||||
|
return MM_BEARER (bearer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mm_broadband_bearer_icera_new (MMBroadbandModem *modem,
|
||||||
|
MMBearerProperties *config,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
g_async_initable_new_async (
|
||||||
|
MM_TYPE_BROADBAND_BEARER_ICERA,
|
||||||
|
G_PRIORITY_DEFAULT,
|
||||||
|
cancellable,
|
||||||
|
callback,
|
||||||
|
user_data,
|
||||||
|
MM_BEARER_MODEM, modem,
|
||||||
|
MM_BEARER_CONFIG, config,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mm_broadband_bearer_icera_init (MMBroadbandBearerIcera *self)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mm_broadband_bearer_icera_class_init (MMBroadbandBearerIceraClass *klass)
|
||||||
|
{
|
||||||
|
}
|
60
plugins/icera/mm-broadband-bearer-icera.h
Normal file
60
plugins/icera/mm-broadband-bearer-icera.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/* -*- 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details:
|
||||||
|
*
|
||||||
|
* Author: Nathan Williams <njw@google.com>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Google, Inc.
|
||||||
|
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MM_BROADBAND_BEARER_ICERA_H
|
||||||
|
#define MM_BROADBAND_BEARER_ICERA_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include <libmm-common.h>
|
||||||
|
|
||||||
|
#include "mm-broadband-bearer.h"
|
||||||
|
|
||||||
|
#define MM_TYPE_BROADBAND_BEARER_ICERA (mm_broadband_bearer_icera_get_type ())
|
||||||
|
#define MM_BROADBAND_BEARER_ICERA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_BEARER_ICERA, MMBroadbandBearerIcera))
|
||||||
|
#define MM_BROADBAND_BEARER_ICERA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_BEARER_ICERA, MMBroadbandBearerIceraClass))
|
||||||
|
#define MM_IS_BROADBAND_BEARER_ICERA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_BEARER_ICERA))
|
||||||
|
#define MM_IS_BROADBAND_BEARER_ICERA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_BEARER_ICERA))
|
||||||
|
#define MM_BROADBAND_BEARER_ICERA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_BEARER_ICERA, MMBroadbandBearerIceraClass))
|
||||||
|
|
||||||
|
typedef struct _MMBroadbandBearerIcera MMBroadbandBearerIcera;
|
||||||
|
typedef struct _MMBroadbandBearerIceraClass MMBroadbandBearerIceraClass;
|
||||||
|
typedef struct _MMBroadbandBearerIceraPrivate MMBroadbandBearerIceraPrivate;
|
||||||
|
|
||||||
|
struct _MMBroadbandBearerIcera {
|
||||||
|
MMBroadbandBearer parent;
|
||||||
|
MMBroadbandBearerIceraPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MMBroadbandBearerIceraClass {
|
||||||
|
MMBroadbandBearerClass parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType mm_broadband_bearer_icera_get_type (void);
|
||||||
|
|
||||||
|
/* Default bearer creation implementation */
|
||||||
|
void mm_broadband_bearer_icera_new (MMBroadbandModem *modem,
|
||||||
|
MMBearerProperties *config,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
MMBearer *mm_broadband_bearer_icera_new_finish (GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
#endif /* MM_BROADBAND_BEARER_ICERA_H */
|
@@ -26,6 +26,7 @@
|
|||||||
#include "mm-log.h"
|
#include "mm-log.h"
|
||||||
#include "mm-modem-helpers.h"
|
#include "mm-modem-helpers.h"
|
||||||
#include "mm-iface-icera.h"
|
#include "mm-iface-icera.h"
|
||||||
|
#include "mm-broadband-bearer-icera.h"
|
||||||
#include "mm-base-modem-at.h"
|
#include "mm-base-modem-at.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -491,6 +492,62 @@ mm_iface_icera_modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
user_data);
|
user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Create bearer (Modem interface) */
|
||||||
|
|
||||||
|
MMBearer *
|
||||||
|
mm_iface_icera_modem_create_bearer_finish (MMIfaceModem *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return MM_BEARER (g_object_ref (
|
||||||
|
g_simple_async_result_get_op_res_gpointer (
|
||||||
|
G_SIMPLE_ASYNC_RESULT (res))));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
broadband_bearer_icera_new_ready (GObject *source,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GSimpleAsyncResult *simple)
|
||||||
|
{
|
||||||
|
MMBearer *bearer = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
bearer = mm_broadband_bearer_icera_new_finish (res, &error);
|
||||||
|
if (!bearer)
|
||||||
|
g_simple_async_result_take_error (simple, error);
|
||||||
|
else
|
||||||
|
g_simple_async_result_set_op_res_gpointer (simple,
|
||||||
|
bearer,
|
||||||
|
(GDestroyNotify)g_object_unref);
|
||||||
|
g_simple_async_result_complete (simple);
|
||||||
|
g_object_unref (simple);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mm_iface_icera_modem_create_bearer (MMIfaceModem *self,
|
||||||
|
MMBearerProperties *properties,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GSimpleAsyncResult *result;
|
||||||
|
|
||||||
|
/* Set a new ref to the bearer object as result */
|
||||||
|
result = g_simple_async_result_new (G_OBJECT (self),
|
||||||
|
callback,
|
||||||
|
user_data,
|
||||||
|
mm_iface_icera_modem_create_bearer);
|
||||||
|
|
||||||
|
mm_broadband_bearer_icera_new (MM_BROADBAND_MODEM (self),
|
||||||
|
properties,
|
||||||
|
NULL, /* cancellable */
|
||||||
|
(GAsyncReadyCallback)broadband_bearer_icera_new_ready,
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -67,6 +67,14 @@ gboolean mm_iface_icera_modem_load_access_technologies_finish (MMIfaceModem *sel
|
|||||||
guint *mask,
|
guint *mask,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
void mm_iface_icera_modem_create_bearer (MMIfaceModem *self,
|
||||||
|
MMBearerProperties *properties,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
MMBearer *mm_iface_icera_modem_create_bearer_finish (MMIfaceModem *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Modem 3GPP interface specific implementations */
|
/* Modem 3GPP interface specific implementations */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user