zte: use common unsolicited messages handler setup in Icera based modems
This commit is contained in:
@@ -25,12 +25,49 @@
|
|||||||
|
|
||||||
#include "ModemManager.h"
|
#include "ModemManager.h"
|
||||||
#include "mm-base-modem-at.h"
|
#include "mm-base-modem-at.h"
|
||||||
|
#include "mm-common-zte.h"
|
||||||
#include "mm-broadband-modem-zte-icera.h"
|
#include "mm-broadband-modem-zte-icera.h"
|
||||||
#include "mm-modem-helpers.h"
|
#include "mm-modem-helpers.h"
|
||||||
#include "mm-log.h"
|
#include "mm-log.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (MMBroadbandModemZteIcera, mm_broadband_modem_zte_icera, MM_TYPE_BROADBAND_MODEM_ICERA);
|
G_DEFINE_TYPE (MMBroadbandModemZteIcera, mm_broadband_modem_zte_icera, MM_TYPE_BROADBAND_MODEM_ICERA);
|
||||||
|
|
||||||
|
struct _MMBroadbandModemZteIceraPrivate {
|
||||||
|
/* Unsolicited messaging setup */
|
||||||
|
MMCommonZteUnsolicitedSetup *unsolicited_setup;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Setup ports (Broadband modem class) */
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_ports (MMBroadbandModem *self)
|
||||||
|
{
|
||||||
|
MMAtSerialPort *ports[2];
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
/* Call parent's setup ports first always */
|
||||||
|
MM_BROADBAND_MODEM_CLASS (mm_broadband_modem_zte_icera_parent_class)->setup_ports (self);
|
||||||
|
|
||||||
|
ports[0] = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
|
||||||
|
ports[1] = mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self));
|
||||||
|
|
||||||
|
/* Configure AT ports */
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
if (!ports[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_object_set (ports[i],
|
||||||
|
MM_PORT_CARRIER_DETECT, FALSE,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now reset the unsolicited messages we'll handle when enabled */
|
||||||
|
mm_common_zte_set_unsolicited_events_handlers (MM_BROADBAND_MODEM (self),
|
||||||
|
MM_BROADBAND_MODEM_ZTE_ICERA (self)->priv->unsolicited_setup,
|
||||||
|
FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
MMBroadbandModemZteIcera *
|
MMBroadbandModemZteIcera *
|
||||||
@@ -52,9 +89,31 @@ mm_broadband_modem_zte_icera_new (const gchar *device,
|
|||||||
static void
|
static void
|
||||||
mm_broadband_modem_zte_icera_init (MMBroadbandModemZteIcera *self)
|
mm_broadband_modem_zte_icera_init (MMBroadbandModemZteIcera *self)
|
||||||
{
|
{
|
||||||
|
/* Initialize private data */
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
|
||||||
|
MM_TYPE_BROADBAND_MODEM_ZTE_ICERA,
|
||||||
|
MMBroadbandModemZteIceraPrivate);
|
||||||
|
self->priv->unsolicited_setup = mm_common_zte_unsolicited_setup_new ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
finalize (GObject *object)
|
||||||
|
{
|
||||||
|
MMBroadbandModemZteIcera *self = MM_BROADBAND_MODEM_ZTE_ICERA (object);
|
||||||
|
|
||||||
|
mm_common_zte_unsolicited_setup_free (self->priv->unsolicited_setup);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (mm_broadband_modem_zte_icera_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mm_broadband_modem_zte_icera_class_init (MMBroadbandModemZteIceraClass *klass)
|
mm_broadband_modem_zte_icera_class_init (MMBroadbandModemZteIceraClass *klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
MMBroadbandModemClass *broadband_modem_class = MM_BROADBAND_MODEM_CLASS (klass);
|
||||||
|
|
||||||
|
g_type_class_add_private (object_class, sizeof (MMBroadbandModemZteIceraPrivate));
|
||||||
|
|
||||||
|
object_class->finalize = finalize;
|
||||||
|
broadband_modem_class->setup_ports = setup_ports;
|
||||||
}
|
}
|
||||||
|
@@ -29,9 +29,11 @@
|
|||||||
|
|
||||||
typedef struct _MMBroadbandModemZteIcera MMBroadbandModemZteIcera;
|
typedef struct _MMBroadbandModemZteIcera MMBroadbandModemZteIcera;
|
||||||
typedef struct _MMBroadbandModemZteIceraClass MMBroadbandModemZteIceraClass;
|
typedef struct _MMBroadbandModemZteIceraClass MMBroadbandModemZteIceraClass;
|
||||||
|
typedef struct _MMBroadbandModemZteIceraPrivate MMBroadbandModemZteIceraPrivate;
|
||||||
|
|
||||||
struct _MMBroadbandModemZteIcera {
|
struct _MMBroadbandModemZteIcera {
|
||||||
MMBroadbandModemIcera parent;
|
MMBroadbandModemIcera parent;
|
||||||
|
MMBroadbandModemZteIceraPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MMBroadbandModemZteIceraClass{
|
struct _MMBroadbandModemZteIceraClass{
|
||||||
|
Reference in New Issue
Block a user