Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[connman] Renamed jolla-gps -> sailfish_gps
For consistency.
  • Loading branch information
monich committed Mar 17, 2017
1 parent 207ac78 commit 14cfdef
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 165 deletions.
6 changes: 3 additions & 3 deletions connman/Makefile.plugins
Expand Up @@ -50,9 +50,9 @@ plugins_hh2serial_gps_la_LDFLAGS = $(plugin_ldflags)
endif
endif

if JOLLA_GPS
builtin_modules += jolla_gps
builtin_sources += plugins/jolla-gps.c
if SAILFISH_GPS
builtin_modules += sailfish_gps
builtin_sources += plugins/sailfish_gps.c
endif

if SAILFISH_ACCESS
Expand Down
9 changes: 5 additions & 4 deletions connman/configure.ac
Expand Up @@ -65,10 +65,11 @@ AC_ARG_ENABLE(hh2serial-gps,
AM_CONDITIONAL(HH2SERIAL_GPS, test "${enable_hh2serial_gps}" != "no")
AM_CONDITIONAL(HH2SERIAL_GPS_BUILTIN, test "${enable_hh2serial_gps}" = "builtin")

AC_ARG_ENABLE(jolla-gps,
AC_HELP_STRING([--enable-jolla-gps], [enable jolla GPS support]),
[enable_jolla_gps=${enableval}], [enable_jolla_gps="no"])
AM_CONDITIONAL(JOLLA_GPS, test "${enable_jolla_gps}" != "no")
AC_ARG_ENABLE(sailfish-gps,
AC_HELP_STRING([--enable-sailfish-gps], [enable Sailfish GPS support]),
[enable_sailfish_gps=${enableval}],
[enable_sailfish_gps="no"])
AM_CONDITIONAL(SAILFISH_GPS, test "${enable_sailfish_gps}" != "no")

AC_ARG_ENABLE(sailfish_wakeup_timer,
AC_HELP_STRING([--enable-sailfish-wakeup-timer],
Expand Down
156 changes: 0 additions & 156 deletions connman/plugins/jolla-gps.c

This file was deleted.

148 changes: 148 additions & 0 deletions connman/plugins/sailfish_gps.c
@@ -0,0 +1,148 @@
/*
* Connection Manager
*
* Copyright (C) 2014-2017 Jolla Ltd.
* Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <glib.h>
#include <errno.h>

#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <connman/plugin.h>
#include <connman/technology.h>
#include <connman/device.h>
#include <connman/log.h>

/* This plugin allows Flight Mode to toggle GPS powered/enablement */

static struct connman_device *sailfish_gps_device;

static int sailfish_gps_enable(struct connman_device *device)
{
(void)device;

DBG("");

connman_device_set_powered(sailfish_gps_device, TRUE);
return 0;
}

static int sailfish_gps_disable(struct connman_device *device)
{
(void)device;

DBG("");

connman_device_set_powered(sailfish_gps_device, FALSE);
return 0;
}

static int sailfish_gps_probe(struct connman_device *device)
{
(void)device;

DBG("");

return 0;
}

static void sailfish_gps_remove(struct connman_device *device)
{
(void)device;

DBG("");
}

static struct connman_device_driver device_driver = {
.name = "gps",
.type = CONNMAN_DEVICE_TYPE_GPS,
.probe = sailfish_gps_probe,
.remove = sailfish_gps_remove,
.enable = sailfish_gps_enable,
.disable = sailfish_gps_disable
};

static int sailfish_gps_tech_probe(struct connman_technology *technology)
{
(void)technology;

DBG("");

return 0;
}

static void sailfish_gps_tech_remove(struct connman_technology *technology)
{
(void)technology;

DBG("");
}

static struct connman_technology_driver tech_driver = {
.name = "gps",
.type = CONNMAN_SERVICE_TYPE_GPS,
.probe = sailfish_gps_tech_probe,
.remove = sailfish_gps_tech_remove,
};

static int sailfish_gps_init()
{
DBG("");

/* These calls never actually fail */
connman_technology_driver_register(&tech_driver);
connman_device_driver_register(&device_driver);
sailfish_gps_device = connman_device_create(device_driver.name,
device_driver.type);

/* This one may, in theory */
if (connman_device_register(sailfish_gps_device) < 0) {
connman_warn("Failed to register GPS device");
connman_device_unref(sailfish_gps_device);
sailfish_gps_device = NULL;
return -EIO;
}

return 0;
}

static void sailfish_gps_exit()
{
DBG("");

if (sailfish_gps_device) {
connman_device_unregister(sailfish_gps_device);
connman_device_unref(sailfish_gps_device);
sailfish_gps_device = NULL;
}

connman_device_driver_unregister(&device_driver);
connman_technology_driver_unregister(&tech_driver);
}

CONNMAN_PLUGIN_DEFINE(sailfish_gps, "Sailfish GPS", VERSION,
CONNMAN_PLUGIN_PRIORITY_DEFAULT,
sailfish_gps_init, sailfish_gps_exit)

/*
* Local Variables:
* mode: C
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*/
4 changes: 2 additions & 2 deletions rpm/connman.spec
Expand Up @@ -121,10 +121,10 @@ Documentation for connman.
--enable-pptp=builtin \
--enable-loopback=builtin \
--enable-pacrunner=builtin \
--enable-jolla-gps=builtin \
--enable-sailfish-wakeup-timer=builtin \
--enable-client \
--enable-test \
--enable-sailfish-gps \
--enable-sailfish-wakeup-timer \
--enable-sailfish-debuglog \
--enable-sailfish-ofono \
--enable-sailfish-usb-tethering \
Expand Down

0 comments on commit 14cfdef

Please sign in to comment.