icera: move Icera utils into standalone utility library
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
|
||||
##########################
|
||||
# Icera-specific support #
|
||||
##########################
|
||||
|
||||
noinst_LTLIBRARIES = libicera-utils.la
|
||||
|
||||
libicera_utils_la_SOURCES = \
|
||||
mm-icera-utils.c \
|
||||
mm-icera-utils.h
|
||||
|
||||
libicera_utils_la_CPPFLAGS = \
|
||||
$(MM_CFLAGS) \
|
||||
$(GUDEV_CFLAGS) \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
libicera_utils_la_LIBADD = \
|
||||
$(GUDEV_LDFLAGS)
|
||||
|
||||
########################################
|
||||
|
||||
pkglib_LTLIBRARIES = \
|
||||
libmm-plugin-generic.la \
|
||||
libmm-plugin-moto-c.la \
|
||||
@@ -220,6 +241,7 @@ libmm_plugin_zte_la_CPPFLAGS = \
|
||||
|
||||
libmm_plugin_zte_la_LDFLAGS = \
|
||||
$(GUDEV_LDFLAGS) \
|
||||
$(builddir)/libicera-utils.la \
|
||||
-module \
|
||||
-avoid-version
|
||||
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
* Generic utilities for Icera-based modems
|
||||
******************************************/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mm-icera-utils.h"
|
||||
|
||||
#include "mm-errors.h"
|
||||
#include "mm-callback-info.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-generic-gsm.h"
|
||||
@@ -68,10 +76,10 @@ icera_get_allowed_mode_done (MMAtSerialPort *port,
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
icera_get_allowed_mode (MMGenericGsm *gsm,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
void
|
||||
mm_icera_utils_get_allowed_mode (MMGenericGsm *gsm,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
MMAtSerialPort *port;
|
||||
@@ -100,11 +108,11 @@ icera_set_allowed_mode_done (MMAtSerialPort *port,
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
icera_set_allowed_mode (MMGenericGsm *gsm,
|
||||
MMModemGsmAllowedMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
void
|
||||
mm_icera_utils_set_allowed_mode (MMGenericGsm *gsm,
|
||||
MMModemGsmAllowedMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
MMAtSerialPort *port;
|
||||
@@ -191,8 +199,9 @@ icera_nwstate_changed (MMAtSerialPort *port,
|
||||
mm_generic_gsm_update_access_technology (MM_GENERIC_GSM (user_data), act);
|
||||
}
|
||||
|
||||
static void
|
||||
icera_register_unsolicted_handlers (MMGenericGsm *modem, MMAtSerialPort *port)
|
||||
void
|
||||
mm_icera_utils_register_unsolicted_handlers (MMGenericGsm *modem,
|
||||
MMAtSerialPort *port)
|
||||
{
|
||||
GRegex *regex;
|
||||
|
||||
@@ -202,8 +211,8 @@ icera_register_unsolicted_handlers (MMGenericGsm *modem, MMAtSerialPort *port)
|
||||
g_regex_unref (regex);
|
||||
}
|
||||
|
||||
static void
|
||||
icera_change_unsolicited_messages (MMGenericGsm *modem, gboolean enabled)
|
||||
void
|
||||
mm_icera_utils_change_unsolicited_messages (MMGenericGsm *modem, gboolean enabled)
|
||||
{
|
||||
MMAtSerialPort *primary;
|
||||
|
||||
@@ -235,10 +244,10 @@ get_nwstate_done (MMAtSerialPort *port,
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
icera_get_access_technology (MMGenericGsm *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
void
|
||||
mm_icera_utils_get_access_technology (MMGenericGsm *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMAtSerialPort *port;
|
||||
MMCallbackInfo *info;
|
||||
@@ -0,0 +1,45 @@
|
||||
/* -*- 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) 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/******************************************
|
||||
* Generic utilities for Icera-based modems
|
||||
******************************************/
|
||||
|
||||
#ifndef MM_ICERA_UTILS_H
|
||||
#define MM_ICERA_UTILS_H
|
||||
|
||||
#include "mm-generic-gsm.h"
|
||||
|
||||
void mm_icera_utils_get_allowed_mode (MMGenericGsm *gsm,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_icera_utils_set_allowed_mode (MMGenericGsm *gsm,
|
||||
MMModemGsmAllowedMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_icera_utils_register_unsolicted_handlers (MMGenericGsm *modem,
|
||||
MMAtSerialPort *port);
|
||||
|
||||
void mm_icera_utils_change_unsolicited_messages (MMGenericGsm *modem,
|
||||
gboolean enabled);
|
||||
|
||||
void mm_icera_utils_get_access_technology (MMGenericGsm *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* MM_ICERA_UTILS_H */
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "mm-errors.h"
|
||||
#include "mm-callback-info.h"
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-icera-utils.h"
|
||||
|
||||
static void modem_init (MMModem *modem_class);
|
||||
|
||||
@@ -59,8 +60,6 @@ mm_modem_zte_new (const char *device,
|
||||
NULL));
|
||||
}
|
||||
|
||||
#include "mm-modem-icera-utils.c"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -157,7 +156,7 @@ get_allowed_mode (MMGenericGsm *gsm,
|
||||
MMAtSerialPort *port;
|
||||
|
||||
if (MM_MODEM_ZTE_GET_PRIVATE (self)->is_icera) {
|
||||
icera_get_allowed_mode (gsm, callback, user_data);
|
||||
mm_icera_utils_get_allowed_mode (gsm, callback, user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,7 +198,7 @@ set_allowed_mode (MMGenericGsm *gsm,
|
||||
int cm_mode = 0, pref_acq = 0;
|
||||
|
||||
if (MM_MODEM_ZTE_GET_PRIVATE (self)->is_icera) {
|
||||
icera_set_allowed_mode (gsm, mode, callback, user_data);
|
||||
mm_icera_utils_set_allowed_mode (gsm, mode, callback, user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -272,7 +271,7 @@ get_access_technology (MMGenericGsm *gsm,
|
||||
MMCallbackInfo *info;
|
||||
|
||||
if (MM_MODEM_ZTE_GET_PRIVATE (self)->is_icera) {
|
||||
icera_get_access_technology (gsm, callback, user_data);
|
||||
mm_icera_utils_get_access_technology (gsm, callback, user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -337,7 +336,7 @@ cpms_try_done (MMAtSerialPort *port,
|
||||
|
||||
/* Turn on unsolicited network state messages */
|
||||
if (priv->is_icera)
|
||||
icera_change_unsolicited_messages (MM_GENERIC_GSM (info->modem), TRUE);
|
||||
mm_icera_utils_change_unsolicited_messages (MM_GENERIC_GSM (info->modem), TRUE);
|
||||
|
||||
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||
}
|
||||
@@ -470,7 +469,7 @@ disable (MMModem *modem,
|
||||
|
||||
/* Turn off unsolicited responses */
|
||||
if (priv->is_icera)
|
||||
icera_change_unsolicited_messages (MM_GENERIC_GSM (modem), FALSE);
|
||||
mm_icera_utils_change_unsolicited_messages (MM_GENERIC_GSM (modem), FALSE);
|
||||
|
||||
/* Random command to ensure unsolicited message disable completes */
|
||||
mm_at_serial_port_queue_command (primary, "E0", 5, disable_unsolicited_done, info);
|
||||
@@ -527,7 +526,7 @@ grab_port (MMModem *modem,
|
||||
g_regex_unref (regex);
|
||||
|
||||
/* Add Icera-specific handlers */
|
||||
icera_register_unsolicted_handlers (gsm, MM_AT_SERIAL_PORT (port));
|
||||
mm_icera_utils_register_unsolicted_handlers (gsm, MM_AT_SERIAL_PORT (port));
|
||||
}
|
||||
|
||||
return !!port;
|
||||
|
||||
Reference in New Issue
Block a user