ports: rename 'MMGpsSerialPort' to 'MMPortSerialGps'
This commit is contained in:
@@ -463,7 +463,7 @@ gps_disabled_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
{
|
||||
MMGpsSerialPort *gps_port;
|
||||
MMPortSerialGps *gps_port;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (self, res, &error))
|
||||
@@ -556,7 +556,7 @@ gps_enabled_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
EnableLocationGatheringContext *ctx)
|
||||
{
|
||||
MMGpsSerialPort *gps_port;
|
||||
MMPortSerialGps *gps_port;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (self, res, &error)) {
|
||||
@@ -654,7 +654,7 @@ enable_location_gathering (MMIfaceModemLocation *self,
|
||||
/* Setup ports (Broadband modem class) */
|
||||
|
||||
static void
|
||||
trace_received (MMGpsSerialPort *port,
|
||||
trace_received (MMPortSerialGps *port,
|
||||
const gchar *trace,
|
||||
MMIfaceModemLocation *self)
|
||||
{
|
||||
@@ -686,7 +686,7 @@ static void
|
||||
setup_ports (MMBroadbandModem *self)
|
||||
{
|
||||
MMAtSerialPort *gps_control_port;
|
||||
MMGpsSerialPort *gps_data_port;
|
||||
MMPortSerialGps *gps_data_port;
|
||||
|
||||
/* Call parent's setup ports first always */
|
||||
MM_BROADBAND_MODEM_CLASS (mm_broadband_modem_hso_parent_class)->setup_ports (self);
|
||||
@@ -716,8 +716,8 @@ setup_ports (MMBroadbandModem *self)
|
||||
3, FALSE, FALSE, NULL, NULL, NULL);
|
||||
|
||||
/* Add handler for the NMEA traces */
|
||||
mm_gps_serial_port_add_trace_handler (gps_data_port,
|
||||
(MMGpsSerialTraceFn)trace_received,
|
||||
mm_port_serial_gps_add_trace_handler (gps_data_port,
|
||||
(MMPortSerialGpsTraceFn)trace_received,
|
||||
self,
|
||||
NULL);
|
||||
}
|
||||
|
@@ -92,8 +92,8 @@ libserial_la_SOURCES = \
|
||||
mm-at-serial-port.h \
|
||||
mm-qcdm-serial-port.c \
|
||||
mm-qcdm-serial-port.h \
|
||||
mm-gps-serial-port.c \
|
||||
mm-gps-serial-port.h
|
||||
mm-port-serial-gps.c \
|
||||
mm-port-serial-gps.h
|
||||
|
||||
# Additional QMI support in libserial
|
||||
if WITH_QMI
|
||||
|
@@ -85,7 +85,7 @@ struct _MMBaseModemPrivate {
|
||||
/* GPS-enabled modems will have an AT port for control, and a raw serial
|
||||
* port to receive all GPS traces */
|
||||
MMAtSerialPort *gps_control;
|
||||
MMGpsSerialPort *gps;
|
||||
MMPortSerialGps *gps;
|
||||
|
||||
#if defined WITH_QMI
|
||||
/* QMI ports */
|
||||
@@ -217,7 +217,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
|
||||
mm_at_serial_port_set_flags (MM_AT_SERIAL_PORT (port), at_pflags);
|
||||
} else if (ptype == MM_PORT_TYPE_GPS) {
|
||||
/* Raw GPS port */
|
||||
port = MM_PORT (mm_gps_serial_port_new (name));
|
||||
port = MM_PORT (mm_port_serial_gps_new (name));
|
||||
} else {
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -551,7 +551,7 @@ mm_base_modem_peek_port_gps_control (MMBaseModem *self)
|
||||
return self->priv->gps_control;
|
||||
}
|
||||
|
||||
MMGpsSerialPort *
|
||||
MMPortSerialGps *
|
||||
mm_base_modem_get_port_gps (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -559,7 +559,7 @@ mm_base_modem_get_port_gps (MMBaseModem *self)
|
||||
return (self->priv->gps ? g_object_ref (self->priv->gps) : NULL);
|
||||
}
|
||||
|
||||
MMGpsSerialPort *
|
||||
MMPortSerialGps *
|
||||
mm_base_modem_peek_port_gps (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
@@ -1071,7 +1071,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
MMAtSerialPort *backup_secondary = NULL;
|
||||
MMQcdmSerialPort *qcdm = NULL;
|
||||
MMAtSerialPort *gps_control = NULL;
|
||||
MMGpsSerialPort *gps = NULL;
|
||||
MMPortSerialGps *gps = NULL;
|
||||
MMPort *data_primary = NULL;
|
||||
GList *data = NULL;
|
||||
#if defined WITH_QMI
|
||||
@@ -1157,9 +1157,9 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
break;
|
||||
|
||||
case MM_PORT_TYPE_GPS:
|
||||
g_assert (MM_IS_GPS_SERIAL_PORT (candidate));
|
||||
g_assert (MM_IS_PORT_SERIAL_GPS (candidate));
|
||||
if (!gps)
|
||||
gps = MM_GPS_SERIAL_PORT (candidate);
|
||||
gps = MM_PORT_SERIAL_GPS (candidate);
|
||||
break;
|
||||
|
||||
#if defined WITH_QMI
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "mm-port.h"
|
||||
#include "mm-at-serial-port.h"
|
||||
#include "mm-qcdm-serial-port.h"
|
||||
#include "mm-gps-serial-port.h"
|
||||
#include "mm-port-serial-gps.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-qmi-port.h"
|
||||
@@ -128,7 +128,7 @@ MMAtSerialPort *mm_base_modem_peek_port_primary (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_peek_port_secondary (MMBaseModem *self);
|
||||
MMQcdmSerialPort *mm_base_modem_peek_port_qcdm (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_peek_port_gps_control (MMBaseModem *self);
|
||||
MMGpsSerialPort *mm_base_modem_peek_port_gps (MMBaseModem *self);
|
||||
MMPortSerialGps *mm_base_modem_peek_port_gps (MMBaseModem *self);
|
||||
#if defined WITH_QMI
|
||||
MMQmiPort *mm_base_modem_peek_port_qmi (MMBaseModem *self);
|
||||
MMQmiPort *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
|
||||
@@ -145,7 +145,7 @@ MMAtSerialPort *mm_base_modem_get_port_primary (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_get_port_secondary (MMBaseModem *self);
|
||||
MMQcdmSerialPort *mm_base_modem_get_port_qcdm (MMBaseModem *self);
|
||||
MMAtSerialPort *mm_base_modem_get_port_gps_control (MMBaseModem *self);
|
||||
MMGpsSerialPort *mm_base_modem_get_port_gps (MMBaseModem *self);
|
||||
MMPortSerialGps *mm_base_modem_get_port_gps (MMBaseModem *self);
|
||||
#if defined WITH_QMI
|
||||
MMQmiPort *mm_base_modem_get_port_qmi (MMBaseModem *self);
|
||||
MMQmiPort *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
|
||||
|
@@ -1,57 +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) 2012 - Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#ifndef MM_GPS_SERIAL_PORT_H
|
||||
#define MM_GPS_SERIAL_PORT_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-port-serial.h"
|
||||
|
||||
#define MM_TYPE_GPS_SERIAL_PORT (mm_gps_serial_port_get_type ())
|
||||
#define MM_GPS_SERIAL_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_GPS_SERIAL_PORT, MMGpsSerialPort))
|
||||
#define MM_GPS_SERIAL_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_GPS_SERIAL_PORT, MMGpsSerialPortClass))
|
||||
#define MM_IS_GPS_SERIAL_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_GPS_SERIAL_PORT))
|
||||
#define MM_IS_GPS_SERIAL_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_GPS_SERIAL_PORT))
|
||||
#define MM_GPS_SERIAL_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_GPS_SERIAL_PORT, MMGpsSerialPortClass))
|
||||
|
||||
typedef struct _MMGpsSerialPort MMGpsSerialPort;
|
||||
typedef struct _MMGpsSerialPortClass MMGpsSerialPortClass;
|
||||
typedef struct _MMGpsSerialPortPrivate MMGpsSerialPortPrivate;
|
||||
|
||||
typedef void (*MMGpsSerialTraceFn) (MMGpsSerialPort *port,
|
||||
const gchar *trace,
|
||||
gpointer user_data);
|
||||
|
||||
struct _MMGpsSerialPort {
|
||||
MMPortSerial parent;
|
||||
MMGpsSerialPortPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MMGpsSerialPortClass {
|
||||
MMPortSerialClass parent;
|
||||
};
|
||||
|
||||
GType mm_gps_serial_port_get_type (void);
|
||||
|
||||
MMGpsSerialPort *mm_gps_serial_port_new (const char *name);
|
||||
|
||||
void mm_gps_serial_port_add_trace_handler (MMGpsSerialPort *self,
|
||||
MMGpsSerialTraceFn callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
#endif /* MM_GPS_SERIAL_PORT_H */
|
@@ -18,14 +18,14 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mm-gps-serial-port.h"
|
||||
#include "mm-port-serial-gps.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
G_DEFINE_TYPE (MMGpsSerialPort, mm_gps_serial_port, MM_TYPE_PORT_SERIAL)
|
||||
G_DEFINE_TYPE (MMPortSerialGps, mm_port_serial_gps, MM_TYPE_PORT_SERIAL)
|
||||
|
||||
struct _MMGpsSerialPortPrivate {
|
||||
struct _MMPortSerialGpsPrivate {
|
||||
/* Trace handler data */
|
||||
MMGpsSerialTraceFn callback;
|
||||
MMPortSerialGpsTraceFn callback;
|
||||
gpointer user_data;
|
||||
GDestroyNotify notify;
|
||||
|
||||
@@ -36,12 +36,12 @@ struct _MMGpsSerialPortPrivate {
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_gps_serial_port_add_trace_handler (MMGpsSerialPort *self,
|
||||
MMGpsSerialTraceFn callback,
|
||||
mm_port_serial_gps_add_trace_handler (MMPortSerialGps *self,
|
||||
MMPortSerialGpsTraceFn callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GPS_SERIAL_PORT (self));
|
||||
g_return_if_fail (MM_IS_PORT_SERIAL_GPS (self));
|
||||
|
||||
if (self->priv->notify)
|
||||
self->priv->notify (self->priv->user_data);
|
||||
@@ -73,7 +73,7 @@ parse_response (MMPortSerial *port,
|
||||
GByteArray *response,
|
||||
GError **error)
|
||||
{
|
||||
MMGpsSerialPort *self = MM_GPS_SERIAL_PORT (port);
|
||||
MMPortSerialGps *self = MM_PORT_SERIAL_GPS (port);
|
||||
gboolean matches;
|
||||
GMatchInfo *match_info;
|
||||
gchar *str;
|
||||
@@ -164,10 +164,10 @@ debug_log (MMPortSerial *port, const char *prefix, const char *buf, gsize len)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMGpsSerialPort *
|
||||
mm_gps_serial_port_new (const char *name)
|
||||
MMPortSerialGps *
|
||||
mm_port_serial_gps_new (const char *name)
|
||||
{
|
||||
return MM_GPS_SERIAL_PORT (g_object_new (MM_TYPE_GPS_SERIAL_PORT,
|
||||
return MM_PORT_SERIAL_GPS (g_object_new (MM_TYPE_PORT_SERIAL_GPS,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_GPS,
|
||||
@@ -175,11 +175,11 @@ mm_gps_serial_port_new (const char *name)
|
||||
}
|
||||
|
||||
static void
|
||||
mm_gps_serial_port_init (MMGpsSerialPort *self)
|
||||
mm_port_serial_gps_init (MMPortSerialGps *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
|
||||
MM_TYPE_GPS_SERIAL_PORT,
|
||||
MMGpsSerialPortPrivate);
|
||||
MM_TYPE_PORT_SERIAL_GPS,
|
||||
MMPortSerialGpsPrivate);
|
||||
|
||||
/* We'll assume that all traces start with the dollar sign and end with \r\n */
|
||||
self->priv->known_traces_regex =
|
||||
@@ -192,23 +192,23 @@ mm_gps_serial_port_init (MMGpsSerialPort *self)
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
MMGpsSerialPort *self = MM_GPS_SERIAL_PORT (object);
|
||||
MMPortSerialGps *self = MM_PORT_SERIAL_GPS (object);
|
||||
|
||||
if (self->priv->notify)
|
||||
self->priv->notify (self->priv->user_data);
|
||||
|
||||
g_regex_unref (self->priv->known_traces_regex);
|
||||
|
||||
G_OBJECT_CLASS (mm_gps_serial_port_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (mm_port_serial_gps_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_gps_serial_port_class_init (MMGpsSerialPortClass *klass)
|
||||
mm_port_serial_gps_class_init (MMPortSerialGpsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
MMPortSerialClass *serial_class = MM_PORT_SERIAL_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (MMGpsSerialPortPrivate));
|
||||
g_type_class_add_private (object_class, sizeof (MMPortSerialGpsPrivate));
|
||||
|
||||
/* Virtual methods */
|
||||
object_class->finalize = finalize;
|
57
src/mm-port-serial-gps.h
Normal file
57
src/mm-port-serial-gps.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2012 - Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#ifndef MM_PORT_SERIAL_GPS_H
|
||||
#define MM_PORT_SERIAL_GPS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-port-serial.h"
|
||||
|
||||
#define MM_TYPE_PORT_SERIAL_GPS (mm_port_serial_gps_get_type ())
|
||||
#define MM_PORT_SERIAL_GPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PORT_SERIAL_GPS, MMPortSerialGps))
|
||||
#define MM_PORT_SERIAL_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PORT_SERIAL_GPS, MMPortSerialGpsClass))
|
||||
#define MM_IS_PORT_SERIAL_GPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PORT_SERIAL_GPS))
|
||||
#define MM_IS_PORT_SERIAL_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PORT_SERIAL_GPS))
|
||||
#define MM_PORT_SERIAL_GPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PORT_SERIAL_GPS, MMPortSerialGpsClass))
|
||||
|
||||
typedef struct _MMPortSerialGps MMPortSerialGps;
|
||||
typedef struct _MMPortSerialGpsClass MMPortSerialGpsClass;
|
||||
typedef struct _MMPortSerialGpsPrivate MMPortSerialGpsPrivate;
|
||||
|
||||
typedef void (*MMPortSerialGpsTraceFn) (MMPortSerialGps *port,
|
||||
const gchar *trace,
|
||||
gpointer user_data);
|
||||
|
||||
struct _MMPortSerialGps {
|
||||
MMPortSerial parent;
|
||||
MMPortSerialGpsPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MMPortSerialGpsClass {
|
||||
MMPortSerialClass parent;
|
||||
};
|
||||
|
||||
GType mm_port_serial_gps_get_type (void);
|
||||
|
||||
MMPortSerialGps *mm_port_serial_gps_new (const char *name);
|
||||
|
||||
void mm_port_serial_gps_add_trace_handler (MMPortSerialGps *self,
|
||||
MMPortSerialGpsTraceFn callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
#endif /* MM_PORT_SERIAL_GPS_H */
|
Reference in New Issue
Block a user