* [PATCH v2 0/9] Add GPS atom
@ 2011-01-11 3:23 Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 1/9] gps: define new dbus interface Rafael Ignacio Zurita
` (8 more replies)
0 siblings, 9 replies; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1805 bytes --]
These patches add GPS atom to ofono, and implement it for mbm modem.
Changes since V1:
- renamed ofono gps interface ".Gps" to "LocationReporting"
- split set_gps method (in ofono_gps_driver) into enable and disable
methods
- additional information is sent by enable method to the core :
device node and type
- dropped query_gps which is not needed anymore
- changed the port used by the gps driver to the proper one (dev port)
- additional properties is emitted once Powered=True inside a
Settings dictionary
Rafael Ignacio Zurita (9):
gps: define new dbus interface
gps: add new interface to feature map
gps: add public header
gps: implement interface/atom
mbmmodem: add gps atom
plugins: add gps atom to mbm
plugins/udev.c: add gps comparison for add_mbm registered modem
gps: add test scripts
gps: add documentation
Makefile.am | 13 +-
doc/gps-api.txt | 54 ++++++
drivers/mbmmodem/gps.c | 229 +++++++++++++++++++++++++
drivers/mbmmodem/mbmmodem.c | 2 +
drivers/mbmmodem/mbmmodem.h | 3 +
include/dbus.h | 1 +
include/gps.h | 74 ++++++++
plugins/mbm.c | 8 +
plugins/udev.c | 5 +-
src/gps.c | 389 +++++++++++++++++++++++++++++++++++++++++++
src/modem.c | 1 +
src/ofono.h | 2 +
test/disable-gps | 20 +++
test/enable-gps | 20 +++
14 files changed, 814 insertions(+), 7 deletions(-)
create mode 100644 doc/gps-api.txt
create mode 100644 drivers/mbmmodem/gps.c
create mode 100644 include/gps.h
create mode 100644 src/gps.c
create mode 100755 test/disable-gps
create mode 100755 test/enable-gps
--
1.7.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/9] gps: define new dbus interface
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-13 17:11 ` Denis Kenzior
2011-01-11 3:23 ` [PATCH v2 2/9] gps: add new interface to feature map Rafael Ignacio Zurita
` (7 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 641 bytes --]
---
include/dbus.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/dbus.h b/include/dbus.h
index 12768f6..fb85771 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -54,6 +54,7 @@ extern "C" {
#define OFONO_VOICECALL_MANAGER_INTERFACE "org.ofono.VoiceCallManager"
#define OFONO_STK_INTERFACE OFONO_SERVICE ".SimToolkit"
#define OFONO_SIM_APP_INTERFACE OFONO_SERVICE ".SimToolkitAgent"
+#define OFONO_LOCATION_REPORTING_INTERFACE OFONO_SERVICE ".LocationReporting"
/* CDMA Interfaces */
#define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE "org.ofono.cdma.VoiceCallManager"
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/9] gps: add new interface to feature map
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 1/9] gps: define new dbus interface Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-13 17:11 ` Denis Kenzior
2011-01-11 3:23 ` [PATCH v2 3/9] gps: add public header Rafael Ignacio Zurita
` (6 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
---
src/modem.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 953d6c3..d579a30 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -1077,6 +1077,7 @@ static const struct {
{ OFONO_STK_INTERFACE, "stk" },
{ OFONO_CONNECTION_MANAGER_INTERFACE, "gprs" },
{ OFONO_TEXT_TELEPHONY_INTERFACE, "tty" },
+ { OFONO_LOCATION_REPORTING_INTERFACE, "gps" },
{ },
};
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 3/9] gps: add public header
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 1/9] gps: define new dbus interface Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 2/9] gps: add new interface to feature map Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-13 17:33 ` Denis Kenzior
2011-01-11 3:23 ` [PATCH v2 4/9] gps: implement interface/atom Rafael Ignacio Zurita
` (5 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3152 bytes --]
---
Makefile.am | 2 +-
include/gps.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 1 deletions(-)
create mode 100644 include/gps.h
diff --git a/Makefile.am b/Makefile.am
index b509757..70e65f0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ include_HEADERS = include/log.h include/plugin.h include/history.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
- include/cdma-sms.h
+ include/cdma-sms.h include/gps.h
nodist_include_HEADERS = include/version.h
diff --git a/include/gps.h b/include/gps.h
new file mode 100644
index 0000000..606a7e7
--- /dev/null
+++ b/include/gps.h
@@ -0,0 +1,74 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2010 ProFUSION embedded systems.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __OFONO_GPS_H
+#define __OFONO_GPS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <ofono/types.h>
+
+struct ofono_gps;
+
+enum ofono_gps_device_type {
+ OFONO_GPS_DEVICE_TYPE_NMEA = 0,
+};
+
+typedef void (*ofono_gps_enable_cb_t)(const struct ofono_error *error,
+ enum ofono_gps_device_type type,
+ const char *device,
+ void *data);
+typedef void (*ofono_gps_disable_cb_t)(const struct ofono_error *error,
+ void *data);
+
+struct ofono_gps_driver {
+ const char *name;
+ int (*probe)(struct ofono_gps *gps, unsigned int vendor, void *data);
+ void (*remove)(struct ofono_gps *gps);
+ void (*enable)(struct ofono_gps *gps,
+ ofono_gps_enable_cb_t cb, void *data);
+ void (*disable)(struct ofono_gps *gps,
+ ofono_gps_disable_cb_t cb, void *data);
+};
+
+int ofono_gps_driver_register(const struct ofono_gps_driver *d);
+void ofono_gps_driver_unregister(const struct ofono_gps_driver *d);
+
+struct ofono_gps *ofono_gps_create(struct ofono_modem *modem,
+ unsigned int vendor, const char *driver,
+ void *data);
+
+void ofono_gps_register(struct ofono_gps *gps);
+void ofono_gps_remove(struct ofono_gps *gps);
+
+void ofono_gps_set_data(struct ofono_gps *gps, void *data);
+void *ofono_gps_get_data(struct ofono_gps *gps);
+
+struct ofono_modem *ofono_gps_get_modem(struct ofono_gps *gps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_GPS_H */
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/9] gps: implement interface/atom
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
` (2 preceding siblings ...)
2011-01-11 3:23 ` [PATCH v2 3/9] gps: add public header Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 5/9] mbmmodem: add gps atom Rafael Ignacio Zurita
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 11434 bytes --]
---
Makefile.am | 2 +-
src/gps.c | 389 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 2 +
3 files changed, 392 insertions(+), 1 deletions(-)
create mode 100644 src/gps.c
diff --git a/Makefile.am b/Makefile.am
index 70e65f0..d5029d5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -334,7 +334,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
- src/cdma-voicecall.c
+ src/cdma-voicecall.c src/gps.c
src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
diff --git a/src/gps.c b/src/gps.c
new file mode 100644
index 0000000..fde2703
--- /dev/null
+++ b/src/gps.c
@@ -0,0 +1,389 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2010 Intel Corporation. All rights reserved.
+ * Copyright (C) 2010 ProFUSION embedded systems.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <glib.h>
+#include <gdbus.h>
+
+#include "ofono.h"
+#include "common.h"
+
+static GSList *g_drivers = NULL;
+
+struct gps_settings {
+ enum ofono_gps_device_type type;
+ char *device;
+};
+
+struct ofono_gps {
+ DBusMessage *pending;
+ ofono_bool_t powered;
+ const struct ofono_gps_driver *driver;
+ void *driver_data;
+ struct ofono_atom *atom;
+ struct gps_settings settings;
+};
+
+static const char *gps_settings_type_to_string(enum ofono_gps_device_type type)
+{
+ switch (type) {
+ case OFONO_GPS_DEVICE_TYPE_NMEA:
+ return "nmea";
+ };
+
+ return NULL;
+}
+
+static char **gps_get_settings(struct gps_settings *settings)
+{
+ const char *typec = "Type";
+ const char *devicec = "Device";
+ char **ret;
+
+ ret = g_new0(char *, 5);
+
+ ret[0] = g_strdup(typec);
+ ret[1] = g_strdup(gps_settings_type_to_string(settings->type));
+
+ ret[2] = g_strdup(devicec);
+ ret[3] = g_strdup(settings->device);
+
+ return ret;
+}
+
+static DBusMessage *gps_get_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+
+{
+ struct ofono_gps *gps = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ dbus_bool_t value;
+ void **settings_properties;
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ value = gps->powered;
+ ofono_dbus_dict_append(&dict, "Powered", DBUS_TYPE_BOOLEAN, &value);
+
+ settings_properties = (void *)gps_get_settings(&gps->settings);
+ ofono_dbus_dict_append_dict(&dict, "Settings", DBUS_TYPE_STRING,
+ &settings_properties);
+ g_free(settings_properties);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
+static void gps_signal_powered(struct ofono_gps *gps)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(gps->atom);
+ ofono_bool_t value = gps->powered;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_LOCATION_REPORTING_INTERFACE,
+ "Powered",
+ DBUS_TYPE_BOOLEAN, &value);
+}
+
+static void gps_signal_settings(struct ofono_gps *gps)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(gps->atom);
+ void **settings_properties;
+
+ settings_properties = (void *)gps_get_settings(&gps->settings);
+ ofono_dbus_signal_dict_property_changed(conn, path,
+ OFONO_LOCATION_REPORTING_INTERFACE,
+ "Settings", DBUS_TYPE_STRING,
+ &settings_properties);
+ g_free(settings_properties);
+}
+
+static void gps_update_settings(struct ofono_gps *gps,
+ enum ofono_gps_device_type type,
+ const char *dev)
+{
+ gps->settings.type = type;
+ gps->settings.device = g_strdup(dev);
+
+ gps_signal_settings(gps);
+}
+
+static void gps_enable_callback(const struct ofono_error *error,
+ enum ofono_gps_device_type type,
+ const char *device,
+ void *data)
+{
+ struct ofono_gps *gps = data;
+ DBusMessage *reply;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ ofono_error("Powering ON gps failed");
+
+ reply = __ofono_error_failed(gps->pending);
+ __ofono_dbus_pending_reply(&gps->pending, reply);
+
+ return;
+ }
+
+ gps->powered = TRUE;
+
+ reply = dbus_message_new_method_return(gps->pending);
+ __ofono_dbus_pending_reply(&gps->pending, reply);
+
+ gps_update_settings(gps, type, device);
+ gps_signal_powered(gps);
+}
+
+static void gps_disable_callback(const struct ofono_error *error,
+ void *data)
+{
+ struct ofono_gps *gps = data;
+ DBusMessage *reply;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ ofono_error("Powering OFF gps failed");
+
+ reply = __ofono_error_failed(gps->pending);
+ __ofono_dbus_pending_reply(&gps->pending, reply);
+
+ return;
+ }
+
+ gps->powered = FALSE;
+
+ reply = dbus_message_new_method_return(gps->pending);
+ __ofono_dbus_pending_reply(&gps->pending, reply);
+
+ if (gps->settings.device != NULL) {
+ g_free(gps->settings.device);
+ gps->settings.device = NULL;
+ }
+
+ gps_signal_powered(gps);
+}
+
+static DBusMessage *gps_set_property(DBusConnection *conn, DBusMessage *msg,
+ void *data)
+{
+ struct ofono_gps *gps = data;
+ DBusMessageIter iter;
+ DBusMessageIter var;
+ const char *property;
+
+ if (gps->pending)
+ return __ofono_error_busy(msg);
+
+ if (!dbus_message_iter_init(msg, &iter))
+ return __ofono_error_invalid_args(msg);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&iter, &property);
+ dbus_message_iter_next(&iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_recurse(&iter, &var);
+
+ if (g_strcmp0(property, "Powered") == 0) {
+ dbus_bool_t value;
+ int target;
+
+ if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&var, &value);
+ target = value;
+
+ if (gps->powered == target)
+ return dbus_message_new_method_return(msg);
+
+ gps->pending = dbus_message_ref(msg);
+
+ if (value == TRUE)
+ gps->driver->enable(gps, gps_enable_callback, gps);
+ else
+ gps->driver->disable(gps, gps_disable_callback, gps);
+
+ return NULL;
+ }
+
+ return __ofono_error_invalid_args(msg);
+}
+
+static GDBusMethodTable gps_methods[] = {
+ { "GetProperties", "", "a{sv}", gps_get_properties,
+ G_DBUS_METHOD_FLAG_ASYNC },
+ { "SetProperty", "sv", "", gps_set_property,
+ G_DBUS_METHOD_FLAG_ASYNC },
+ { }
+};
+
+static GDBusSignalTable gps_signals[] = {
+ { "PropertyChanged", "sv" },
+ { }
+};
+
+int ofono_gps_driver_register(const struct ofono_gps_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ if (d == NULL || d->probe == NULL)
+ return -EINVAL;
+
+ g_drivers = g_slist_prepend(g_drivers, (void *) d);
+
+ return 0;
+}
+
+void ofono_gps_driver_unregister(const struct ofono_gps_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ if (d == NULL)
+ return;
+
+ g_drivers = g_slist_remove(g_drivers, (void *) d);
+}
+
+struct ofono_modem *ofono_gps_get_modem(struct ofono_gps *g)
+{
+ return __ofono_atom_get_modem(g->atom);
+}
+
+static void gps_unregister(struct ofono_atom *atom)
+{
+ struct ofono_gps *gps = __ofono_atom_get_data(atom);
+ const char *path = __ofono_atom_get_path(gps->atom);
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(gps->atom);
+
+ ofono_modem_remove_interface(modem, OFONO_LOCATION_REPORTING_INTERFACE);
+ g_dbus_unregister_interface(conn, path,
+ OFONO_LOCATION_REPORTING_INTERFACE);
+}
+
+static void gps_remove(struct ofono_atom *atom)
+{
+ struct ofono_gps *gps = __ofono_atom_get_data(atom);
+
+ DBG("atom: %p", atom);
+
+ if (gps == NULL)
+ return;
+
+ if (gps->driver && gps->driver->remove)
+ gps->driver->remove(gps);
+
+ g_free(gps);
+}
+
+struct ofono_gps *ofono_gps_create(struct ofono_modem *modem,
+ unsigned int vendor,
+ const char *driver, void *data)
+{
+ struct ofono_gps *gps;
+ GSList *l;
+
+ if (driver == NULL)
+ return NULL;
+
+ gps = g_try_new0(struct ofono_gps, 1);
+ if (gps == NULL)
+ return NULL;
+
+ gps->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_GPS,
+ gps_remove, gps);
+
+ for (l = g_drivers; l; l = l->next) {
+ const struct ofono_gps_driver *drv = l->data;
+
+ if (g_strcmp0(drv->name, driver) != 0)
+ continue;
+
+ if (drv->probe(gps, vendor, data) < 0)
+ continue;
+
+ gps->driver = drv;
+ break;
+ }
+
+ return gps;
+}
+
+void ofono_gps_register(struct ofono_gps *gps)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(gps->atom);
+ const char *path = __ofono_atom_get_path(gps->atom);
+
+ if (!g_dbus_register_interface(conn, path,
+ OFONO_LOCATION_REPORTING_INTERFACE,
+ gps_methods, gps_signals, NULL, gps,
+ NULL)) {
+ ofono_error("Could not create %s interface",
+ OFONO_LOCATION_REPORTING_INTERFACE);
+
+ return;
+ }
+
+ ofono_modem_add_interface(modem, OFONO_LOCATION_REPORTING_INTERFACE);
+ __ofono_atom_register(gps->atom, gps_unregister);
+}
+
+void ofono_gps_remove(struct ofono_gps *gps)
+{
+ __ofono_atom_free(gps->atom);
+}
+
+void ofono_gps_set_data(struct ofono_gps *gps,
+ void *data)
+{
+ gps->driver_data = data;
+}
+
+void *ofono_gps_get_data(struct ofono_gps *gps)
+{
+ return gps->driver_data;
+}
diff --git a/src/ofono.h b/src/ofono.h
index cab70cd..e60140f 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -127,6 +127,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_NETTIME = 21,
OFONO_ATOM_TYPE_CTM = 22,
OFONO_ATOM_TYPE_CDMA_VOICECALL_MANAGER = 23,
+ OFONO_ATOM_TYPE_GPS = 24,
};
enum ofono_atom_watch_condition {
@@ -208,6 +209,7 @@ gboolean __ofono_call_settings_is_busy(struct ofono_call_settings *cs);
#include <ofono/radio-settings.h>
#include <ofono/audio-settings.h>
#include <ofono/ctm.h>
+#include <ofono/gps.h>
#include <ofono/voicecall.h>
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/9] mbmmodem: add gps atom
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
` (3 preceding siblings ...)
2011-01-11 3:23 ` [PATCH v2 4/9] gps: implement interface/atom Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 6/9] plugins: add gps atom to mbm Rafael Ignacio Zurita
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7249 bytes --]
---
Makefile.am | 3 +-
drivers/mbmmodem/gps.c | 229 +++++++++++++++++++++++++++++++++++++++++++
drivers/mbmmodem/mbmmodem.c | 2 +
drivers/mbmmodem/mbmmodem.h | 3 +
4 files changed, 236 insertions(+), 1 deletions(-)
create mode 100644 drivers/mbmmodem/gps.c
diff --git a/Makefile.am b/Makefile.am
index d5029d5..a41b629 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -205,7 +205,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/mbmmodem/mbmmodem.h \
drivers/mbmmodem/mbmmodem.c \
drivers/mbmmodem/gprs-context.c \
- drivers/mbmmodem/stk.c
+ drivers/mbmmodem/stk.c \
+ drivers/mbmmodem/gps.c
builtin_modules += hsomodem
builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/mbmmodem/gps.c b/drivers/mbmmodem/gps.c
new file mode 100644
index 0000000..0495642
--- /dev/null
+++ b/drivers/mbmmodem/gps.c
@@ -0,0 +1,229 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
+ * Copyright (C) 2010 ProFUSION embedded systems.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/gps.h>
+
+#include "gatchat.h"
+#include "gatresult.h"
+#include "gattty.h"
+
+#include "mbmmodem.h"
+
+static const char *none_prefix[] = { NULL };
+static const char *e2gpsctl_prefix[] = { "*E2GPSCTL:", NULL };
+
+struct gps_data {
+ GAtChat *chat;
+};
+
+struct e2gpsnpd_data {
+ GIOChannel *channel;
+ GAtChat *chat;
+};
+
+static void mbm_e2gpsctl_disable_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_gps_disable_cb_t cb = cbd->cb;
+ struct ofono_error error;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+ cb(&error, cbd->data);
+}
+
+static void mbm_gps_disable(struct ofono_gps *g,
+ ofono_gps_disable_cb_t cb,
+ void *data)
+{
+ struct gps_data *gd = ofono_gps_get_data(g);
+ struct cb_data *cbd = cb_data_new(cb, data);
+
+ if (g_at_chat_send(gd->chat, "AT*E2GPSCTL=0,5,1", none_prefix,
+ mbm_e2gpsctl_disable_cb, cbd, g_free) > 0)
+ return;
+
+ /* error */
+ CALLBACK_WITH_FAILURE(cb, data);
+ g_free(cbd);
+}
+
+static void mbm_gps_send_e2gpsnpd_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct e2gpsnpd_data *e2d = user_data;
+
+ g_io_channel_unref(e2d->channel);
+ g_at_chat_unref(e2d->chat);
+}
+
+static void mbm_gps_send_e2gpsnpd(const char *gps_dev)
+{
+ GAtSyntax *syntax;
+ struct e2gpsnpd_data *e2d;
+
+ e2d = g_try_new0(struct e2gpsnpd_data, 1);
+ if (e2d == NULL)
+ return;
+
+ e2d->channel = g_at_tty_open(gps_dev, NULL);
+ if (e2d->channel == NULL)
+ return;
+
+ syntax = g_at_syntax_new_gsm_permissive();
+ e2d->chat = g_at_chat_new(e2d->channel, syntax);
+ g_at_syntax_unref(syntax);
+
+ if (e2d->chat == NULL)
+ return;
+
+ if (g_at_chat_send(e2d->chat, "AT*E2GPSNPD", none_prefix,
+ mbm_gps_send_e2gpsnpd_cb, e2d, g_free) > 0)
+ return;
+
+ g_io_channel_unref(e2d->channel);
+ g_at_chat_unref(e2d->chat);
+ g_free(e2d);
+}
+
+static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ struct ofono_gps *gps = cbd->user;
+ ofono_gps_enable_cb_t cb = cbd->cb;
+ struct ofono_modem *modem;
+ const char *gps_dev;
+
+ if (!ok) {
+ struct ofono_error error;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+ cb(&error, OFONO_GPS_DEVICE_TYPE_NMEA, NULL, cbd->data);
+ return;
+ }
+
+ modem = ofono_gps_get_modem(gps);
+ gps_dev = ofono_modem_get_string(modem, "GPSDevice");
+
+ /* NMEA stream is sent to gps_dev */
+ mbm_gps_send_e2gpsnpd(gps_dev);
+
+ CALLBACK_WITH_SUCCESS(cb, OFONO_GPS_DEVICE_TYPE_NMEA, gps_dev,
+ cbd->data);
+}
+
+static void mbm_gps_enable(struct ofono_gps *g,
+ ofono_gps_enable_cb_t cb,
+ void *data)
+{
+ struct gps_data *gd = ofono_gps_get_data(g);
+ struct cb_data *cbd = cb_data_new(cb, data);
+
+ if (cbd == NULL)
+ goto error;
+
+ cbd->user = g;
+
+ if (g_at_chat_send(gd->chat, "AT*E2GPSCTL=1,5,1", none_prefix,
+ mbm_e2gpsctl_enable_cb, cbd, g_free) > 0)
+ return;
+
+error:
+ CALLBACK_WITH_FAILURE(cb, OFONO_GPS_DEVICE_TYPE_NMEA, NULL, data);
+ g_free(cbd);
+}
+
+static void mbm_gps_support_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct ofono_gps *gps = user_data;
+
+ if (!ok) {
+ ofono_gps_remove(gps);
+ return;
+ }
+
+ ofono_gps_register(gps);
+}
+
+static int mbm_gps_probe(struct ofono_gps *g,
+ unsigned int vendor, void *data)
+{
+ GAtChat *chat = data;
+ struct gps_data *gd;
+
+ gd = g_try_new0(struct gps_data, 1);
+ if (gd == NULL)
+ return -ENOMEM;
+
+ gd->chat = g_at_chat_clone(chat);
+
+ ofono_gps_set_data(g, gd);
+
+ g_at_chat_send(gd->chat, "AT*E2GPSCTL=?", e2gpsctl_prefix,
+ mbm_gps_support_cb, g, NULL);
+
+ return 0;
+}
+
+static void mbm_gps_remove(struct ofono_gps *g)
+{
+ struct gps_data *gd = ofono_gps_get_data(g);
+
+ ofono_gps_set_data(g, NULL);
+
+ g_at_chat_unref(gd->chat);
+ g_free(gd);
+}
+
+static struct ofono_gps_driver driver = {
+ .name = "mbmmodem",
+ .probe = mbm_gps_probe,
+ .remove = mbm_gps_remove,
+ .enable = mbm_gps_enable,
+ .disable = mbm_gps_disable,
+};
+
+void mbm_gps_init()
+{
+ ofono_gps_driver_register(&driver);
+}
+
+void mbm_gps_exit()
+{
+ ofono_gps_driver_unregister(&driver);
+}
diff --git a/drivers/mbmmodem/mbmmodem.c b/drivers/mbmmodem/mbmmodem.c
index 03b61b3..ea56cd4 100644
--- a/drivers/mbmmodem/mbmmodem.c
+++ b/drivers/mbmmodem/mbmmodem.c
@@ -36,12 +36,14 @@ static int mbmmodem_init(void)
{
mbm_gprs_context_init();
mbm_stk_init();
+ mbm_gps_init();
return 0;
}
static void mbmmodem_exit(void)
{
+ mbm_gps_exit();
mbm_stk_exit();
mbm_gprs_context_exit();
}
diff --git a/drivers/mbmmodem/mbmmodem.h b/drivers/mbmmodem/mbmmodem.h
index 65786d7..d1e96fa 100644
--- a/drivers/mbmmodem/mbmmodem.h
+++ b/drivers/mbmmodem/mbmmodem.h
@@ -26,3 +26,6 @@ extern void mbm_gprs_context_exit();
extern void mbm_stk_init();
extern void mbm_stk_exit();
+
+extern void mbm_gps_init();
+extern void mbm_gps_exit();
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 6/9] plugins: add gps atom to mbm
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
` (4 preceding siblings ...)
2011-01-11 3:23 ` [PATCH v2 5/9] mbmmodem: add gps atom Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 7/9] plugins/udev.c: add gps comparison for add_mbm registered modem Rafael Ignacio Zurita
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
---
plugins/mbm.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/plugins/mbm.c b/plugins/mbm.c
index dca9bd8..7ab3406 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -45,6 +45,7 @@
#include <ofono/gprs.h>
#include <ofono/gprs-context.h>
#include <ofono/log.h>
+#include <ofono/gps.h>
#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
@@ -66,6 +67,7 @@ struct mbm_data {
gboolean have_sim;
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+ struct ofono_gps *gps;
guint reopen_source;
enum mbm_variant variant;
};
@@ -502,9 +504,15 @@ static void mbm_post_online(struct ofono_modem *modem)
{
struct mbm_data *data = ofono_modem_get_data(modem);
struct ofono_gprs_context *gc;
+ const char *gps_dev;
DBG("%p", modem);
+ gps_dev = ofono_modem_get_string(modem, "GPSDevice");
+ if (gps_dev)
+ data->gps = ofono_gps_create(modem, 0,
+ "mbmmodem", data->modem_port);
+
ofono_netreg_create(modem, OFONO_VENDOR_MBM,
"atmodem", data->modem_port);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 7/9] plugins/udev.c: add gps comparison for add_mbm registered modem
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
` (5 preceding siblings ...)
2011-01-11 3:23 ` [PATCH v2 6/9] plugins: add gps atom to mbm Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 8/9] gps: add test scripts Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 9/9] gps: add documentation Rafael Ignacio Zurita
8 siblings, 0 replies; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
---
plugins/udev.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/udev.c b/plugins/udev.c
index e502669..4c928ab 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -105,7 +105,7 @@ static void add_mbm(struct ofono_modem *modem,
struct udev_device *udev_device)
{
const char *desc, *devnode;
- const char *device, *data, *network;
+ const char *device, *data, *network, *gps;
int registered;
desc = udev_device_get_sysattr_value(udev_device, "device/interface");
@@ -152,8 +152,9 @@ static void add_mbm(struct ofono_modem *modem,
device = ofono_modem_get_string(modem, MODEM_DEVICE);
data = ofono_modem_get_string(modem, DATA_DEVICE);
network = ofono_modem_get_string(modem, NETWORK_INTERFACE);
+ gps = ofono_modem_get_string(modem, GPS_DEVICE);
- if (device != NULL && data != NULL && network != NULL) {
+ if (device != NULL && data != NULL && network != NULL && gps != NULL) {
ofono_modem_set_integer(modem, "Registered", 1);
ofono_modem_register(modem);
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 8/9] gps: add test scripts
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
` (6 preceding siblings ...)
2011-01-11 3:23 ` [PATCH v2 7/9] plugins/udev.c: add gps comparison for add_mbm registered modem Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 9/9] gps: add documentation Rafael Ignacio Zurita
8 siblings, 0 replies; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]
---
Makefile.am | 4 +++-
test/disable-gps | 20 ++++++++++++++++++++
test/enable-gps | 20 ++++++++++++++++++++
3 files changed, 43 insertions(+), 1 deletions(-)
create mode 100755 test/disable-gps
create mode 100755 test/enable-gps
diff --git a/Makefile.am b/Makefile.am
index a41b629..3352f24 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -444,7 +444,9 @@ test_scripts = test/backtrace \
test/set-tty \
test/set-gsm-band \
test/set-umts-band \
- test/lockdown-modem
+ test/lockdown-modem \
+ test/enable-gps \
+ test/disable-gps
if TEST
testdir = $(pkglibdir)/test
diff --git a/test/disable-gps b/test/disable-gps
new file mode 100755
index 0000000..adb6ba5
--- /dev/null
+++ b/test/disable-gps
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+ path = sys.argv[1]
+else:
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+ modems = manager.GetModems()
+ path = modems[0][0]
+
+print "Powering OFF the GPS on modem %s..." % path
+gps = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.LocationReporting')
+
+gps.SetProperty("Powered", dbus.Boolean(0))
diff --git a/test/enable-gps b/test/enable-gps
new file mode 100755
index 0000000..e70eb2b
--- /dev/null
+++ b/test/enable-gps
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+ path = sys.argv[1]
+else:
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+ modems = manager.GetModems()
+ path = modems[0][0]
+
+print "Powering ON the GPS for modem %s..." % path
+gps = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.LocationReporting')
+
+gps.SetProperty("Powered", dbus.Boolean(1))
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 9/9] gps: add documentation
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
` (7 preceding siblings ...)
2011-01-11 3:23 ` [PATCH v2 8/9] gps: add test scripts Rafael Ignacio Zurita
@ 2011-01-11 3:23 ` Rafael Ignacio Zurita
2011-01-13 17:30 ` Denis Kenzior
8 siblings, 1 reply; 14+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-11 3:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2339 bytes --]
---
Makefile.am | 2 +-
doc/gps-api.txt | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletions(-)
create mode 100644 doc/gps-api.txt
diff --git a/Makefile.am b/Makefile.am
index 3352f24..0b748ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -376,7 +376,7 @@ doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
doc/phonebook-api.txt doc/radio-settings-api.txt \
doc/sim-api.txt doc/stk-api.txt \
doc/audio-settings-api.txt doc/text-telephony-api.txt \
- doc/calypso-modem.txt
+ doc/calypso-modem.txt doc/gps-api.txt
test_scripts = test/backtrace \
diff --git a/doc/gps-api.txt b/doc/gps-api.txt
new file mode 100644
index 0000000..9cf9792
--- /dev/null
+++ b/doc/gps-api.txt
@@ -0,0 +1,54 @@
+Location Reporting hierarchy
+=================
+
+Service org.ofono
+Interface org.ofono.LocationReporting
+Object path [variable prefix]/{modem0,modem1,...}
+
+Methods dict GetProperties()
+
+ Returns all Gps properties. See the
+ properties section for available properties.
+
+ Possible Errors: [service].Error.InProgress
+ [service].Error.Failed
+
+ void SetProperty(string name, variant value)
+
+ Changes the value of the specified property. Only
+ properties that are listed as read-write are
+ changeable. On success a PropertyChanged signal
+ will be emitted.
+
+ Possible Errors: [service].Error.InvalidArguments
+ [service].Error.InProgress
+ [service].Error.Failed
+
+Signals PropertyChanged(string property, variant value)
+
+ This signal indicates a changed value of the given
+ property.
+
+Properties boolean Powered [readwrite]
+
+ This property will power or disable the GPS feature in
+ the modem.
+
+ Many modem manufacturers provide a GPS unit with their
+ modem hardware. This unit can be turned on or off and
+ frequently takes over one of the tty ports that the
+ modem provides.
+
+ dict Settings [readonly]
+
+ Holds the location information settings
+
+ string Device [readonly]
+
+ Holds the device from which the location
+ information can be obtained (e.g. "/dev/ttyACM2")
+
+ string Type [readonly]
+
+ Holds the type of the device (e.g. "nmea")
+
--
1.7.2.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/9] gps: define new dbus interface
2011-01-11 3:23 ` [PATCH v2 1/9] gps: define new dbus interface Rafael Ignacio Zurita
@ 2011-01-13 17:11 ` Denis Kenzior
0 siblings, 0 replies; 14+ messages in thread
From: Denis Kenzior @ 2011-01-13 17:11 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 215 bytes --]
Hi Rafael,
On 01/10/2011 09:23 PM, Rafael Ignacio Zurita wrote:
> ---
> include/dbus.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/9] gps: add new interface to feature map
2011-01-11 3:23 ` [PATCH v2 2/9] gps: add new interface to feature map Rafael Ignacio Zurita
@ 2011-01-13 17:11 ` Denis Kenzior
0 siblings, 0 replies; 14+ messages in thread
From: Denis Kenzior @ 2011-01-13 17:11 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 212 bytes --]
Hi Rafael,
On 01/10/2011 09:23 PM, Rafael Ignacio Zurita wrote:
> ---
> src/modem.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 9/9] gps: add documentation
2011-01-11 3:23 ` [PATCH v2 9/9] gps: add documentation Rafael Ignacio Zurita
@ 2011-01-13 17:30 ` Denis Kenzior
0 siblings, 0 replies; 14+ messages in thread
From: Denis Kenzior @ 2011-01-13 17:30 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]
Hi Rafael,
> +Location Reporting hierarchy
> +=================
> +
> +Service org.ofono
> +Interface org.ofono.LocationReporting
> +Object path [variable prefix]/{modem0,modem1,...}
> +
> +Methods dict GetProperties()
> +
> + Returns all Gps properties. See the
> + properties section for available properties.
> +
> + Possible Errors: [service].Error.InProgress
> + [service].Error.Failed
> +
> + void SetProperty(string name, variant value)
> +
> + Changes the value of the specified property. Only
> + properties that are listed as read-write are
> + changeable. On success a PropertyChanged signal
> + will be emitted.
> +
> + Possible Errors: [service].Error.InvalidArguments
> + [service].Error.InProgress
> + [service].Error.Failed
> +
> +Signals PropertyChanged(string property, variant value)
> +
> + This signal indicates a changed value of the given
> + property.
> +
> +Properties boolean Powered [readwrite]
> +
> + This property will power or disable the GPS feature in
> + the modem.
> +
> + Many modem manufacturers provide a GPS unit with their
> + modem hardware. This unit can be turned on or off and
> + frequently takes over one of the tty ports that the
> + modem provides.
So after discussing this some more with Marcel I'd like to change the
API slightly. Instead of using a Powered property, let us use an Agent
with file descriptor passing instead. The flow will roughly go like this:
LocationReporting interface becomes available and the string Type
property is known. An external client registers an Agent with this
interface. Internally this triggers the driver function to bring up the
GPS device and return the file descriptor to the core. The core takes
care of calling the Agent with the file descriptor using DBus FD passing
mechanisms.
Once the remote client receives the file descriptor it can use it to
receive e.g. NMEA data.
Unregistering the agent or if the remote client exits unexpectedly
terminates should close the file descriptor and deactivate the NMEA stream.
> +
> + dict Settings [readonly]
> +
This dictionary is no longer necessary.
> + Holds the location information settings
> +
> + string Device [readonly]
> +
> + Holds the device from which the location
> + information can be obtained (e.g. "/dev/ttyACM2")
> +
This makes this property unnecessary
> + string Type [readonly]
> +
> + Holds the type of the device (e.g. "nmea")
> +
And this property should be moved to a top level property instead of
being inside the Settings dict.
I hope my explanation was pretty clear, if not, find me on IRC.
Regards,
-Denis
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/9] gps: add public header
2011-01-11 3:23 ` [PATCH v2 3/9] gps: add public header Rafael Ignacio Zurita
@ 2011-01-13 17:33 ` Denis Kenzior
0 siblings, 0 replies; 14+ messages in thread
From: Denis Kenzior @ 2011-01-13 17:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
Hi Rafael,
> +
> +#include <ofono/types.h>
> +
> +struct ofono_gps;
> +
> +enum ofono_gps_device_type {
> + OFONO_GPS_DEVICE_TYPE_NMEA = 0,
> +};
> +
> +typedef void (*ofono_gps_enable_cb_t)(const struct ofono_error *error,
> + enum ofono_gps_device_type type,
> + const char *device,
> + void *data);
This function's signature would be modified to receive an int fd instead
of type and device.
> +typedef void (*ofono_gps_disable_cb_t)(const struct ofono_error *error,
> + void *data);
> +
> +struct ofono_gps_driver {
> + const char *name;
This structure should contain enum ofono_gps_device_type type member.
> + int (*probe)(struct ofono_gps *gps, unsigned int vendor, void *data);
> + void (*remove)(struct ofono_gps *gps);
> + void (*enable)(struct ofono_gps *gps,
> + ofono_gps_enable_cb_t cb, void *data);
> + void (*disable)(struct ofono_gps *gps,
> + ofono_gps_disable_cb_t cb, void *data);
> +};
> +
The rest is left more or less as is.
Regards,
-Denis
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-01-13 17:33 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11 3:23 [PATCH v2 0/9] Add GPS atom Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 1/9] gps: define new dbus interface Rafael Ignacio Zurita
2011-01-13 17:11 ` Denis Kenzior
2011-01-11 3:23 ` [PATCH v2 2/9] gps: add new interface to feature map Rafael Ignacio Zurita
2011-01-13 17:11 ` Denis Kenzior
2011-01-11 3:23 ` [PATCH v2 3/9] gps: add public header Rafael Ignacio Zurita
2011-01-13 17:33 ` Denis Kenzior
2011-01-11 3:23 ` [PATCH v2 4/9] gps: implement interface/atom Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 5/9] mbmmodem: add gps atom Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 6/9] plugins: add gps atom to mbm Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 7/9] plugins/udev.c: add gps comparison for add_mbm registered modem Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 8/9] gps: add test scripts Rafael Ignacio Zurita
2011-01-11 3:23 ` [PATCH v2 9/9] gps: add documentation Rafael Ignacio Zurita
2011-01-13 17:30 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.