Commit 9231e644 authored by Zeeshan Ali's avatar Zeeshan Ali

Add GClueModem class

Add a new class which is going to be responsible for dealing with
ModemManager for us. This is so that:

* We have ModemManager code isolated from rest of the code so its easy to
  add support for other backends (e.g ofono) in future.

* We have only one entity dealing with modem. In the following patch(es),
  we'll drop GClueModemSource baseclass and, GClueModemGPS and GClue3G
  will just use GClueModem for talking to modem.
  * GClue3G can then derive from GClueWebSource instead and be more
    easily modified to submit cell tower data to Mozilla Location
    Service.
  * GClueModemGPS can be easily generalized so that it can be more easily
    modifed to talk to standalone GPS devices too in future (we'll
    probably want to change it's name to GClueGPS then).
parent c7b07436
......@@ -92,7 +92,7 @@ libgeoclue_la_SOURCES = \
$(NULL)
if BUILD_MODEM_SOURCE
libgeoclue_la_SOURCES += gclue-modem-source.c gclue-modem-source.h
libgeoclue_la_SOURCES += gclue-modem-source.c gclue-modem-source.h gclue-modem.c gclue-modem.h
endif
if BUILD_3G_SOURCE
......
This diff is collapsed.
/* vim: set et ts=8 sw=8: */
/*
* Copyright (C) 2014 Red Hat, Inc.
*
* Geoclue 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.
*
* Geoclue 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.
*
* You should have received a copy of the GNU General Public License along
* with Geoclue; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
*/
#ifndef GCLUE_MODEM_H
#define GCLUE_MODEM_H
#include <gio/gio.h>
G_BEGIN_DECLS
GType gclue_modem_get_type (void) G_GNUC_CONST;
#define GCLUE_TYPE_MODEM (gclue_modem_get_type ())
#define GCLUE_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCLUE_TYPE_MODEM, GClueModem))
#define GCLUE_IS_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCLUE_TYPE_MODEM))
#define GCLUE_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCLUE_TYPE_MODEM, GClueModemClass))
#define GCLUE_IS_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCLUE_TYPE_MODEM))
#define GCLUE_MODEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCLUE_TYPE_MODEM, GClueModemClass))
/**
* GClueModem:
*
* All the fields in the #GClueModem structure are private and should never be accessed directly.
**/
typedef struct _GClueModem GClueModem;
typedef struct _GClueModemClass GClueModemClass;
typedef struct _GClueModemPrivate GClueModemPrivate;
struct _GClueModem {
/* <private> */
GObject parent_instance;
GClueModemPrivate *priv;
};
/**
* GClueModemClass:
*
* All the fields in the #GClueModemClass structure are private and should never be accessed directly.
**/
struct _GClueModemClass {
/* <private> */
GObjectClass parent_class;
};
GClueModem * gclue_modem_get_singleton (void);
gboolean gclue_modem_get_is_3g_available (GClueModem *modem);
gboolean gclue_modem_get_is_gps_available (GClueModem *modem);
void gclue_modem_enable_3g (GClueModem *modem,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean gclue_modem_enable_3g_finish (GClueModem *modem,
GAsyncResult *result,
GError **error);
void gclue_modem_enable_gps (GClueModem *modem,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean gclue_modem_enable_gps_finish (GClueModem *modem,
GAsyncResult *result,
GError **error);
gboolean gclue_modem_disable_3g (GClueModem *modem,
GCancellable *cancellable,
GError **error);
gboolean gclue_modem_disable_gps (GClueModem *modem,
GCancellable *cancellable,
GError **error);
G_END_DECLS
#endif /* GCLUE_MODEM_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment