ports: rename 'MMAtSerialPort' to 'MMPortSerialAt'
This commit is contained in:
+4
-4
@@ -55,11 +55,11 @@ endif
|
||||
# libserial specific enum types
|
||||
SERIAL_ENUMS = \
|
||||
$(srcdir)/mm-port.h \
|
||||
$(srcdir)/mm-at-serial-port.h
|
||||
$(srcdir)/mm-port-serial-at.h
|
||||
|
||||
mm-serial-enums-types.h: Makefile.am $(SERIAL_ENUMS) $(top_srcdir)/build-aux/mm-enums-template.h
|
||||
$(AM_V_GEN) $(GLIB_MKENUMS) \
|
||||
--fhead "#include \"mm-port.h\"\n#include \"mm-at-serial-port.h\"\n#ifndef __MM_SERIAL_ENUMS_TYPES_H__\n#define __MM_SERIAL_ENUMS_TYPES_H__\n" \
|
||||
--fhead "#include \"mm-port.h\"\n#include \"mm-port-serial-at.h\"\n#ifndef __MM_SERIAL_ENUMS_TYPES_H__\n#define __MM_SERIAL_ENUMS_TYPES_H__\n" \
|
||||
--template $(top_srcdir)/build-aux/mm-enums-template.h \
|
||||
--ftail "#endif /* __MM_SERIAL_ENUMS_TYPES_H__ */\n" \
|
||||
$(SERIAL_ENUMS) > $@
|
||||
@@ -88,8 +88,8 @@ libserial_la_SOURCES = \
|
||||
mm-port.h \
|
||||
mm-port-serial.c \
|
||||
mm-port-serial.h \
|
||||
mm-at-serial-port.c \
|
||||
mm-at-serial-port.h \
|
||||
mm-port-serial-at.c \
|
||||
mm-port-serial-at.h \
|
||||
mm-port-serial-qcdm.c \
|
||||
mm-port-serial-qcdm.h \
|
||||
mm-port-serial-gps.c \
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/* -*- 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) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MM_AT_SERIAL_PORT_H
|
||||
#define MM_AT_SERIAL_PORT_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-port-serial.h"
|
||||
|
||||
#define MM_TYPE_AT_SERIAL_PORT (mm_at_serial_port_get_type ())
|
||||
#define MM_AT_SERIAL_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_AT_SERIAL_PORT, MMAtSerialPort))
|
||||
#define MM_AT_SERIAL_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_AT_SERIAL_PORT, MMAtSerialPortClass))
|
||||
#define MM_IS_AT_SERIAL_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_AT_SERIAL_PORT))
|
||||
#define MM_IS_AT_SERIAL_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_AT_SERIAL_PORT))
|
||||
#define MM_AT_SERIAL_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_AT_SERIAL_PORT, MMAtSerialPortClass))
|
||||
|
||||
typedef struct _MMAtSerialPort MMAtSerialPort;
|
||||
typedef struct _MMAtSerialPortClass MMAtSerialPortClass;
|
||||
|
||||
/* AT port flags; for example consider a device with two AT ports (ACM0 and ACM1)
|
||||
* which could have the following layouts:
|
||||
*
|
||||
* ACM0(PRIMARY | PPP), ACM1(SECONDARY): port 0 is used for command and status
|
||||
* and for PPP data; while connected port 1 is used for command and status
|
||||
* ACM0(PPP), ACM1(PRIMARY): port 1 is always used for command and status, and
|
||||
* only when connecting is port 0 opened for dialing (ATD) and PPP
|
||||
*/
|
||||
typedef enum { /*< underscore_name=mm_at_port_flag >*/
|
||||
MM_AT_PORT_FLAG_NONE = 0,
|
||||
/* This port is preferred for command and status */
|
||||
MM_AT_PORT_FLAG_PRIMARY = 1 << 0,
|
||||
/* Use port for command and status if the primary port is connected */
|
||||
MM_AT_PORT_FLAG_SECONDARY = 1 << 1,
|
||||
/* This port should be used for PPP */
|
||||
MM_AT_PORT_FLAG_PPP = 1 << 2,
|
||||
/* This port should be used for GPS control */
|
||||
MM_AT_PORT_FLAG_GPS_CONTROL = 1 << 3,
|
||||
} MMAtPortFlag;
|
||||
|
||||
typedef gboolean (*MMAtSerialResponseParserFn) (gpointer user_data,
|
||||
GString *response,
|
||||
GError **error);
|
||||
|
||||
typedef void (*MMAtSerialUnsolicitedMsgFn) (MMAtSerialPort *port,
|
||||
GMatchInfo *match_info,
|
||||
gpointer user_data);
|
||||
|
||||
typedef void (*MMAtSerialResponseFn) (MMAtSerialPort *port,
|
||||
GString *response,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
#define MM_AT_SERIAL_PORT_REMOVE_ECHO "remove-echo"
|
||||
#define MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED "init-sequence-enabled"
|
||||
#define MM_AT_SERIAL_PORT_INIT_SEQUENCE "init-sequence"
|
||||
|
||||
#define MM_AT_SERIAL_PORT_SEND_LF "send-lf"
|
||||
|
||||
struct _MMAtSerialPort {
|
||||
MMPortSerial parent;
|
||||
};
|
||||
|
||||
struct _MMAtSerialPortClass {
|
||||
MMPortSerialClass parent;
|
||||
};
|
||||
|
||||
GType mm_at_serial_port_get_type (void);
|
||||
|
||||
MMAtSerialPort *mm_at_serial_port_new (const char *name);
|
||||
|
||||
void mm_at_serial_port_add_unsolicited_msg_handler (MMAtSerialPort *self,
|
||||
GRegex *regex,
|
||||
MMAtSerialUnsolicitedMsgFn callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void mm_at_serial_port_enable_unsolicited_msg_handler (MMAtSerialPort *self,
|
||||
GRegex *regex,
|
||||
gboolean enable);
|
||||
|
||||
void mm_at_serial_port_set_response_parser (MMAtSerialPort *self,
|
||||
MMAtSerialResponseParserFn fn,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void mm_at_serial_port_queue_command (MMAtSerialPort *self,
|
||||
const char *command,
|
||||
guint32 timeout_seconds,
|
||||
gboolean is_raw,
|
||||
GCancellable *cancellable,
|
||||
MMAtSerialResponseFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_at_serial_port_queue_command_cached (MMAtSerialPort *self,
|
||||
const char *command,
|
||||
guint32 timeout_seconds,
|
||||
gboolean is_raw,
|
||||
GCancellable *cancellable,
|
||||
MMAtSerialResponseFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/*
|
||||
* Convert a string into a quoted and escaped string. Returns a new
|
||||
* allocated string. Follows ITU V.250 5.4.2.2 "String constants".
|
||||
*/
|
||||
gchar *mm_at_serial_port_quote_string (const char *string);
|
||||
|
||||
/* Just for unit tests */
|
||||
void mm_at_serial_port_remove_echo (GByteArray *response);
|
||||
|
||||
void mm_at_serial_port_set_flags (MMAtSerialPort *self,
|
||||
MMAtPortFlag flags);
|
||||
|
||||
MMAtPortFlag mm_at_serial_port_get_flags (MMAtSerialPort *self);
|
||||
|
||||
/* Tell the port to run its init sequence, if any, right away */
|
||||
void mm_at_serial_port_run_init_sequence (MMAtSerialPort *self);
|
||||
|
||||
#endif /* MM_AT_SERIAL_PORT_H */
|
||||
+22
-22
@@ -23,7 +23,7 @@
|
||||
|
||||
static gboolean
|
||||
abort_async_if_port_unusable (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
MMPortSerialAt *port,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -56,8 +56,8 @@ abort_async_if_port_unusable (MMBaseModem *self,
|
||||
|
||||
/* Temporarily disable init sequence if we're just sending a
|
||||
* command to a just opened port */
|
||||
g_object_get (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, &init_sequence_enabled, NULL);
|
||||
g_object_set (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, FALSE, NULL);
|
||||
g_object_get (port, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, &init_sequence_enabled, NULL);
|
||||
g_object_set (port, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, FALSE, NULL);
|
||||
|
||||
/* Ensure we have a port open during the sequence */
|
||||
if (!mm_port_serial_open (MM_PORT_SERIAL (port), &error)) {
|
||||
@@ -74,7 +74,7 @@ abort_async_if_port_unusable (MMBaseModem *self,
|
||||
}
|
||||
|
||||
/* Reset previous init sequence state */
|
||||
g_object_set (port, MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, init_sequence_enabled, NULL);
|
||||
g_object_set (port, MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, init_sequence_enabled, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ modem_cancellable_cancelled (GCancellable *modem_cancellable,
|
||||
|
||||
typedef struct {
|
||||
MMBaseModem *self;
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
GCancellable *cancellable;
|
||||
gulong cancelled_id;
|
||||
GCancellable *modem_cancellable;
|
||||
@@ -153,7 +153,7 @@ mm_base_modem_at_sequence_full_finish (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
at_sequence_parse_response (MMAtSerialPort *port,
|
||||
at_sequence_parse_response (MMPortSerialAt *port,
|
||||
GString *response,
|
||||
GError *error,
|
||||
AtSequenceContext *ctx)
|
||||
@@ -206,22 +206,22 @@ at_sequence_parse_response (MMAtSerialPort *port,
|
||||
if (ctx->current->command) {
|
||||
/* Schedule the next command in the probing group */
|
||||
if (ctx->current->allow_cached)
|
||||
mm_at_serial_port_queue_command_cached (
|
||||
mm_port_serial_at_queue_command_cached (
|
||||
ctx->port,
|
||||
ctx->current->command,
|
||||
ctx->current->timeout,
|
||||
FALSE,
|
||||
ctx->cancellable,
|
||||
(MMAtSerialResponseFn)at_sequence_parse_response,
|
||||
(MMPortSerialAtResponseFn)at_sequence_parse_response,
|
||||
ctx);
|
||||
else
|
||||
mm_at_serial_port_queue_command (
|
||||
mm_port_serial_at_queue_command (
|
||||
ctx->port,
|
||||
ctx->current->command,
|
||||
ctx->current->timeout,
|
||||
FALSE,
|
||||
ctx->cancellable,
|
||||
(MMAtSerialResponseFn)at_sequence_parse_response,
|
||||
(MMPortSerialAtResponseFn)at_sequence_parse_response,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ at_sequence_parse_response (MMAtSerialPort *port,
|
||||
|
||||
void
|
||||
mm_base_modem_at_sequence_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
MMPortSerialAt *port,
|
||||
const MMBaseModemAtCommand *sequence,
|
||||
gpointer response_processor_context,
|
||||
GDestroyNotify response_processor_context_free,
|
||||
@@ -295,13 +295,13 @@ mm_base_modem_at_sequence_full (MMBaseModem *self,
|
||||
}
|
||||
|
||||
/* Go on with the first one in the sequence */
|
||||
mm_at_serial_port_queue_command (
|
||||
mm_port_serial_at_queue_command (
|
||||
ctx->port,
|
||||
ctx->current->command,
|
||||
ctx->current->timeout,
|
||||
FALSE,
|
||||
ctx->cancellable,
|
||||
(MMAtSerialResponseFn)at_sequence_parse_response,
|
||||
(MMPortSerialAtResponseFn)at_sequence_parse_response,
|
||||
ctx);
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ mm_base_modem_at_sequence (MMBaseModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
GError *error = NULL;
|
||||
|
||||
/* No port given, so we'll try to guess which is best */
|
||||
@@ -431,7 +431,7 @@ mm_base_modem_response_processor_continue_on_error (MMBaseModem *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseModem *self;
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
GCancellable *cancellable;
|
||||
gulong cancelled_id;
|
||||
GCancellable *modem_cancellable;
|
||||
@@ -470,7 +470,7 @@ mm_base_modem_at_command_full_finish (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
at_command_parse_response (MMAtSerialPort *port,
|
||||
at_command_parse_response (MMPortSerialAt *port,
|
||||
GString *response,
|
||||
GError *error,
|
||||
AtCommandContext *ctx)
|
||||
@@ -502,7 +502,7 @@ at_command_parse_response (MMAtSerialPort *port,
|
||||
|
||||
void
|
||||
mm_base_modem_at_command_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
MMPortSerialAt *port,
|
||||
const gchar *command,
|
||||
guint timeout,
|
||||
gboolean allow_cached,
|
||||
@@ -543,22 +543,22 @@ mm_base_modem_at_command_full (MMBaseModem *self,
|
||||
|
||||
/* Go on with the command */
|
||||
if (allow_cached)
|
||||
mm_at_serial_port_queue_command_cached (
|
||||
mm_port_serial_at_queue_command_cached (
|
||||
port,
|
||||
command,
|
||||
timeout,
|
||||
is_raw,
|
||||
ctx->cancellable,
|
||||
(MMAtSerialResponseFn)at_command_parse_response,
|
||||
(MMPortSerialAtResponseFn)at_command_parse_response,
|
||||
ctx);
|
||||
else
|
||||
mm_at_serial_port_queue_command (
|
||||
mm_port_serial_at_queue_command (
|
||||
port,
|
||||
command,
|
||||
timeout,
|
||||
is_raw,
|
||||
ctx->cancellable,
|
||||
(MMAtSerialResponseFn)at_command_parse_response,
|
||||
(MMPortSerialAtResponseFn)at_command_parse_response,
|
||||
ctx);
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ _at_command (MMBaseModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
GError *error = NULL;
|
||||
|
||||
/* No port given, so we'll try to guess which is best */
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "mm-base-modem.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
|
||||
/*
|
||||
* The expected result depends on the specific operation, so the GVariant
|
||||
@@ -79,7 +79,7 @@ GVariant *mm_base_modem_at_sequence_finish (MMBaseModem *self,
|
||||
/* Fully detailed AT sequence handling, when specific AT port and/or explicit
|
||||
* cancellations need to be used. */
|
||||
void mm_base_modem_at_sequence_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
MMPortSerialAt *port,
|
||||
const MMBaseModemAtCommand *sequence,
|
||||
gpointer response_processor_context,
|
||||
GDestroyNotify response_processor_context_free,
|
||||
@@ -152,7 +152,7 @@ const gchar *mm_base_modem_at_command_finish (MMBaseModem *self,
|
||||
/* Fully detailed AT command handling, when specific AT port and/or explicit
|
||||
* cancellations need to be used. */
|
||||
void mm_base_modem_at_command_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
MMPortSerialAt *port,
|
||||
const gchar *command,
|
||||
guint timeout,
|
||||
gboolean allow_cached,
|
||||
|
||||
+45
-45
@@ -77,14 +77,14 @@ struct _MMBaseModemPrivate {
|
||||
GCancellable *authp_cancellable;
|
||||
|
||||
GHashTable *ports;
|
||||
MMAtSerialPort *primary;
|
||||
MMAtSerialPort *secondary;
|
||||
MMPortSerialAt *primary;
|
||||
MMPortSerialAt *secondary;
|
||||
MMPortSerialQcdm *qcdm;
|
||||
GList *data;
|
||||
|
||||
/* GPS-enabled modems will have an AT port for control, and a raw serial
|
||||
* port to receive all GPS traces */
|
||||
MMAtSerialPort *gps_control;
|
||||
MMPortSerialAt *gps_control;
|
||||
MMPortSerialGps *gps;
|
||||
|
||||
#if defined WITH_QMI
|
||||
@@ -162,7 +162,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
|
||||
const gchar *subsys,
|
||||
const gchar *name,
|
||||
MMPortType ptype,
|
||||
MMAtPortFlag at_pflags,
|
||||
MMPortSerialAtFlag at_pflags,
|
||||
GError **error)
|
||||
{
|
||||
MMPort *port;
|
||||
@@ -206,15 +206,15 @@ mm_base_modem_grab_port (MMBaseModem *self,
|
||||
port = MM_PORT (mm_port_serial_qcdm_new (name));
|
||||
else if (ptype == MM_PORT_TYPE_AT) {
|
||||
/* AT port */
|
||||
port = MM_PORT (mm_at_serial_port_new (name));
|
||||
port = MM_PORT (mm_port_serial_at_new (name));
|
||||
|
||||
/* Set common response parser */
|
||||
mm_at_serial_port_set_response_parser (MM_AT_SERIAL_PORT (port),
|
||||
mm_port_serial_at_set_response_parser (MM_PORT_SERIAL_AT (port),
|
||||
mm_serial_parser_v1_parse,
|
||||
mm_serial_parser_v1_new (),
|
||||
mm_serial_parser_v1_destroy);
|
||||
/* Store flags already */
|
||||
mm_at_serial_port_set_flags (MM_AT_SERIAL_PORT (port), at_pflags);
|
||||
mm_port_serial_at_set_flags (MM_PORT_SERIAL_AT (port), at_pflags);
|
||||
} else if (ptype == MM_PORT_TYPE_GPS) {
|
||||
/* Raw GPS port */
|
||||
port = MM_PORT (mm_port_serial_gps_new (name));
|
||||
@@ -487,7 +487,7 @@ mm_base_modem_get_cancellable (MMBaseModem *self)
|
||||
return g_object_ref (self->priv->cancellable);
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_get_port_primary (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -495,7 +495,7 @@ mm_base_modem_get_port_primary (MMBaseModem *self)
|
||||
return (self->priv->primary ? g_object_ref (self->priv->primary) : NULL);
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_peek_port_primary (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -503,7 +503,7 @@ mm_base_modem_peek_port_primary (MMBaseModem *self)
|
||||
return self->priv->primary;
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_get_port_secondary (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -511,7 +511,7 @@ mm_base_modem_get_port_secondary (MMBaseModem *self)
|
||||
return (self->priv->secondary ? g_object_ref (self->priv->secondary) : NULL);
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_peek_port_secondary (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -535,7 +535,7 @@ mm_base_modem_peek_port_qcdm (MMBaseModem *self)
|
||||
return self->priv->qcdm;
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_get_port_gps_control (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -543,7 +543,7 @@ mm_base_modem_get_port_gps_control (MMBaseModem *self)
|
||||
return (self->priv->gps_control ? g_object_ref (self->priv->gps_control) : NULL);
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_peek_port_gps_control (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -919,17 +919,17 @@ mm_base_modem_peek_data_ports (MMBaseModem *self)
|
||||
return self->priv->data;
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_get_best_at_port (MMBaseModem *self,
|
||||
GError **error)
|
||||
{
|
||||
MMAtSerialPort *best;
|
||||
MMPortSerialAt *best;
|
||||
|
||||
best = mm_base_modem_peek_best_at_port (self, error);
|
||||
return (best ? g_object_ref (best) : NULL);
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
MMPortSerialAt *
|
||||
mm_base_modem_peek_best_at_port (MMBaseModem *self,
|
||||
GError **error)
|
||||
{
|
||||
@@ -962,7 +962,7 @@ mm_base_modem_has_at_port (MMBaseModem *self)
|
||||
/* We'll iterate the ht of ports, looking for any port which is AT */
|
||||
g_hash_table_iter_init (&iter, self->priv->ports);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
if (MM_IS_AT_SERIAL_PORT (value))
|
||||
if (MM_IS_PORT_SERIAL_AT (value))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1064,13 +1064,13 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
{
|
||||
GHashTableIter iter;
|
||||
MMPort *candidate;
|
||||
MMAtPortFlag flags;
|
||||
MMAtSerialPort *backup_primary = NULL;
|
||||
MMAtSerialPort *primary = NULL;
|
||||
MMAtSerialPort *secondary = NULL;
|
||||
MMAtSerialPort *backup_secondary = NULL;
|
||||
MMPortSerialAtFlag flags;
|
||||
MMPortSerialAt *backup_primary = NULL;
|
||||
MMPortSerialAt *primary = NULL;
|
||||
MMPortSerialAt *secondary = NULL;
|
||||
MMPortSerialAt *backup_secondary = NULL;
|
||||
MMPortSerialQcdm *qcdm = NULL;
|
||||
MMAtSerialPort *gps_control = NULL;
|
||||
MMPortSerialAt *gps_control = NULL;
|
||||
MMPortSerialGps *gps = NULL;
|
||||
MMPort *data_primary = NULL;
|
||||
GList *data = NULL;
|
||||
@@ -1095,22 +1095,22 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
switch (mm_port_get_port_type (candidate)) {
|
||||
|
||||
case MM_PORT_TYPE_AT:
|
||||
g_assert (MM_IS_AT_SERIAL_PORT (candidate));
|
||||
flags = mm_at_serial_port_get_flags (MM_AT_SERIAL_PORT (candidate));
|
||||
g_assert (MM_IS_PORT_SERIAL_AT (candidate));
|
||||
flags = mm_port_serial_at_get_flags (MM_PORT_SERIAL_AT (candidate));
|
||||
|
||||
if (flags & MM_AT_PORT_FLAG_PRIMARY) {
|
||||
if (flags & MM_PORT_SERIAL_AT_FLAG_PRIMARY) {
|
||||
if (!primary)
|
||||
primary = MM_AT_SERIAL_PORT (candidate);
|
||||
primary = MM_PORT_SERIAL_AT (candidate);
|
||||
else if (!backup_primary) {
|
||||
/* Just in case the plugin gave us more than one primary
|
||||
* and no secondaries, treat additional primary ports as
|
||||
* secondary.
|
||||
*/
|
||||
backup_primary = MM_AT_SERIAL_PORT (candidate);
|
||||
backup_primary = MM_PORT_SERIAL_AT (candidate);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & MM_AT_PORT_FLAG_PPP) {
|
||||
if (flags & MM_PORT_SERIAL_AT_FLAG_PPP) {
|
||||
if (!data_primary)
|
||||
data_primary = candidate;
|
||||
else
|
||||
@@ -1118,22 +1118,22 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
}
|
||||
|
||||
/* Explicitly flagged secondary ports trump NONE ports for secondary */
|
||||
if (flags & MM_AT_PORT_FLAG_SECONDARY) {
|
||||
if (!secondary || !(mm_at_serial_port_get_flags (secondary) & MM_AT_PORT_FLAG_SECONDARY))
|
||||
secondary = MM_AT_SERIAL_PORT (candidate);
|
||||
if (flags & MM_PORT_SERIAL_AT_FLAG_SECONDARY) {
|
||||
if (!secondary || !(mm_port_serial_at_get_flags (secondary) & MM_PORT_SERIAL_AT_FLAG_SECONDARY))
|
||||
secondary = MM_PORT_SERIAL_AT (candidate);
|
||||
}
|
||||
|
||||
if (flags & MM_AT_PORT_FLAG_GPS_CONTROL) {
|
||||
if (flags & MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL) {
|
||||
if (!gps_control)
|
||||
gps_control = MM_AT_SERIAL_PORT (candidate);
|
||||
gps_control = MM_PORT_SERIAL_AT (candidate);
|
||||
}
|
||||
|
||||
/* Fallback secondary */
|
||||
if (flags == MM_AT_PORT_FLAG_NONE) {
|
||||
if (flags == MM_PORT_SERIAL_AT_FLAG_NONE) {
|
||||
if (!secondary)
|
||||
secondary = MM_AT_SERIAL_PORT (candidate);
|
||||
secondary = MM_PORT_SERIAL_AT (candidate);
|
||||
else if (!backup_secondary)
|
||||
backup_secondary = MM_AT_SERIAL_PORT (candidate);
|
||||
backup_secondary = MM_PORT_SERIAL_AT (candidate);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1146,7 +1146,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
case MM_PORT_TYPE_NET:
|
||||
if (!data_primary)
|
||||
data_primary = candidate;
|
||||
else if (MM_IS_AT_SERIAL_PORT (data_primary)) {
|
||||
else if (MM_IS_PORT_SERIAL_AT (data_primary)) {
|
||||
/* Net device (if any) is the preferred data port */
|
||||
data = g_list_append (data, data_primary);
|
||||
data_primary = candidate;
|
||||
@@ -1252,17 +1252,17 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
/* Reset flags on all ports; clear data port first since it might also
|
||||
* be the primary or secondary port.
|
||||
*/
|
||||
if (MM_IS_AT_SERIAL_PORT (data_primary))
|
||||
mm_at_serial_port_set_flags (MM_AT_SERIAL_PORT (data_primary), MM_AT_PORT_FLAG_NONE);
|
||||
if (MM_IS_PORT_SERIAL_AT (data_primary))
|
||||
mm_port_serial_at_set_flags (MM_PORT_SERIAL_AT (data_primary), MM_PORT_SERIAL_AT_FLAG_NONE);
|
||||
|
||||
if (primary)
|
||||
mm_at_serial_port_set_flags (primary, MM_AT_PORT_FLAG_PRIMARY);
|
||||
mm_port_serial_at_set_flags (primary, MM_PORT_SERIAL_AT_FLAG_PRIMARY);
|
||||
if (secondary)
|
||||
mm_at_serial_port_set_flags (secondary, MM_AT_PORT_FLAG_SECONDARY);
|
||||
mm_port_serial_at_set_flags (secondary, MM_PORT_SERIAL_AT_FLAG_SECONDARY);
|
||||
|
||||
if (MM_IS_AT_SERIAL_PORT (data_primary)) {
|
||||
flags = mm_at_serial_port_get_flags (MM_AT_SERIAL_PORT (data_primary));
|
||||
mm_at_serial_port_set_flags (MM_AT_SERIAL_PORT (data_primary), flags | MM_AT_PORT_FLAG_PPP);
|
||||
if (MM_IS_PORT_SERIAL_AT (data_primary)) {
|
||||
flags = mm_port_serial_at_get_flags (MM_PORT_SERIAL_AT (data_primary));
|
||||
mm_port_serial_at_set_flags (MM_PORT_SERIAL_AT (data_primary), flags | MM_PORT_SERIAL_AT_FLAG_PPP);
|
||||
}
|
||||
|
||||
log_port (self, MM_PORT (primary), "at (primary)");
|
||||
|
||||
+10
-10
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "mm-auth.h"
|
||||
#include "mm-port.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-port-serial-qcdm.h"
|
||||
#include "mm-port-serial-gps.h"
|
||||
|
||||
@@ -107,7 +107,7 @@ gboolean mm_base_modem_grab_port (MMBaseModem *self,
|
||||
const gchar *subsys,
|
||||
const gchar *name,
|
||||
MMPortType ptype,
|
||||
MMAtPortFlag at_pflags,
|
||||
MMPortSerialAtFlag at_pflags,
|
||||
GError **error);
|
||||
void mm_base_modem_release_port (MMBaseModem *self,
|
||||
const gchar *subsys,
|
||||
@@ -124,10 +124,10 @@ gboolean mm_base_modem_has_at_port (MMBaseModem *self);
|
||||
gboolean mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
GError **error);
|
||||
|
||||
MMAtSerialPort *mm_base_modem_peek_port_primary (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_peek_port_secondary (MMBaseModem *self);
|
||||
MMPortSerialAt *mm_base_modem_peek_port_primary (MMBaseModem *self);
|
||||
MMPortSerialAt *mm_base_modem_peek_port_secondary (MMBaseModem *self);
|
||||
MMPortSerialQcdm *mm_base_modem_peek_port_qcdm (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_peek_port_gps_control (MMBaseModem *self);
|
||||
MMPortSerialAt *mm_base_modem_peek_port_gps_control (MMBaseModem *self);
|
||||
MMPortSerialGps *mm_base_modem_peek_port_gps (MMBaseModem *self);
|
||||
#if defined WITH_QMI
|
||||
MMQmiPort *mm_base_modem_peek_port_qmi (MMBaseModem *self);
|
||||
@@ -137,14 +137,14 @@ MMQmiPort *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPor
|
||||
MMMbimPort *mm_base_modem_peek_port_mbim (MMBaseModem *self);
|
||||
MMMbimPort *mm_base_modem_peek_port_mbim_for_data (MMBaseModem *self, MMPort *data, GError **error);
|
||||
#endif
|
||||
MMAtSerialPort *mm_base_modem_peek_best_at_port (MMBaseModem *self, GError **error);
|
||||
MMPortSerialAt *mm_base_modem_peek_best_at_port (MMBaseModem *self, GError **error);
|
||||
MMPort *mm_base_modem_peek_best_data_port (MMBaseModem *self, MMPortType type);
|
||||
GList *mm_base_modem_peek_data_ports (MMBaseModem *self);
|
||||
|
||||
MMAtSerialPort *mm_base_modem_get_port_primary (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_get_port_secondary (MMBaseModem *self);
|
||||
MMPortSerialAt *mm_base_modem_get_port_primary (MMBaseModem *self);
|
||||
MMPortSerialAt *mm_base_modem_get_port_secondary (MMBaseModem *self);
|
||||
MMPortSerialQcdm *mm_base_modem_get_port_qcdm (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_get_port_gps_control (MMBaseModem *self);
|
||||
MMPortSerialAt *mm_base_modem_get_port_gps_control (MMBaseModem *self);
|
||||
MMPortSerialGps *mm_base_modem_get_port_gps (MMBaseModem *self);
|
||||
#if defined WITH_QMI
|
||||
MMQmiPort *mm_base_modem_get_port_qmi (MMBaseModem *self);
|
||||
@@ -154,7 +154,7 @@ MMQmiPort *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort
|
||||
MMMbimPort *mm_base_modem_get_port_mbim (MMBaseModem *self);
|
||||
MMMbimPort *mm_base_modem_get_port_mbim_for_data (MMBaseModem *self, MMPort *data, GError **error);
|
||||
#endif
|
||||
MMAtSerialPort *mm_base_modem_get_best_at_port (MMBaseModem *self, GError **error);
|
||||
MMPortSerialAt *mm_base_modem_get_best_at_port (MMBaseModem *self, GError **error);
|
||||
MMPort *mm_base_modem_get_best_data_port (MMBaseModem *self, MMPortType type);
|
||||
GList *mm_base_modem_get_data_ports (MMBaseModem *self);
|
||||
|
||||
|
||||
+33
-33
@@ -74,8 +74,8 @@ mm_broadband_bearer_get_3gpp_cid (MMBroadbandBearer *self)
|
||||
typedef struct {
|
||||
MMBroadbandBearer *self;
|
||||
MMBaseModem *modem;
|
||||
MMAtSerialPort *primary;
|
||||
MMAtSerialPort *secondary;
|
||||
MMPortSerialAt *primary;
|
||||
MMPortSerialAt *secondary;
|
||||
GCancellable *cancellable;
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
@@ -149,8 +149,8 @@ detailed_connect_context_complete_and_free_if_cancelled (DetailedConnectContext
|
||||
static DetailedConnectContext *
|
||||
detailed_connect_context_new (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@@ -188,7 +188,7 @@ detailed_connect_context_new (MMBroadbandBearer *self,
|
||||
/*****************************************************************************/
|
||||
/* Generic implementations (both 3GPP and CDMA) are always AT-port based */
|
||||
|
||||
static MMAtSerialPort *
|
||||
static MMPortSerialAt *
|
||||
common_get_at_data_port (MMBaseModem *modem,
|
||||
GError **error)
|
||||
{
|
||||
@@ -204,7 +204,7 @@ common_get_at_data_port (MMBaseModem *modem,
|
||||
data = (MMPort *) mm_base_modem_peek_port_primary (modem);
|
||||
}
|
||||
|
||||
g_assert (MM_IS_AT_SERIAL_PORT (data));
|
||||
g_assert (MM_IS_PORT_SERIAL_AT (data));
|
||||
|
||||
if (!mm_port_serial_open (MM_PORT_SERIAL (data), error)) {
|
||||
g_prefix_error (error, "Couldn't connect: cannot keep data port open.");
|
||||
@@ -213,7 +213,7 @@ common_get_at_data_port (MMBaseModem *modem,
|
||||
|
||||
mm_dbg ("Connection through a plain serial AT port (%s)", mm_port_get_device (data));
|
||||
|
||||
return MM_AT_SERIAL_PORT (g_object_ref (data));
|
||||
return MM_PORT_SERIAL_AT (g_object_ref (data));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -252,7 +252,7 @@ dial_cdma_ready (MMBaseModem *modem,
|
||||
ctx->close_data_on_exit = FALSE;
|
||||
|
||||
/* Generic CDMA connections are done over PPP always */
|
||||
g_assert (MM_IS_AT_SERIAL_PORT (ctx->data));
|
||||
g_assert (MM_IS_PORT_SERIAL_AT (ctx->data));
|
||||
config = mm_bearer_ip_config_new ();
|
||||
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_PPP);
|
||||
|
||||
@@ -283,7 +283,7 @@ cdma_connect_context_dial (DetailedConnectContext *ctx)
|
||||
command = g_strdup ("DT#777");
|
||||
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
MM_AT_SERIAL_PORT (ctx->data),
|
||||
MM_PORT_SERIAL_AT (ctx->data),
|
||||
command,
|
||||
90,
|
||||
FALSE,
|
||||
@@ -389,8 +389,8 @@ current_rm_protocol_ready (MMBaseModem *self,
|
||||
static void
|
||||
connect_cdma (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary, /* unused by us */
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary, /* unused by us */
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@@ -445,12 +445,12 @@ connect_cdma (MMBroadbandBearer *self,
|
||||
typedef struct {
|
||||
MMBroadbandBearer *self;
|
||||
MMBaseModem *modem;
|
||||
MMAtSerialPort *primary;
|
||||
MMPortSerialAt *primary;
|
||||
GCancellable *cancellable;
|
||||
GSimpleAsyncResult *result;
|
||||
GError *saved_error;
|
||||
|
||||
MMAtSerialPort *dial_port;
|
||||
MMPortSerialAt *dial_port;
|
||||
gboolean close_dial_port_on_exit;
|
||||
} Dial3gppContext;
|
||||
|
||||
@@ -574,7 +574,7 @@ atd_ready (MMBaseModem *modem,
|
||||
static void
|
||||
dial_3gpp (MMBroadbandBearer *self,
|
||||
MMBaseModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMPortSerialAt *primary,
|
||||
guint cid,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -654,7 +654,7 @@ get_ip_config_3gpp_ready (MMBroadbandModem *modem,
|
||||
}
|
||||
|
||||
/* Keep port open during connection */
|
||||
if (MM_IS_AT_SERIAL_PORT (ctx->data))
|
||||
if (MM_IS_PORT_SERIAL_AT (ctx->data))
|
||||
ctx->close_data_on_exit = FALSE;
|
||||
|
||||
g_simple_async_result_set_op_res_gpointer (
|
||||
@@ -688,7 +688,7 @@ dial_3gpp_ready (MMBroadbandModem *modem,
|
||||
|
||||
/* If the dialling operation used an AT port, it is assumed to have an extra
|
||||
* open() count. */
|
||||
if (MM_IS_AT_SERIAL_PORT (ctx->data))
|
||||
if (MM_IS_PORT_SERIAL_AT (ctx->data))
|
||||
ctx->close_data_on_exit = TRUE;
|
||||
|
||||
if (MM_BROADBAND_BEARER_GET_CLASS (ctx->self)->get_ip_config_3gpp &&
|
||||
@@ -709,14 +709,14 @@ dial_3gpp_ready (MMBroadbandModem *modem,
|
||||
/* Yuhu! */
|
||||
|
||||
/* Keep port open during connection */
|
||||
if (MM_IS_AT_SERIAL_PORT (ctx->data))
|
||||
if (MM_IS_PORT_SERIAL_AT (ctx->data))
|
||||
ctx->close_data_on_exit = FALSE;
|
||||
|
||||
/* If no specific IP retrieval requested, set the default implementation
|
||||
* (PPP if data port is AT, DHCP otherwise) */
|
||||
config = mm_bearer_ip_config_new ();
|
||||
mm_bearer_ip_config_set_method (config,
|
||||
(MM_IS_AT_SERIAL_PORT (ctx->data) ?
|
||||
(MM_IS_PORT_SERIAL_AT (ctx->data) ?
|
||||
MM_BEARER_IP_METHOD_PPP :
|
||||
MM_BEARER_IP_METHOD_DHCP));
|
||||
|
||||
@@ -814,7 +814,7 @@ find_cid_ready (MMBaseModem *modem,
|
||||
}
|
||||
|
||||
/* Otherwise, initialize a new PDP context with our APN */
|
||||
apn = mm_at_serial_port_quote_string (mm_bearer_properties_get_apn (mm_bearer_peek_config (MM_BEARER (ctx->self))));
|
||||
apn = mm_port_serial_at_quote_string (mm_bearer_properties_get_apn (mm_bearer_peek_config (MM_BEARER (ctx->self))));
|
||||
command = g_strdup_printf ("+CGDCONT=%u,\"%s\",%s",
|
||||
ctx->cid,
|
||||
pdp_type,
|
||||
@@ -999,8 +999,8 @@ static const MMBaseModemAtCommand find_cid_sequence[] = {
|
||||
static void
|
||||
connect_3gpp (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@@ -1120,7 +1120,7 @@ connect (MMBearer *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMBaseModem *modem = NULL;
|
||||
MMAtSerialPort *primary;
|
||||
MMPortSerialAt *primary;
|
||||
ConnectContext *ctx;
|
||||
const gchar *apn;
|
||||
|
||||
@@ -1264,8 +1264,8 @@ connect (MMBearer *self,
|
||||
typedef struct {
|
||||
MMBroadbandBearer *self;
|
||||
MMBaseModem *modem;
|
||||
MMAtSerialPort *primary;
|
||||
MMAtSerialPort *secondary;
|
||||
MMPortSerialAt *primary;
|
||||
MMPortSerialAt *secondary;
|
||||
MMPort *data;
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
@@ -1301,8 +1301,8 @@ detailed_disconnect_context_complete_and_free (DetailedDisconnectContext *ctx)
|
||||
static DetailedDisconnectContext *
|
||||
detailed_disconnect_context_new (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@@ -1384,8 +1384,8 @@ data_reopen_cdma_ready (MMPortSerial *data,
|
||||
static void
|
||||
disconnect_cdma (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@@ -1478,7 +1478,7 @@ data_flash_3gpp_ready (MMPortSerial *data,
|
||||
/* Last resort, try to send CGACT in the data port itself */
|
||||
mm_dbg ("Sending PDP context deactivation in data port...");
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
MM_AT_SERIAL_PORT (data),
|
||||
MM_PORT_SERIAL_AT (data),
|
||||
ctx->cgact_command,
|
||||
10,
|
||||
FALSE,
|
||||
@@ -1541,8 +1541,8 @@ cgact_ready (MMBaseModem *modem,
|
||||
static void
|
||||
disconnect_3gpp (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
guint cid,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -1708,7 +1708,7 @@ disconnect (MMBearer *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMAtSerialPort *primary;
|
||||
MMPortSerialAt *primary;
|
||||
MMBaseModem *modem = NULL;
|
||||
DisconnectContext *ctx;
|
||||
|
||||
@@ -1815,7 +1815,7 @@ struct _InitAsyncContext {
|
||||
GCancellable *cancellable;
|
||||
MMBaseModem *modem;
|
||||
InitializationStep step;
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
+11
-11
@@ -50,8 +50,8 @@ struct _MMBroadbandBearerClass {
|
||||
/* Full 3GPP connection sequence */
|
||||
void (* connect_3gpp) (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
@@ -62,7 +62,7 @@ struct _MMBroadbandBearerClass {
|
||||
/* Dialing sub-part of 3GPP connection */
|
||||
void (* dial_3gpp) (MMBroadbandBearer *self,
|
||||
MMBaseModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMPortSerialAt *primary,
|
||||
guint cid,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -75,8 +75,8 @@ struct _MMBroadbandBearerClass {
|
||||
* Only really required when using net port + static IP address. */
|
||||
void (* get_ip_config_3gpp) (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
guint cid,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -90,8 +90,8 @@ struct _MMBroadbandBearerClass {
|
||||
/* Full 3GPP disconnection sequence */
|
||||
void (* disconnect_3gpp) (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
guint cid,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -103,8 +103,8 @@ struct _MMBroadbandBearerClass {
|
||||
/* Full CDMA connection sequence */
|
||||
void (* connect_cdma) (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
@@ -115,8 +115,8 @@ struct _MMBroadbandBearerClass {
|
||||
/* Full CDMA disconnection sequence */
|
||||
void (* disconnect_cdma) (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMAtSerialPort *primary,
|
||||
MMAtSerialPort *secondary,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
+44
-44
@@ -1784,7 +1784,7 @@ signal_quality_csq (SignalQualityContext *ctx)
|
||||
{
|
||||
mm_base_modem_at_sequence_full (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_AT_SERIAL_PORT (ctx->port),
|
||||
MM_PORT_SERIAL_AT (ctx->port),
|
||||
signal_quality_csq_sequence,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
@@ -1877,7 +1877,7 @@ static void
|
||||
signal_quality_cind (SignalQualityContext *ctx)
|
||||
{
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (ctx->self),
|
||||
MM_AT_SERIAL_PORT (ctx->port),
|
||||
MM_PORT_SERIAL_AT (ctx->port),
|
||||
"+CIND?",
|
||||
3,
|
||||
FALSE,
|
||||
@@ -2406,7 +2406,7 @@ modem_3gpp_setup_cleanup_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
ciev_received (MMAtSerialPort *port,
|
||||
ciev_received (MMPortSerialAt *port,
|
||||
GMatchInfo *info,
|
||||
MMBroadbandModem *self)
|
||||
{
|
||||
@@ -2447,7 +2447,7 @@ static void
|
||||
set_unsolicited_events_handlers (MMBroadbandModem *self,
|
||||
gboolean enable)
|
||||
{
|
||||
MMAtSerialPort *ports[2];
|
||||
MMPortSerialAt *ports[2];
|
||||
GRegex *ciev_regex;
|
||||
guint i;
|
||||
|
||||
@@ -2464,10 +2464,10 @@ set_unsolicited_events_handlers (MMBroadbandModem *self,
|
||||
mm_dbg ("(%s) %s 3GPP unsolicited events handlers",
|
||||
mm_port_get_device (MM_PORT (ports[i])),
|
||||
enable ? "Setting" : "Removing");
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (
|
||||
ports[i],
|
||||
ciev_regex,
|
||||
enable ? (MMAtSerialUnsolicitedMsgFn) ciev_received : NULL,
|
||||
enable ? (MMPortSerialAtUnsolicitedMsgFn) ciev_received : NULL,
|
||||
enable ? self : NULL,
|
||||
NULL);
|
||||
}
|
||||
@@ -2659,7 +2659,7 @@ unsolicited_events_setup_ready (MMBroadbandModem *self,
|
||||
static void
|
||||
run_unsolicited_events_setup (UnsolicitedEventsContext *ctx)
|
||||
{
|
||||
MMAtSerialPort *port = NULL;
|
||||
MMPortSerialAt *port = NULL;
|
||||
|
||||
if (!ctx->cmer_primary_done) {
|
||||
ctx->cmer_primary_done = TRUE;
|
||||
@@ -3495,7 +3495,7 @@ modem_3gpp_setup_unsolicited_registration_events_finish (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
registration_state_changed (MMAtSerialPort *port,
|
||||
registration_state_changed (MMPortSerialAt *port,
|
||||
GMatchInfo *match_info,
|
||||
MMBroadbandModem *self)
|
||||
{
|
||||
@@ -3546,7 +3546,7 @@ modem_3gpp_setup_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMAtSerialPort *ports[2];
|
||||
MMPortSerialAt *ports[2];
|
||||
GPtrArray *array;
|
||||
guint i;
|
||||
guint j;
|
||||
@@ -3568,10 +3568,10 @@ modem_3gpp_setup_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||
mm_dbg ("(%s) setting up 3GPP unsolicited registration messages handlers",
|
||||
mm_port_get_device (MM_PORT (ports[i])));
|
||||
for (j = 0; j < array->len; j++) {
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (
|
||||
MM_AT_SERIAL_PORT (ports[i]),
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (
|
||||
MM_PORT_SERIAL_AT (ports[i]),
|
||||
(GRegex *) g_ptr_array_index (array, j),
|
||||
(MMAtSerialUnsolicitedMsgFn)registration_state_changed,
|
||||
(MMPortSerialAtUnsolicitedMsgFn)registration_state_changed,
|
||||
self,
|
||||
NULL);
|
||||
}
|
||||
@@ -3600,7 +3600,7 @@ modem_3gpp_cleanup_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMAtSerialPort *ports[2];
|
||||
MMPortSerialAt *ports[2];
|
||||
GPtrArray *array;
|
||||
guint i;
|
||||
guint j;
|
||||
@@ -3623,8 +3623,8 @@ modem_3gpp_cleanup_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||
mm_port_get_device (MM_PORT (ports[i])));
|
||||
|
||||
for (j = 0; j < array->len; j++) {
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (
|
||||
MM_AT_SERIAL_PORT (ports[i]),
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (
|
||||
MM_PORT_SERIAL_AT (ports[i]),
|
||||
(GRegex *) g_ptr_array_index (array, j),
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -4124,7 +4124,7 @@ unsolicited_registration_events_sequence_ready (MMBroadbandModem *self,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GVariant *command;
|
||||
MMAtSerialPort *secondary;
|
||||
MMPortSerialAt *secondary;
|
||||
|
||||
/* Only one must be running */
|
||||
g_assert ((ctx->running_cs ? 1 : 0) +
|
||||
@@ -4841,7 +4841,7 @@ cusd_process_string (MMBroadbandModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
cusd_received (MMAtSerialPort *port,
|
||||
cusd_received (MMPortSerialAt *port,
|
||||
GMatchInfo *info,
|
||||
MMBroadbandModem *self)
|
||||
{
|
||||
@@ -4860,7 +4860,7 @@ set_unsolicited_result_code_handlers (MMIfaceModem3gppUssd *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMAtSerialPort *ports[2];
|
||||
MMPortSerialAt *ports[2];
|
||||
GRegex *cusd_regex;
|
||||
guint i;
|
||||
|
||||
@@ -4881,10 +4881,10 @@ set_unsolicited_result_code_handlers (MMIfaceModem3gppUssd *self,
|
||||
mm_dbg ("(%s) %s unsolicited result code handlers",
|
||||
mm_port_get_device (MM_PORT (ports[i])),
|
||||
enable ? "Setting" : "Removing");
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (
|
||||
ports[i],
|
||||
cusd_regex,
|
||||
enable ? (MMAtSerialUnsolicitedMsgFn) cusd_received : NULL,
|
||||
enable ? (MMPortSerialAtUnsolicitedMsgFn) cusd_received : NULL,
|
||||
enable ? self : NULL,
|
||||
NULL);
|
||||
}
|
||||
@@ -5657,7 +5657,7 @@ indication_lock_storages_ready (MMBroadbandModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
cmti_received (MMAtSerialPort *port,
|
||||
cmti_received (MMPortSerialAt *port,
|
||||
GMatchInfo *info,
|
||||
MMBroadbandModem *self)
|
||||
{
|
||||
@@ -5701,7 +5701,7 @@ cmti_received (MMAtSerialPort *port,
|
||||
}
|
||||
|
||||
static void
|
||||
cds_received (MMAtSerialPort *port,
|
||||
cds_received (MMPortSerialAt *port,
|
||||
GMatchInfo *info,
|
||||
MMBroadbandModem *self)
|
||||
{
|
||||
@@ -5740,7 +5740,7 @@ set_messaging_unsolicited_events_handlers (MMIfaceModemMessaging *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMAtSerialPort *ports[2];
|
||||
MMPortSerialAt *ports[2];
|
||||
GRegex *cmti_regex;
|
||||
GRegex *cds_regex;
|
||||
guint i;
|
||||
@@ -5764,16 +5764,16 @@ set_messaging_unsolicited_events_handlers (MMIfaceModemMessaging *self,
|
||||
mm_dbg ("(%s) %s messaging unsolicited events handlers",
|
||||
mm_port_get_device (MM_PORT (ports[i])),
|
||||
enable ? "Setting" : "Removing");
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (
|
||||
ports[i],
|
||||
cmti_regex,
|
||||
enable ? (MMAtSerialUnsolicitedMsgFn) cmti_received : NULL,
|
||||
enable ? (MMPortSerialAtUnsolicitedMsgFn) cmti_received : NULL,
|
||||
enable ? self : NULL,
|
||||
NULL);
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (
|
||||
ports[i],
|
||||
cds_regex,
|
||||
enable ? (MMAtSerialUnsolicitedMsgFn) cds_received : NULL,
|
||||
enable ? (MMPortSerialAtUnsolicitedMsgFn) cds_received : NULL,
|
||||
enable ? self : NULL,
|
||||
NULL);
|
||||
}
|
||||
@@ -6860,7 +6860,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
MMBroadbandModem *self;
|
||||
GSimpleAsyncResult *result;
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
MMModemCdmaRegistrationState cdma1x_state;
|
||||
MMModemCdmaRegistrationState evdo_state;
|
||||
GError *error;
|
||||
@@ -7005,7 +7005,7 @@ modem_cdma_get_detailed_registration_state (MMIfaceModemCdma *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMAtSerialPort *port;
|
||||
MMPortSerialAt *port;
|
||||
GError *error = NULL;
|
||||
DetailedRegistrationStateContext *ctx;
|
||||
|
||||
@@ -7493,7 +7493,7 @@ static const gchar *secondary_init_sequence[] = {
|
||||
static void
|
||||
setup_ports (MMBroadbandModem *self)
|
||||
{
|
||||
MMAtSerialPort *ports[2];
|
||||
MMPortSerialAt *ports[2];
|
||||
GRegex *regex;
|
||||
GPtrArray *array;
|
||||
gint i, j;
|
||||
@@ -7503,12 +7503,12 @@ setup_ports (MMBroadbandModem *self)
|
||||
|
||||
if (ports[0])
|
||||
g_object_set (ports[0],
|
||||
MM_AT_SERIAL_PORT_INIT_SEQUENCE, primary_init_sequence,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE, primary_init_sequence,
|
||||
NULL);
|
||||
|
||||
if (ports[1])
|
||||
g_object_set (ports[1],
|
||||
MM_AT_SERIAL_PORT_INIT_SEQUENCE, secondary_init_sequence,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE, secondary_init_sequence,
|
||||
NULL);
|
||||
|
||||
/* Cleanup all unsolicited message handlers in all AT ports */
|
||||
@@ -7520,7 +7520,7 @@ setup_ports (MMBroadbandModem *self)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < array->len; j++) {
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (ports[i]),
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]),
|
||||
(GRegex *)g_ptr_array_index (array, j),
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -7535,7 +7535,7 @@ setup_ports (MMBroadbandModem *self)
|
||||
if (!ports[i])
|
||||
continue;
|
||||
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (ports[i]),
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]),
|
||||
regex,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -7549,7 +7549,7 @@ setup_ports (MMBroadbandModem *self)
|
||||
if (!ports[i])
|
||||
continue;
|
||||
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (ports[i]),
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]),
|
||||
regex,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -7563,7 +7563,7 @@ setup_ports (MMBroadbandModem *self)
|
||||
if (!ports[i])
|
||||
continue;
|
||||
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (ports[i]),
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]),
|
||||
regex,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -7578,9 +7578,9 @@ setup_ports (MMBroadbandModem *self)
|
||||
struct _PortsContext {
|
||||
volatile gint ref_count;
|
||||
|
||||
MMAtSerialPort *primary;
|
||||
MMPortSerialAt *primary;
|
||||
gboolean primary_open;
|
||||
MMAtSerialPort *secondary;
|
||||
MMPortSerialAt *secondary;
|
||||
gboolean secondary_open;
|
||||
MMPortSerialQcdm *qcdm;
|
||||
gboolean qcdm_open;
|
||||
@@ -7807,14 +7807,14 @@ enabling_after_modem_init_timeout (EnablingStartedContext *ctx)
|
||||
{
|
||||
/* Reset init sequence enabled flags and run them explicitly */
|
||||
g_object_set (ctx->ports->primary,
|
||||
MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, TRUE,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, TRUE,
|
||||
NULL);
|
||||
mm_at_serial_port_run_init_sequence (ctx->ports->primary);
|
||||
mm_port_serial_at_run_init_sequence (ctx->ports->primary);
|
||||
if (ctx->ports->secondary) {
|
||||
g_object_set (ctx->ports->secondary,
|
||||
MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, TRUE,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, TRUE,
|
||||
NULL);
|
||||
mm_at_serial_port_run_init_sequence (ctx->ports->secondary);
|
||||
mm_port_serial_at_run_init_sequence (ctx->ports->secondary);
|
||||
}
|
||||
|
||||
/* Store enabled ports context and complete */
|
||||
@@ -7891,7 +7891,7 @@ open_ports_enabling (MMBroadbandModem *self,
|
||||
/* If we'll need to run modem initialization, disable port init sequence */
|
||||
if (modem_init_required)
|
||||
g_object_set (ctx->primary,
|
||||
MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, FALSE,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, FALSE,
|
||||
NULL);
|
||||
|
||||
|
||||
@@ -7908,7 +7908,7 @@ open_ports_enabling (MMBroadbandModem *self,
|
||||
/* If we'll need to run modem initialization, disable port init sequence */
|
||||
if (modem_init_required)
|
||||
g_object_set (ctx->secondary,
|
||||
MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED, FALSE,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED, FALSE,
|
||||
NULL);
|
||||
if (!mm_port_serial_open (MM_PORT_SERIAL (ctx->secondary), error)) {
|
||||
g_prefix_error (error, "Couldn't open secondary port: ");
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
|
||||
#define MM_TYPE_IFACE_MODEM_3GPP_USSD (mm_iface_modem_3gpp_ussd_get_type ())
|
||||
#define MM_IFACE_MODEM_3GPP_USSD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_3GPP_USSD, MMIfaceModem3gppUssd))
|
||||
#define MM_IS_IFACE_MODEM_3GPP_USSD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_3GPP_USSD))
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
|
||||
#define MM_TYPE_IFACE_MODEM_3GPP (mm_iface_modem_3gpp_get_type ())
|
||||
#define MM_IFACE_MODEM_3GPP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_3GPP, MMIfaceModem3gpp))
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
|
||||
#define MM_TYPE_IFACE_MODEM_CDMA (mm_iface_modem_cdma_get_type ())
|
||||
#define MM_IFACE_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_CDMA, MMIfaceModemCdma))
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
|
||||
#define MM_TYPE_IFACE_MODEM_LOCATION (mm_iface_modem_location_get_type ())
|
||||
#define MM_IFACE_MODEM_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_LOCATION, MMIfaceModemLocation))
|
||||
#define MM_IS_IFACE_MODEM_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_LOCATION))
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-sms-part.h"
|
||||
#include "mm-sms.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-charsets.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-bearer.h"
|
||||
#include "mm-sim.h"
|
||||
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "mm-plugin.h"
|
||||
#include "mm-device.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-port-serial-qcdm.h"
|
||||
#include "mm-serial-parsers.h"
|
||||
#include "mm-private-boxed-types.h"
|
||||
@@ -895,7 +895,7 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe),
|
||||
mm_port_probe_get_port_type (probe),
|
||||
MM_AT_PORT_FLAG_NONE,
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
&inner_error);
|
||||
if (!grabbed) {
|
||||
mm_warn ("Could not grab port (%s/%s): '%s'",
|
||||
|
||||
+11
-11
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "mm-port-probe.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-port-serial.h"
|
||||
#include "mm-serial-parsers.h"
|
||||
#include "mm-port-probe-at.h"
|
||||
@@ -329,7 +329,7 @@ port_probe_run_task_free (PortProbeRunTask *task)
|
||||
|
||||
if (task->serial) {
|
||||
if (task->buffer_full_id) {
|
||||
g_warn_if_fail (MM_IS_AT_SERIAL_PORT (task->serial));
|
||||
g_warn_if_fail (MM_IS_PORT_SERIAL_AT (task->serial));
|
||||
g_signal_handler_disconnect (task->serial, task->buffer_full_id);
|
||||
}
|
||||
if (mm_port_serial_is_open (task->serial))
|
||||
@@ -852,7 +852,7 @@ serial_probe_at_result_processor (MMPortProbe *self,
|
||||
}
|
||||
|
||||
static void
|
||||
serial_probe_at_parse_response (MMAtSerialPort *port,
|
||||
serial_probe_at_parse_response (MMPortSerialAt *port,
|
||||
GString *response,
|
||||
GError *error,
|
||||
MMPortProbe *self)
|
||||
@@ -943,13 +943,13 @@ serial_probe_at (MMPortProbe *self)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mm_at_serial_port_queue_command (
|
||||
MM_AT_SERIAL_PORT (task->serial),
|
||||
mm_port_serial_at_queue_command (
|
||||
MM_PORT_SERIAL_AT (task->serial),
|
||||
task->at_commands->command,
|
||||
task->at_commands->timeout,
|
||||
FALSE,
|
||||
task->at_probing_cancellable,
|
||||
(MMAtSerialResponseFn)serial_probe_at_parse_response,
|
||||
(MMPortSerialAtResponseFn)serial_probe_at_parse_response,
|
||||
self);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1015,7 +1015,7 @@ serial_probe_schedule (MMPortProbe *self)
|
||||
task->at_custom_init &&
|
||||
task->at_custom_init_finish) {
|
||||
task->at_custom_init (self,
|
||||
MM_AT_SERIAL_PORT (task->serial),
|
||||
MM_PORT_SERIAL_AT (task->serial),
|
||||
task->at_probing_cancellable,
|
||||
(GAsyncReadyCallback)at_custom_init_ready,
|
||||
NULL);
|
||||
@@ -1136,7 +1136,7 @@ serial_open_at (MMPortProbe *self)
|
||||
if (!task->serial) {
|
||||
gpointer parser;
|
||||
|
||||
task->serial = MM_PORT_SERIAL (mm_at_serial_port_new (g_udev_device_get_name (self->priv->port)));
|
||||
task->serial = MM_PORT_SERIAL (mm_port_serial_at_new (g_udev_device_get_name (self->priv->port)));
|
||||
if (!task->serial) {
|
||||
port_probe_run_task_complete (
|
||||
task,
|
||||
@@ -1152,15 +1152,15 @@ serial_open_at (MMPortProbe *self)
|
||||
g_object_set (task->serial,
|
||||
MM_PORT_SERIAL_SPEW_CONTROL, TRUE,
|
||||
MM_PORT_SERIAL_SEND_DELAY, task->at_send_delay,
|
||||
MM_AT_SERIAL_PORT_REMOVE_ECHO, task->at_remove_echo,
|
||||
MM_AT_SERIAL_PORT_SEND_LF, task->at_send_lf,
|
||||
MM_PORT_SERIAL_AT_REMOVE_ECHO, task->at_remove_echo,
|
||||
MM_PORT_SERIAL_AT_SEND_LF, task->at_send_lf,
|
||||
NULL);
|
||||
|
||||
parser = mm_serial_parser_v1_new ();
|
||||
mm_serial_parser_v1_add_filter (parser,
|
||||
serial_parser_filter_cb,
|
||||
NULL);
|
||||
mm_at_serial_port_set_response_parser (MM_AT_SERIAL_PORT (task->serial),
|
||||
mm_port_serial_at_set_response_parser (MM_PORT_SERIAL_AT (task->serial),
|
||||
mm_serial_parser_v1_parse,
|
||||
parser,
|
||||
mm_serial_parser_v1_destroy);
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "mm-private-boxed-types.h"
|
||||
#include "mm-port-probe-at.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-device.h"
|
||||
|
||||
#define MM_TYPE_PORT_PROBE (mm_port_probe_get_type ())
|
||||
@@ -68,7 +68,7 @@ struct _MMPortProbeClass {
|
||||
* It also helps to implement plugin-specific checks, as plugins can set
|
||||
* their own probing results on the 'probe' object. */
|
||||
typedef void (* MMPortProbeAtCustomInit) (MMPortProbe *probe,
|
||||
MMAtSerialPort *port,
|
||||
MMPortSerialAt *port,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
G_DEFINE_TYPE (MMAtSerialPort, mm_at_serial_port, MM_TYPE_PORT_SERIAL)
|
||||
G_DEFINE_TYPE (MMPortSerialAt, mm_port_serial_at, MM_TYPE_PORT_SERIAL)
|
||||
|
||||
#define MM_AT_SERIAL_PORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_AT_SERIAL_PORT, MMAtSerialPortPrivate))
|
||||
#define MM_PORT_SERIAL_AT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_PORT_SERIAL_AT, MMPortSerialAtPrivate))
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -39,25 +39,25 @@ enum {
|
||||
|
||||
typedef struct {
|
||||
/* Response parser data */
|
||||
MMAtSerialResponseParserFn response_parser_fn;
|
||||
MMPortSerialAtResponseParserFn response_parser_fn;
|
||||
gpointer response_parser_user_data;
|
||||
GDestroyNotify response_parser_notify;
|
||||
|
||||
GSList *unsolicited_msg_handlers;
|
||||
|
||||
MMAtPortFlag flags;
|
||||
MMPortSerialAtFlag flags;
|
||||
|
||||
/* Properties */
|
||||
gboolean remove_echo;
|
||||
guint init_sequence_enabled;
|
||||
gchar **init_sequence;
|
||||
gboolean send_lf;
|
||||
} MMAtSerialPortPrivate;
|
||||
} MMPortSerialAtPrivate;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gchar *
|
||||
mm_at_serial_port_quote_string (const char *string)
|
||||
mm_port_serial_at_quote_string (const char *string)
|
||||
{
|
||||
int len, i;
|
||||
gchar *quoted, *pos;
|
||||
@@ -83,14 +83,14 @@ mm_at_serial_port_quote_string (const char *string)
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_set_response_parser (MMAtSerialPort *self,
|
||||
MMAtSerialResponseParserFn fn,
|
||||
mm_port_serial_at_set_response_parser (MMPortSerialAt *self,
|
||||
MMPortSerialAtResponseParserFn fn,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
g_return_if_fail (MM_IS_AT_SERIAL_PORT (self));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
|
||||
|
||||
if (priv->response_parser_notify)
|
||||
priv->response_parser_notify (priv->response_parser_user_data);
|
||||
@@ -101,7 +101,7 @@ mm_at_serial_port_set_response_parser (MMAtSerialPort *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_remove_echo (GByteArray *response)
|
||||
mm_port_serial_at_remove_echo (GByteArray *response)
|
||||
{
|
||||
guint i;
|
||||
|
||||
@@ -123,8 +123,8 @@ mm_at_serial_port_remove_echo (GByteArray *response)
|
||||
static gboolean
|
||||
parse_response (MMPortSerial *port, GByteArray *response, GError **error)
|
||||
{
|
||||
MMAtSerialPort *self = MM_AT_SERIAL_PORT (port);
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAt *self = MM_PORT_SERIAL_AT (port);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
gboolean found;
|
||||
GString *string;
|
||||
|
||||
@@ -132,7 +132,7 @@ parse_response (MMPortSerial *port, GByteArray *response, GError **error)
|
||||
|
||||
/* Remove echo */
|
||||
if (priv->remove_echo)
|
||||
mm_at_serial_port_remove_echo (response);
|
||||
mm_port_serial_at_remove_echo (response);
|
||||
|
||||
/* Construct the string that AT-parsing functions expect */
|
||||
string = g_string_sized_new (response->len + 1);
|
||||
@@ -158,8 +158,8 @@ handle_response (MMPortSerial *port,
|
||||
GCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
MMAtSerialPort *self = MM_AT_SERIAL_PORT (port);
|
||||
MMAtSerialResponseFn response_callback = (MMAtSerialResponseFn) callback;
|
||||
MMPortSerialAt *self = MM_PORT_SERIAL_AT (port);
|
||||
MMPortSerialAtResponseFn response_callback = (MMPortSerialAtResponseFn) callback;
|
||||
GString *string;
|
||||
|
||||
/* Convert to a string and call the callback */
|
||||
@@ -175,7 +175,7 @@ handle_response (MMPortSerial *port,
|
||||
|
||||
typedef struct {
|
||||
GRegex *regex;
|
||||
MMAtSerialUnsolicitedMsgFn callback;
|
||||
MMPortSerialAtUnsolicitedMsgFn callback;
|
||||
gboolean enable;
|
||||
gpointer user_data;
|
||||
GDestroyNotify notify;
|
||||
@@ -190,20 +190,20 @@ unsolicited_msg_handler_cmp (MMAtUnsolicitedMsgHandler *handler,
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_add_unsolicited_msg_handler (MMAtSerialPort *self,
|
||||
mm_port_serial_at_add_unsolicited_msg_handler (MMPortSerialAt *self,
|
||||
GRegex *regex,
|
||||
MMAtSerialUnsolicitedMsgFn callback,
|
||||
MMPortSerialAtUnsolicitedMsgFn callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GSList *existing;
|
||||
MMAtUnsolicitedMsgHandler *handler;
|
||||
MMAtSerialPortPrivate *priv;
|
||||
MMPortSerialAtPrivate *priv;
|
||||
|
||||
g_return_if_fail (MM_IS_AT_SERIAL_PORT (self));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
|
||||
g_return_if_fail (regex != NULL);
|
||||
|
||||
priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
existing = g_slist_find_custom (priv->unsolicited_msg_handlers,
|
||||
regex,
|
||||
@@ -226,18 +226,18 @@ mm_at_serial_port_add_unsolicited_msg_handler (MMAtSerialPort *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_enable_unsolicited_msg_handler (MMAtSerialPort *self,
|
||||
mm_port_serial_at_enable_unsolicited_msg_handler (MMPortSerialAt *self,
|
||||
GRegex *regex,
|
||||
gboolean enable)
|
||||
{
|
||||
GSList *existing;
|
||||
MMAtUnsolicitedMsgHandler *handler;
|
||||
MMAtSerialPortPrivate *priv;
|
||||
MMPortSerialAtPrivate *priv;
|
||||
|
||||
g_return_if_fail (MM_IS_AT_SERIAL_PORT (self));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
|
||||
g_return_if_fail (regex != NULL);
|
||||
|
||||
priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
existing = g_slist_find_custom (priv->unsolicited_msg_handlers,
|
||||
regex,
|
||||
@@ -266,13 +266,13 @@ remove_eval_cb (const GMatchInfo *match_info,
|
||||
static void
|
||||
parse_unsolicited (MMPortSerial *port, GByteArray *response)
|
||||
{
|
||||
MMAtSerialPort *self = MM_AT_SERIAL_PORT (port);
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAt *self = MM_PORT_SERIAL_AT (port);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
/* Remove echo */
|
||||
if (priv->remove_echo)
|
||||
mm_at_serial_port_remove_echo (response);
|
||||
mm_port_serial_at_remove_echo (response);
|
||||
|
||||
for (iter = priv->unsolicited_msg_handlers; iter; iter = iter->next) {
|
||||
MMAtUnsolicitedMsgHandler *handler = (MMAtUnsolicitedMsgHandler *) iter->data;
|
||||
@@ -351,19 +351,19 @@ at_command_to_byte_array (const char *command, gboolean is_raw, gboolean send_lf
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_queue_command (MMAtSerialPort *self,
|
||||
mm_port_serial_at_queue_command (MMPortSerialAt *self,
|
||||
const char *command,
|
||||
guint32 timeout_seconds,
|
||||
gboolean is_raw,
|
||||
GCancellable *cancellable,
|
||||
MMAtSerialResponseFn callback,
|
||||
MMPortSerialAtResponseFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GByteArray *buf;
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (MM_IS_AT_SERIAL_PORT (self));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
|
||||
g_return_if_fail (command != NULL);
|
||||
|
||||
buf = at_command_to_byte_array (command, is_raw, priv->send_lf);
|
||||
@@ -379,19 +379,19 @@ mm_at_serial_port_queue_command (MMAtSerialPort *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_queue_command_cached (MMAtSerialPort *self,
|
||||
mm_port_serial_at_queue_command_cached (MMPortSerialAt *self,
|
||||
const char *command,
|
||||
guint32 timeout_seconds,
|
||||
gboolean is_raw,
|
||||
GCancellable *cancellable,
|
||||
MMAtSerialResponseFn callback,
|
||||
MMPortSerialAtResponseFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GByteArray *buf;
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (MM_IS_AT_SERIAL_PORT (self));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
|
||||
g_return_if_fail (command != NULL);
|
||||
|
||||
buf = at_command_to_byte_array (command, is_raw, priv->send_lf);
|
||||
@@ -438,33 +438,33 @@ debug_log (MMPortSerial *port, const char *prefix, const char *buf, gsize len)
|
||||
}
|
||||
|
||||
void
|
||||
mm_at_serial_port_set_flags (MMAtSerialPort *self, MMAtPortFlag flags)
|
||||
mm_port_serial_at_set_flags (MMPortSerialAt *self, MMPortSerialAtFlag flags)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (MM_IS_AT_SERIAL_PORT (self));
|
||||
g_return_if_fail (flags <= (MM_AT_PORT_FLAG_PRIMARY |
|
||||
MM_AT_PORT_FLAG_SECONDARY |
|
||||
MM_AT_PORT_FLAG_PPP |
|
||||
MM_AT_PORT_FLAG_GPS_CONTROL));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
|
||||
g_return_if_fail (flags <= (MM_PORT_SERIAL_AT_FLAG_PRIMARY |
|
||||
MM_PORT_SERIAL_AT_FLAG_SECONDARY |
|
||||
MM_PORT_SERIAL_AT_FLAG_PPP |
|
||||
MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL));
|
||||
|
||||
MM_AT_SERIAL_PORT_GET_PRIVATE (self)->flags = flags;
|
||||
MM_PORT_SERIAL_AT_GET_PRIVATE (self)->flags = flags;
|
||||
}
|
||||
|
||||
MMAtPortFlag
|
||||
mm_at_serial_port_get_flags (MMAtSerialPort *self)
|
||||
MMPortSerialAtFlag
|
||||
mm_port_serial_at_get_flags (MMPortSerialAt *self)
|
||||
{
|
||||
g_return_val_if_fail (self != NULL, MM_AT_PORT_FLAG_NONE);
|
||||
g_return_val_if_fail (MM_IS_AT_SERIAL_PORT (self), MM_AT_PORT_FLAG_NONE);
|
||||
g_return_val_if_fail (self != NULL, MM_PORT_SERIAL_AT_FLAG_NONE);
|
||||
g_return_val_if_fail (MM_IS_PORT_SERIAL_AT (self), MM_PORT_SERIAL_AT_FLAG_NONE);
|
||||
|
||||
return MM_AT_SERIAL_PORT_GET_PRIVATE (self)->flags;
|
||||
return MM_PORT_SERIAL_AT_GET_PRIVATE (self)->flags;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_at_serial_port_run_init_sequence (MMAtSerialPort *self)
|
||||
mm_port_serial_at_run_init_sequence (MMPortSerialAt *self)
|
||||
{
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
guint i;
|
||||
|
||||
if (!priv->init_sequence)
|
||||
@@ -474,7 +474,7 @@ mm_at_serial_port_run_init_sequence (MMAtSerialPort *self)
|
||||
|
||||
/* Just queue the init commands, don't wait for reply */
|
||||
for (i = 0; priv->init_sequence[i]; i++) {
|
||||
mm_at_serial_port_queue_command (self,
|
||||
mm_port_serial_at_queue_command (self,
|
||||
priv->init_sequence[i],
|
||||
3,
|
||||
FALSE,
|
||||
@@ -487,18 +487,18 @@ mm_at_serial_port_run_init_sequence (MMAtSerialPort *self)
|
||||
static void
|
||||
config (MMPortSerial *self)
|
||||
{
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
if (priv->init_sequence_enabled)
|
||||
mm_at_serial_port_run_init_sequence (MM_AT_SERIAL_PORT (self));
|
||||
mm_port_serial_at_run_init_sequence (MM_PORT_SERIAL_AT (self));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMAtSerialPort *
|
||||
mm_at_serial_port_new (const char *name)
|
||||
MMPortSerialAt *
|
||||
mm_port_serial_at_new (const char *name)
|
||||
{
|
||||
return MM_AT_SERIAL_PORT (g_object_new (MM_TYPE_AT_SERIAL_PORT,
|
||||
return MM_PORT_SERIAL_AT (g_object_new (MM_TYPE_PORT_SERIAL_AT,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_AT,
|
||||
@@ -506,9 +506,9 @@ mm_at_serial_port_new (const char *name)
|
||||
}
|
||||
|
||||
static void
|
||||
mm_at_serial_port_init (MMAtSerialPort *self)
|
||||
mm_port_serial_at_init (MMPortSerialAt *self)
|
||||
{
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
/* By default, remove echo */
|
||||
priv->remove_echo = TRUE;
|
||||
@@ -523,7 +523,7 @@ static void
|
||||
set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (object);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_REMOVE_ECHO:
|
||||
@@ -549,7 +549,7 @@ static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (object);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_REMOVE_ECHO:
|
||||
@@ -573,8 +573,8 @@ get_property (GObject *object, guint prop_id,
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
MMAtSerialPort *self = MM_AT_SERIAL_PORT (object);
|
||||
MMAtSerialPortPrivate *priv = MM_AT_SERIAL_PORT_GET_PRIVATE (self);
|
||||
MMPortSerialAt *self = MM_PORT_SERIAL_AT (object);
|
||||
MMPortSerialAtPrivate *priv = MM_PORT_SERIAL_AT_GET_PRIVATE (self);
|
||||
|
||||
while (priv->unsolicited_msg_handlers) {
|
||||
MMAtUnsolicitedMsgHandler *handler = (MMAtUnsolicitedMsgHandler *) priv->unsolicited_msg_handlers->data;
|
||||
@@ -593,16 +593,16 @@ finalize (GObject *object)
|
||||
|
||||
g_strfreev (priv->init_sequence);
|
||||
|
||||
G_OBJECT_CLASS (mm_at_serial_port_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (mm_port_serial_at_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_at_serial_port_class_init (MMAtSerialPortClass *klass)
|
||||
mm_port_serial_at_class_init (MMPortSerialAtClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
MMPortSerialClass *serial_class = MM_PORT_SERIAL_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (MMAtSerialPortPrivate));
|
||||
g_type_class_add_private (object_class, sizeof (MMPortSerialAtPrivate));
|
||||
|
||||
/* Virtual methods */
|
||||
object_class->set_property = set_property;
|
||||
@@ -617,7 +617,7 @@ mm_at_serial_port_class_init (MMAtSerialPortClass *klass)
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_REMOVE_ECHO,
|
||||
g_param_spec_boolean (MM_AT_SERIAL_PORT_REMOVE_ECHO,
|
||||
g_param_spec_boolean (MM_PORT_SERIAL_AT_REMOVE_ECHO,
|
||||
"Remove echo",
|
||||
"Built-in echo removal should be applied",
|
||||
TRUE,
|
||||
@@ -625,7 +625,7 @@ mm_at_serial_port_class_init (MMAtSerialPortClass *klass)
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_INIT_SEQUENCE_ENABLED,
|
||||
g_param_spec_boolean (MM_AT_SERIAL_PORT_INIT_SEQUENCE_ENABLED,
|
||||
g_param_spec_boolean (MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED,
|
||||
"Init sequence enabled",
|
||||
"Whether the initialization sequence should be run",
|
||||
TRUE,
|
||||
@@ -633,7 +633,7 @@ mm_at_serial_port_class_init (MMAtSerialPortClass *klass)
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_INIT_SEQUENCE,
|
||||
g_param_spec_boxed (MM_AT_SERIAL_PORT_INIT_SEQUENCE,
|
||||
g_param_spec_boxed (MM_PORT_SERIAL_AT_INIT_SEQUENCE,
|
||||
"Init sequence",
|
||||
"Initialization sequence",
|
||||
G_TYPE_STRV,
|
||||
@@ -641,7 +641,7 @@ mm_at_serial_port_class_init (MMAtSerialPortClass *klass)
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_SEND_LF,
|
||||
g_param_spec_boolean (MM_AT_SERIAL_PORT_SEND_LF,
|
||||
g_param_spec_boolean (MM_PORT_SERIAL_AT_SEND_LF,
|
||||
"Send LF",
|
||||
"Send line-feed at the end of each AT command sent",
|
||||
FALSE,
|
||||
@@ -0,0 +1,133 @@
|
||||
/* -*- 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) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MM_PORT_SERIAL_AT_H
|
||||
#define MM_PORT_SERIAL_AT_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-port-serial.h"
|
||||
|
||||
#define MM_TYPE_PORT_SERIAL_AT (mm_port_serial_at_get_type ())
|
||||
#define MM_PORT_SERIAL_AT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PORT_SERIAL_AT, MMPortSerialAt))
|
||||
#define MM_PORT_SERIAL_AT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PORT_SERIAL_AT, MMPortSerialAtClass))
|
||||
#define MM_IS_PORT_SERIAL_AT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PORT_SERIAL_AT))
|
||||
#define MM_IS_PORT_SERIAL_AT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PORT_SERIAL_AT))
|
||||
#define MM_PORT_SERIAL_AT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PORT_SERIAL_AT, MMPortSerialAtClass))
|
||||
|
||||
typedef struct _MMPortSerialAt MMPortSerialAt;
|
||||
typedef struct _MMPortSerialAtClass MMPortSerialAtClass;
|
||||
|
||||
/* AT port flags; for example consider a device with two AT ports (ACM0 and ACM1)
|
||||
* which could have the following layouts:
|
||||
*
|
||||
* ACM0(PRIMARY | PPP), ACM1(SECONDARY): port 0 is used for command and status
|
||||
* and for PPP data; while connected port 1 is used for command and status
|
||||
* ACM0(PPP), ACM1(PRIMARY): port 1 is always used for command and status, and
|
||||
* only when connecting is port 0 opened for dialing (ATD) and PPP
|
||||
*/
|
||||
typedef enum { /*< underscore_name=mm_port_serial_at_flag >*/
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE = 0,
|
||||
/* This port is preferred for command and status */
|
||||
MM_PORT_SERIAL_AT_FLAG_PRIMARY = 1 << 0,
|
||||
/* Use port for command and status if the primary port is connected */
|
||||
MM_PORT_SERIAL_AT_FLAG_SECONDARY = 1 << 1,
|
||||
/* This port should be used for PPP */
|
||||
MM_PORT_SERIAL_AT_FLAG_PPP = 1 << 2,
|
||||
/* This port should be used for GPS control */
|
||||
MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL = 1 << 3,
|
||||
} MMPortSerialAtFlag;
|
||||
|
||||
typedef gboolean (*MMPortSerialAtResponseParserFn) (gpointer user_data,
|
||||
GString *response,
|
||||
GError **error);
|
||||
|
||||
typedef void (*MMPortSerialAtUnsolicitedMsgFn) (MMPortSerialAt *port,
|
||||
GMatchInfo *match_info,
|
||||
gpointer user_data);
|
||||
|
||||
typedef void (*MMPortSerialAtResponseFn) (MMPortSerialAt *port,
|
||||
GString *response,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
#define MM_PORT_SERIAL_AT_REMOVE_ECHO "remove-echo"
|
||||
#define MM_PORT_SERIAL_AT_INIT_SEQUENCE_ENABLED "init-sequence-enabled"
|
||||
#define MM_PORT_SERIAL_AT_INIT_SEQUENCE "init-sequence"
|
||||
#define MM_PORT_SERIAL_AT_SEND_LF "send-lf"
|
||||
|
||||
struct _MMPortSerialAt {
|
||||
MMPortSerial parent;
|
||||
};
|
||||
|
||||
struct _MMPortSerialAtClass {
|
||||
MMPortSerialClass parent;
|
||||
};
|
||||
|
||||
GType mm_port_serial_at_get_type (void);
|
||||
|
||||
MMPortSerialAt *mm_port_serial_at_new (const char *name);
|
||||
|
||||
void mm_port_serial_at_add_unsolicited_msg_handler (MMPortSerialAt *self,
|
||||
GRegex *regex,
|
||||
MMPortSerialAtUnsolicitedMsgFn callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void mm_port_serial_at_enable_unsolicited_msg_handler (MMPortSerialAt *self,
|
||||
GRegex *regex,
|
||||
gboolean enable);
|
||||
|
||||
void mm_port_serial_at_set_response_parser (MMPortSerialAt *self,
|
||||
MMPortSerialAtResponseParserFn fn,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void mm_port_serial_at_queue_command (MMPortSerialAt *self,
|
||||
const char *command,
|
||||
guint32 timeout_seconds,
|
||||
gboolean is_raw,
|
||||
GCancellable *cancellable,
|
||||
MMPortSerialAtResponseFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_port_serial_at_queue_command_cached (MMPortSerialAt *self,
|
||||
const char *command,
|
||||
guint32 timeout_seconds,
|
||||
gboolean is_raw,
|
||||
GCancellable *cancellable,
|
||||
MMPortSerialAtResponseFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/*
|
||||
* Convert a string into a quoted and escaped string. Returns a new
|
||||
* allocated string. Follows ITU V.250 5.4.2.2 "String constants".
|
||||
*/
|
||||
gchar *mm_port_serial_at_quote_string (const char *string);
|
||||
|
||||
/* Just for unit tests */
|
||||
void mm_port_serial_at_remove_echo (GByteArray *response);
|
||||
|
||||
void mm_port_serial_at_set_flags (MMPortSerialAt *self,
|
||||
MMPortSerialAtFlag flags);
|
||||
|
||||
MMPortSerialAtFlag mm_port_serial_at_get_flags (MMPortSerialAt *self);
|
||||
|
||||
/* Tell the port to run its init sequence, if any, right away */
|
||||
void mm_port_serial_at_run_init_sequence (MMPortSerialAt *self);
|
||||
|
||||
#endif /* MM_PORT_SERIAL_AT_H */
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-port-serial-at.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -56,7 +56,7 @@ at_serial_echo_removal (void)
|
||||
(guint8 *)echo_removal_tests[i].original,
|
||||
strlen (echo_removal_tests[i].original) + 1);
|
||||
|
||||
mm_at_serial_port_remove_echo (ba);
|
||||
mm_port_serial_at_remove_echo (ba);
|
||||
|
||||
g_assert_cmpstr ((gchar *)ba->data, ==, echo_removal_tests[i].without_echo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user