Skip to contentSkip to conversation

Resubmit Zhenhua Zhang work on DUN server with btio

PATCH In review Frédéric Dalleau 4 participants 29 messages Jan 12, 2011 – Jan 25, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Resubmit Zhenhua Zhang work on DUN server with btio

This is rebased as of head of today

Zhenhua Zhang (21):
bluetooth: Add reference count for bluetooth utils
bluetooth: Add Btio library for DUN
bluetooth: Add bluetooth server support for DUN
emulator: Add emulator atom in oFono
dun_gw: Add DUN server plugin for oFono
gprs: Rename status_watch to netreg_status_watch
emulator: Add status watches for ofono emulator
emulator: Add emulator status watches in gprs atom
emulator: Add APIs to send GAtServer result
emulator: Implement dialing up for DUN
gprs: Make gprs_proto_to/from_string non-static
gprs: ignore the case of proto str when comparing
emulator: Register mandatory AT command handlers
gprs: Refactor to share remove_context method
gprs: Add DUN +CGATT support in gprs atom
gprs: Add DUN +CGDCONT support in gprs atom
gprs: Add DUN server GPRS connect support
gprs: Add status watch functions
gprs: Add gprs_get_status
emulator: Watch GPRS status changes
emulator: Watch netreg status changes

 Makefile.am            |   15 +-
 btio/btio.c            | 1299 ++++++++++++++++++++++++++++++++++++++++++++++++
 btio/btio.h            |   97 ++++
 configure.ac           |    5 +
 include/emulator.h     |   94 ++++
 include/gprs-context.h |    4 +
 include/gprs.h         |   11 +
 plugins/bluetooth.c    |  441 ++++++++++++++++-
 plugins/bluetooth.h    |   15 +
 plugins/dun_gw.c       |  115 +++++
 src/emulator.c         | 1072 +++++++++++++++++++++++++++++++++++++++
 src/gprs.c             |  500 +++++++++++++++++--
 src/modem.c            |    1 +
 src/ofono.h            |   31 ++
 14 files changed, 3636 insertions(+), 64 deletions(-)
 create mode 100644 btio/btio.c
 create mode 100644 btio/btio.h
 create mode 100644 include/emulator.h
 create mode 100644 plugins/dun_gw.c
 create mode 100644 src/emulator.c

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#1 lore raw

PATCH 1/21 bluetooth: Add reference count for bluetooth utils

From: Zhenhua Zhang <[email protected]>

Add bluetooth_ref()/bluetooth_unref() to support reference count in bluetooth utils.

---
 plugins/bluetooth.c |   62 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 45 insertions(+), 17 deletions(-)
plugins/bluetooth.c +45 -17
index 602c6da..fe1eaa9 100644
@@ -40,6 +40,7 @@
 static DBusConnection *connection;
 static GHashTable *uuid_hash = NULL;
 static GHashTable *adapter_address_hash = NULL;
+static gint ref_count;
 
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
 				char *buf, int size)
@@ -504,13 +505,10 @@ static guint adapter_added_watch;
 static guint adapter_removed_watch;
 static guint property_watch;
 
-int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
+static int bluetooth_init()
 {
 	int err;
 
-	if (uuid_hash)
-		goto done;
-
 	connection = ofono_dbus_get_connection();
 
 	bluetooth_watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
@@ -543,13 +541,6 @@ int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
 	adapter_address_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
 						g_free, g_free);
 
-done:
-	g_hash_table_insert(uuid_hash, g_strdup(uuid), profile);
-
-	bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties",
-				manager_properties_cb, NULL, NULL, -1,
-				DBUS_TYPE_INVALID);
-
 	return 0;
 
 remove:
@@ -557,14 +548,27 @@ remove:
 	g_dbus_remove_watch(connection, adapter_added_watch);
 	g_dbus_remove_watch(connection, adapter_removed_watch);
 	g_dbus_remove_watch(connection, property_watch);
+
 	return err;
 }
 
-void bluetooth_unregister_uuid(const char *uuid)
+static int bluetooth_ref()
 {
-	g_hash_table_remove(uuid_hash, uuid);
+	g_atomic_int_inc(&ref_count);
+
+	if (ref_count > 1)
+		return 0;
+
+	return bluetooth_init();
+}
+
+static void bluetooth_unref()
+{
+	gboolean is_zero;
+
+	is_zero = g_atomic_int_dec_and_test(&ref_count);
 
-	if (g_hash_table_size(uuid_hash))
+	if (is_zero == FALSE)
 		return;
 
 	g_dbus_remove_watch(connection, bluetooth_watch);
@@ -572,9 +576,33 @@ void bluetooth_unregister_uuid(const char *uuid)
 	g_dbus_remove_watch(connection, adapter_removed_watch);
 	g_dbus_remove_watch(connection, property_watch);
 
-	g_hash_table_destroy(uuid_hash);
-	g_hash_table_destroy(adapter_address_hash);
-	uuid_hash = NULL;
+	if (uuid_hash)
+		g_hash_table_destroy(uuid_hash);
+
+	if (adapter_address_hash)
+		g_hash_table_destroy(adapter_address_hash);
+}
+
+int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
+{
+	int err = bluetooth_ref();
+
+	if (err != 0)
+		return err;
+
+	g_hash_table_insert(uuid_hash, g_strdup(uuid), profile);
+
+	bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties",
+				manager_properties_cb, NULL, NULL, -1,
+				DBUS_TYPE_INVALID);
+	return 0;
+}
+
+void bluetooth_unregister_uuid(const char *uuid)
+{
+	g_hash_table_remove(uuid_hash, uuid);
+
+	bluetooth_unref();
 }
 
 OFONO_PLUGIN_DEFINE(bluetooth, "Bluetooth Utils Plugins", VERSION,
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#2 lore raw

PATCH 2/21 bluetooth: Add Btio library for DUN

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Btio library is the low level socket API for BT RFCOMM connection. We share the same library among BlueZ, Obex and oFono. So make sure you synchronize to other two projects when you make changes to btio.[ch].

---
 Makefile.am  |    8 +-
 btio/btio.c  | 1299 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 btio/btio.h  |   97 +++++
 configure.ac |    5 +
 4 files changed, 1407 insertions(+), 2 deletions(-)
 create mode 100644 btio/btio.c
 create mode 100644 btio/btio.h
Makefile.am +6 -2
index 4dec90a..2a9f340 100644
@@ -82,6 +82,8 @@ gisi_sources = gisi/client.c gisi/client.h gisi/common.h \
 				gisi/server.c gisi/server.h \
 				gisi/socket.c gisi/socket.h
 
+btio_sources = btio/btio.h btio/btio.c
+
 udev_files = plugins/ofono.rules
 
 if UDEV
@@ -342,7 +344,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
 			src/smsagent.c src/smsagent.h src/ctm.c \
 			src/cdma-voicecall.c
 
-src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
+src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \
+			@BLUEZ_LIBS@ -ldl
 
 src_ofonod_LDFLAGS = -Wl,--export-dynamic \
 				-Wl,--version-script=$(srcdir)/src/ofono.ver
@@ -365,7 +368,8 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ @USB_CFLAGS@ \
 					-DPLUGINDIR=\""$(build_plugindir)"\"
 
 INCLUDES = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/src \
-			-I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat
+			-I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat \
+			-I$(srcdir)/btio
 
 doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
 		doc/manager-api.txt doc/modem-api.txt doc/network-api.txt \
btio/btio.c new file +1299 -0

1,299 lines not on this page · raw message

btio/btio.h new file +97 -0

97 lines not on this page · raw message

configure.ac +5 -0
index 7a2ca79..2a650b1 100644
@@ -102,6 +102,11 @@ else
 fi
 AC_SUBST(DBUS_CONFDIR)
 
+PKG_CHECK_MODULES(BLUEZ, bluez, dummy=yes,
+				AC_MSG_ERROR(libbluetooth is required))
+AC_SUBST(BLUEZ_CFLAGS)
+AC_SUBST(BLUEZ_LIBS)
+
 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
 	[path to D-Bus data directory]), [path_dbusdata=${withval}],
 		[path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#4 lore raw

PATCH 3/21 bluetooth: Add bluetooth server support for DUN

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

It watches Bluetooth adapter property changes and addes DUN record to listen DUN client connection request.

---
 plugins/bluetooth.c |  379 +++++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/bluetooth.h |   15 ++
 2 files changed, 394 insertions(+), 0 deletions(-)
plugins/bluetooth.c +379 -0
index fe1eaa9..c20728e 100644
@@ -35,13 +35,72 @@
 
 #include <ofono/dbus.h>
 
+#include <btio.h>
 #include "bluetooth.h"
 
 static DBusConnection *connection;
 static GHashTable *uuid_hash = NULL;
 static GHashTable *adapter_address_hash = NULL;
+static GSList *server_list = NULL;
 static gint ref_count;
 
+static const gchar *dun_record = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>	\
+<record>									\
+  <attribute id=\"0x0001\">							\
+    <sequence>									\
+      <uuid value=\"0x1103\"/>							\
+    </sequence>									\
+  </attribute>									\
+										\
+  <attribute id=\"0x0004\">							\
+    <sequence>									\
+      <sequence>								\
+        <uuid value=\"0x0100\"/>						\
+      </sequence>								\
+      <sequence>								\
+        <uuid value=\"0x0003\"/>						\
+        <uint8 value=\"%u\" name=\"channel\"/>					\
+      </sequence>								\
+      <sequence>								\
+        <uuid value=\"0x0008\"/>						\
+      </sequence>								\
+    </sequence>									\
+  </attribute>									\
+										\
+  <attribute id=\"0x0009\">							\
+    <sequence>									\
+      <sequence>								\
+        <uuid value=\"0x1103\"/>						\
+        <uint16 value=\"0x0100\" name=\"version\"/>				\
+      </sequence>								\
+    </sequence>									\
+  </attribute>									\
+										\
+  <attribute id=\"0x0100\">							\
+    <text value=\"%s\" name=\"name\"/>						\
+  </attribute>									\
+</record>";
+
+#define TIMEOUT (60*1000) /* Timeout for user response (miliseconds) */
+
+struct client {
+	GIOChannel	*io;
+	guint		watch;
+};
+
+struct server {
+	guint16		service;
+	gchar		*name;
+	guint8		channel;
+	GIOChannel	*io;
+	gchar		*adapter;
+	guint		handle;
+	ConnectFunc	connect_cb;
+	gpointer	user_data;
+
+	struct client	client;
+};
+
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
 				char *buf, int size)
 {
@@ -371,6 +430,253 @@ static gboolean property_changed(DBusConnection *connection, DBusMessage *msg,
 	return TRUE;
 }
 
+static void disconnect(struct server *server)
+{
+	struct client *client = &server->client;
+
+	if (!client->io)
+		return;
+
+	g_io_channel_unref(client->io);
+	client->io = NULL;
+
+	if (client->watch > 0) {
+		g_source_remove(client->watch);
+		client->watch = 0;
+	}
+
+	return;
+}
+
+static void server_stop(gpointer data, gpointer user_data)
+{
+	struct server *server = data;
+
+	disconnect(server);
+
+	if (server->handle) {
+		DBusMessage *msg;
+
+		msg = dbus_message_new_method_call(BLUEZ_SERVICE,
+						server->adapter,
+						BLUEZ_SERVICE_INTERFACE,
+						"RemoveRecord");
+		dbus_message_append_args(msg, DBUS_TYPE_UINT32, &server->handle,
+						DBUS_TYPE_INVALID);
+		g_dbus_send_message(connection, msg);
+
+		server->handle = 0;
+	}
+
+	if (server->io) {
+		g_io_channel_shutdown(server->io, TRUE, NULL);
+		g_io_channel_unref(server->io);
+		server->io = NULL;
+	}
+
+	g_free(server->adapter);
+	server->adapter = NULL;
+}
+
+static gboolean client_event(GIOChannel *chan, GIOCondition cond, gpointer data)
+{
+	struct server *server = data;
+
+	disconnect(server);
+
+	return FALSE;
+}
+
+static void cancel_authorization(struct server *server)
+{
+	DBusMessage *msg;
+
+	if (!server->adapter)
+		return;
+
+	msg = dbus_message_new_method_call(BLUEZ_SERVICE, server->adapter,
+						BLUEZ_SERVICE_INTERFACE,
+						"CancelAuthorization");
+
+	g_dbus_send_message(connection, msg);
+}
+
+static void auth_cb(DBusPendingCall *call, gpointer user_data)
+{
+	struct server *server = user_data;
+	struct client *client = &server->client;
+	GIOChannel *io = client->io;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	DBusError derr;
+	GError *err = NULL;
+
+	dbus_error_init(&derr);
+
+	if (dbus_set_error_from_message(&derr, reply)) {
+		ofono_error("RequestAuthorization error: %s, %s",
+				derr.name, derr.message);
+
+		if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY))
+			cancel_authorization(server);
+
+		dbus_error_free(&derr);
+		goto failed;
+	}
+
+	ofono_info("RequestAuthorization succeeded");
+
+	if (!bt_io_accept(io, server->connect_cb, server->user_data,
+						NULL, &err)) {
+		ofono_error("%s", err->message);
+		g_error_free(err);
+		goto failed;
+	}
+
+	g_source_remove(client->watch);
+
+	client->watch = g_io_add_watch(client->io,
+					G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+					client_event, server);
+
+	dbus_message_unref(reply);
+
+	return;
+
+failed:
+	dbus_message_unref(reply);
+	disconnect(server);
+}
+
+static gboolean auth_watch(GIOChannel *io, GIOCondition cond,
+						gpointer user_data)
+{
+	struct server *server = user_data;
+
+	cancel_authorization(server);
+	disconnect(server);
+
+	return FALSE;
+}
+
+static void confirm_event(GIOChannel *io, gpointer user_data)
+{
+	struct server *server = user_data;
+	struct client *client = &server->client;
+	GError *err = NULL;
+	char address[18];
+	const char *addr;
+	guint8 channel;
+	int ret;
+
+	if (client->io) {
+		ofono_error("Rejecting connection since one client already \
+				connected");
+		return;
+	}
+
+	bt_io_get(io, BT_IO_RFCOMM, &err, BT_IO_OPT_DEST, address,
+					BT_IO_OPT_CHANNEL, &channel,
+					BT_IO_OPT_INVALID);
+	if (err) {
+		ofono_error("%s", err->message);
+		g_error_free(err);
+		return;
+	}
+
+	ofono_info("New connection from: %s, channel %u", address, channel);
+
+	addr = address;
+	ret = bluetooth_send_with_reply(server->adapter,
+					BLUEZ_SERVICE_INTERFACE,
+					"RequestAuthorization",
+					auth_cb, server, NULL, TIMEOUT,
+					DBUS_TYPE_STRING, &addr,
+					DBUS_TYPE_UINT32, &server->handle,
+					DBUS_TYPE_INVALID);
+	if (ret < 0) {
+		ofono_error("Request Bluetooth authorization failed");
+		return;
+	}
+
+	ofono_info("RequestAuthorization(%s, 0x%x)", address, server->handle);
+
+	client->io = g_io_channel_ref(io);
+	client->watch = g_io_add_watch(io, G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+					auth_watch, server);
+
+	return;
+}
+
+static void add_record_cb(DBusPendingCall *call, gpointer user_data)
+{
+	struct server *server = user_data;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	DBusError derr;
+	guint32 handle;
+
+	dbus_error_init(&derr);
+
+	if (dbus_set_error_from_message(&derr, reply)) {
+		ofono_error("Replied with an error: %s, %s",
+					derr.name, derr.message);
+		dbus_error_free(&derr);
+		server_stop(server, NULL);
+		goto done;
+	}
+
+	dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32, &handle,
+					DBUS_TYPE_INVALID);
+	server->handle = handle;
+
+	ofono_info("Registered: %s, handle: 0x%x", server->name, handle);
+
+done:
+	dbus_message_unref(reply);
+}
+
+static void server_start(gpointer data, gpointer user_data)
+{
+	struct server *server = data;
+	gchar *path = user_data;
+	GError *err = NULL;
+	gchar *xml;
+
+	if (server->handle != 0)
+		return;
+
+	if (server->service != DUN_GW)
+		goto failed;
+
+	server->io = bt_io_listen(BT_IO_RFCOMM, NULL, confirm_event,
+					server, NULL, &err,
+					BT_IO_OPT_CHANNEL, server->channel,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
+					BT_IO_OPT_INVALID);
+	if (!server->io) {
+		ofono_error("Bluetooth %s register failed: %s",
+					server->name, err->message);
+		g_error_free(err);
+		goto failed;
+	}
+
+	server->adapter = g_strdup(path);
+
+	xml = g_markup_printf_escaped(dun_record, server->channel,
+					server->name);
+
+	bluetooth_send_with_reply(path, BLUEZ_SERVICE_INTERFACE, "AddRecord",
+					add_record_cb, server, NULL, -1,
+					DBUS_TYPE_STRING, &xml,
+					DBUS_TYPE_INVALID);
+
+	g_free(xml);
+
+	return;
+
+failed:
+	server_stop(server, NULL);
+}
+
 static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)
 {
 	const char *path = user_data;
@@ -395,6 +701,9 @@ static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)
 	g_hash_table_insert(adapter_address_hash,
 				g_strdup(path), g_strdup(addr));
 
+	if (server_list)
+		g_slist_foreach(server_list, server_start, (gpointer)path);
+
 	for (l = device_list; l; l = l->next) {
 		const char *device = l->data;
 
@@ -429,11 +738,26 @@ static gboolean adapter_removed(DBusConnection *connection,
 				DBusMessage *message, void *user_data)
 {
 	const char *path;
+	GSList *l;
 
 	if (dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path,
 				DBUS_TYPE_INVALID) == TRUE)
 		g_hash_table_remove(adapter_address_hash, path);
 
+	for (l = server_list; l; l = l->next) {
+		struct server *server = l->data;
+
+		if (!server->adapter)
+			continue;
+
+		if (!g_str_equal(path, server->adapter))
+			continue;
+
+		/* Don't remove handle if the adapter has been removed */
+		server->handle = 0;
+		server_stop(server, NULL);
+	}
+
 	return TRUE;
 }
 
@@ -565,6 +889,7 @@ static int bluetooth_ref()
 static void bluetooth_unref()
 {
 	gboolean is_zero;
+	GSList *l;
 
 	is_zero = g_atomic_int_dec_and_test(&ref_count);
 
@@ -581,6 +906,20 @@ static void bluetooth_unref()
 
 	if (adapter_address_hash)
 		g_hash_table_destroy(adapter_address_hash);
+
+	if (server_list == NULL)
+		return;
+
+	for (l = server_list; l; l = l->next) {
+		struct server *server = l->data;
+
+		server_stop(server, NULL);
+		g_free(server->name);
+		g_free(server);
+	}
+
+	g_slist_free(server_list);
+	server_list = NULL;
 }
 
 int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
@@ -605,5 +944,45 @@ void bluetooth_unregister_uuid(const char *uuid)
 	bluetooth_unref();
 }
 
+struct server *bluetooth_register_server(guint16 service, char *name,
+						guint8 channel, ConnectFunc cb,
+						gpointer user_data)
+{
+	struct server *server;
+	int err = bluetooth_ref();
+
+	if (err != 0)
+		return NULL;
+
+	server = g_try_new0(struct server, 1);
+	if (!server)
+		return NULL;
+
+	server->service = service;
+	server->name = g_strdup(name);
+	server->channel = channel;
+	server->connect_cb = cb;
+	server->user_data = user_data;
+
+	server_list = g_slist_prepend(server_list, server);
+
+	bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties",
+					manager_properties_cb, NULL, NULL, -1,
+					DBUS_TYPE_INVALID);
+
+	return server;
+}
+
+void bluetooth_unregister_server(struct server *server)
+{
+	server_list = g_slist_remove(server_list, server);
+
+	server_stop(server, NULL);
+	g_free(server->name);
+	g_free(server);
+
+	bluetooth_unref();
+}
+
 OFONO_PLUGIN_DEFINE(bluetooth, "Bluetooth Utils Plugins", VERSION,
 			OFONO_PLUGIN_PRIORITY_DEFAULT, NULL, NULL)
plugins/bluetooth.h +15 -0
index f187529..945da6a 100644
@@ -3,6 +3,7 @@
  *  oFono - Open Source Telephony
  *
  *  Copyright (C) 2010 Gustavo F. Padovan <[email protected]>
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
  *
  *  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
@@ -23,6 +24,7 @@
 #define	BLUEZ_MANAGER_INTERFACE		BLUEZ_SERVICE ".Manager"
 #define	BLUEZ_ADAPTER_INTERFACE		BLUEZ_SERVICE ".Adapter"
 #define	BLUEZ_DEVICE_INTERFACE		BLUEZ_SERVICE ".Device"
+#define	BLUEZ_SERVICE_INTERFACE		BLUEZ_SERVICE ".Service"
 
 #define DBUS_TIMEOUT 15
 
@@ -31,6 +33,9 @@
 /* Profiles bitfield */
 #define HFP_AG 0x01
 
+/* Service bitfield */
+#define DUN_GW 0x01
+
 struct bluetooth_profile {
 	const char *name;
 	int (*create)(const char *device, const char *dev_addr,
@@ -39,10 +44,20 @@ struct bluetooth_profile {
 	void (*set_alias)(const char *device, const char *);
 };
 
+
+typedef void (*ConnectFunc)(GIOChannel *io, GError *err, gpointer user_data);
+
+struct server;
+
 int bluetooth_register_uuid(const char *uuid,
 				struct bluetooth_profile *profile);
 void bluetooth_unregister_uuid(const char *uuid);
 
+struct server *bluetooth_register_server(guint16 service, char *name,
+						guint8 channel, ConnectFunc cb,
+						gpointer user_data);
+void bluetooth_unregister_server(struct server *server);
+
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
 							char *buf, int size);
 
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#5 lore raw

PATCH 4/21 emulator: Add emulator atom in oFono

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Create emulator atom when modem state changes to online. The emulator driver probes each driver to create specific emulator like DUN, HFP AG, etc. Once get client connection request, create GAtServer to talk AT commands with client side.

---
 Makefile.am        |    4 +-
 include/emulator.h |   54 +++++++++++++++
 src/emulator.c     |  189 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/modem.c        |    1 +
 src/ofono.h        |    5 ++
 5 files changed, 251 insertions(+), 2 deletions(-)
 create mode 100644 include/emulator.h
 create mode 100644 src/emulator.c
Makefile.am +2 -2
index 2a9f340..5dcf253 100644
@@ -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/emulator.h
 
 nodist_include_HEADERS = include/version.h
 
@@ -342,7 +342,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/emulator.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \
 			@BLUEZ_LIBS@ -ldl
include/emulator.h new file +54 -0

54 lines not on this page · raw message

src/emulator.c new file +189 -0

189 lines not on this page · raw message

src/modem.c +1 -0
index 953d6c3..f117e5e 100644
@@ -434,6 +434,7 @@ static void modem_change_state(struct ofono_modem *modem,
 			driver->post_online(modem);
 
 		notify_online_watches(modem);
+		__ofono_emulator_probe_drivers(modem);
 		break;
 	}
 }
src/ofono.h +5 -0
index cab70cd..64ea625 100644
@@ -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_EMULATOR_DUN = 24,
 };
 
 enum ofono_atom_watch_condition {
@@ -418,3 +419,7 @@ void __ofono_nettime_info_received(struct ofono_modem *modem,
 					struct ofono_network_time *info);
 
 #include <ofono/cdma-voicecall.h>
+
+#include <ofono/emulator.h>
+
+void __ofono_emulator_probe_drivers(struct ofono_modem *modem);
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#6 lore raw

PATCH 5/21 dun_gw: Add DUN server plugin for oFono

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

DUN server is probed when modem state changes to online. It registers DUN record to Bluetooth adapter and wait for incoming DUN connection.

---
 Makefile.am      |    3 +
 plugins/dun_gw.c |  115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 plugins/dun_gw.c
Makefile.am +3 -0
index 5dcf253..58bf6c4 100644
@@ -291,6 +291,9 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
 builtin_modules += hfp
 builtin_sources += plugins/hfp.c plugins/bluetooth.h
 
+builtin_modules += dun_gw
+builtin_sources += $(btio_sources) plugins/dun_gw.c plugins/bluetooth.h
+
 builtin_modules += palmpre
 builtin_sources += plugins/palmpre.c
 
plugins/dun_gw.c new file +115 -0

115 lines not on this page · raw message

Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#7 lore raw

PATCH 6/21 gprs: Rename status_watch to netreg_status_watch

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

To be more precise and avoid name conflict with dun_status_watch.

---
 src/gprs.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
src/gprs.c +8 -7
index 0e86bdf..4cb5eaf 100644
@@ -74,7 +74,7 @@ struct ofono_gprs {
 	int netreg_status;
 	struct ofono_netreg *netreg;
 	unsigned int netreg_watch;
-	unsigned int status_watch;
+	unsigned int netreg_status_watch;
 	GKeyFile *settings;
 	char *imsi;
 	DBusMessage *pending;
@@ -2164,10 +2164,10 @@ static void gprs_unregister(struct ofono_atom *atom)
 	}
 
 	if (gprs->netreg_watch) {
-		if (gprs->status_watch) {
+		if (gprs->netreg_status_watch) {
 			__ofono_netreg_remove_status_watch(gprs->netreg,
-							gprs->status_watch);
-			gprs->status_watch = 0;
+						gprs->netreg_status_watch);
+			gprs->netreg_status_watch = 0;
 		}
 
 		__ofono_modem_remove_atom_watch(modem, gprs->netreg_watch);
@@ -2250,15 +2250,16 @@ static void netreg_watch(struct ofono_atom *atom,
 	struct ofono_gprs *gprs = data;
 
 	if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
-		gprs->status_watch = 0;
+		gprs->netreg_status_watch = 0;
 		gprs->netreg = NULL;
 		return;
 	}
 
 	gprs->netreg = __ofono_atom_get_data(atom);
 	gprs->netreg_status = ofono_netreg_get_status(gprs->netreg);
-	gprs->status_watch = __ofono_netreg_add_status_watch(gprs->netreg,
-					netreg_status_changed, gprs, NULL);
+	gprs->netreg_status_watch = __ofono_netreg_add_status_watch(
+					gprs->netreg, netreg_status_changed,
+					gprs, NULL);
 
 	gprs_netreg_update(gprs);
 }
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#8 lore raw

PATCH 7/21 emulator: Add status watches for ofono emulator

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

The status watches monitor the emulator activities. Other atoms like gprs, netreg could register notification to watch emulator status changes.

---
 include/emulator.h |    6 +++++
 src/emulator.c     |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/ofono.h        |   11 ++++++++++
 3 files changed, 71 insertions(+), 0 deletions(-)
include/emulator.h +6 -0
index 2691928..99ae218 100644
@@ -30,6 +30,12 @@ extern "C" {
 
 struct ofono_emulator;
 
+enum ofono_emulator_status {
+	OFONO_EMULATOR_STATUS_IDLE = 0,
+	OFONO_EMULATOR_STATUS_CREATE,
+	OFONO_EMULATOR_STATUS_DESTROY,
+};
+
 struct ofono_emulator_driver {
 	const char *name;
 	enum ofono_atom_type type;
src/emulator.c +54 -0

84 lines not on this page · raw message

src/ofono.h +11 -0
index 64ea625..247152b 100644
@@ -423,3 +423,14 @@ void __ofono_nettime_info_received(struct ofono_modem *modem,
 #include <ofono/emulator.h>
 
 void __ofono_emulator_probe_drivers(struct ofono_modem *modem);
+
+typedef void (*ofono_emulator_status_notify_cb_t)(struct ofono_emulator *e,
+					enum ofono_emulator_status status,
+					void *data, void *user_data);
+
+unsigned int __ofono_emulator_add_status_watch(struct ofono_emulator *e,
+				ofono_emulator_status_notify_cb_t notify,
+				void *data, ofono_destroy_func destroy);
+
+gboolean __ofono_emulator_remove_status_watch(struct ofono_emulator *e,
+						unsigned int id);
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#9 lore raw

PATCH 8/21 emulator: Add emulator status watches in gprs atom

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Add dun_watch to watch emulator status update in gprs atom. So that gprs atom could get notified when we get request to create new PPP connection from DUN client;

---
 src/gprs.c |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
src/gprs.c +60 -0
index 4cb5eaf..c7793ea 100644
@@ -82,6 +82,9 @@ struct ofono_gprs {
 	const struct ofono_gprs_driver *driver;
 	void *driver_data;
 	struct ofono_atom *atom;
+	struct ofono_emulator *dun;
+	unsigned int dun_watch;
+	unsigned int dun_status_watch;
 };
 
 struct ofono_gprs_context {
@@ -2014,6 +2017,39 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
 	}
 }
 
+static void dun_status_watch(struct ofono_emulator *e,
+					enum ofono_emulator_status status,
+					void *data, void *user_data)
+{
+	if (e == NULL)
+		return;
+
+	switch (status) {
+	default:
+		break;
+	}
+}
+
+static void dun_watch(struct ofono_atom *atom,
+					enum ofono_atom_watch_condition cond,
+					void *data)
+{
+	struct ofono_gprs *gprs = data;
+	struct ofono_emulator *e = __ofono_atom_get_data(atom);
+
+	if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+		gprs->dun_status_watch = 0;
+		gprs->dun = NULL;
+		return;
+	}
+
+	DBG("");
+
+	gprs->dun = e;
+	gprs->dun_status_watch = __ofono_emulator_add_status_watch(e,
+						dun_status_watch, gprs, NULL);
+}
+
 int ofono_gprs_context_driver_register(const struct ofono_gprs_context_driver *d)
 {
 	DBG("driver: %p, name: %s", d, d->name);
@@ -2175,6 +2211,18 @@ static void gprs_unregister(struct ofono_atom *atom)
 		gprs->netreg = NULL;
 	}
 
+	if (gprs->dun_watch) {
+		if (gprs->dun_status_watch) {
+			__ofono_emulator_remove_status_watch(gprs->dun,
+							gprs->dun_status_watch);
+			gprs->dun_status_watch = 0;
+		}
+
+		__ofono_modem_remove_atom_watch(modem, gprs->dun_watch);
+		gprs->dun_watch = 0;
+		gprs->dun = NULL;
+	}
+
 	ofono_modem_remove_interface(modem,
 					OFONO_CONNECTION_MANAGER_INTERFACE);
 	g_dbus_unregister_interface(conn, path,
@@ -2464,6 +2512,7 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
 	const char *path = __ofono_atom_get_path(gprs->atom);
 	struct ofono_atom *netreg_atom;
 	struct ofono_atom *sim_atom;
+	struct ofono_atom *dun_atom;
 
 	if (!g_dbus_register_interface(conn, path,
 					OFONO_CONNECTION_MANAGER_INTERFACE,
@@ -2500,6 +2549,17 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
 		netreg_watch(netreg_atom,
 				OFONO_ATOM_WATCH_CONDITION_REGISTERED, gprs);
 
+	gprs->dun_watch = __ofono_modem_add_atom_watch(modem,
+						OFONO_ATOM_TYPE_EMULATOR_DUN,
+						dun_watch, gprs, NULL);
+
+	dun_atom = __ofono_modem_find_atom(modem,
+						OFONO_ATOM_TYPE_EMULATOR_DUN);
+
+	if (dun_atom && __ofono_atom_get_registered(dun_atom))
+		dun_watch(dun_atom,
+				OFONO_ATOM_WATCH_CONDITION_REGISTERED, gprs);
+
 	__ofono_atom_register(gprs->atom, gprs_unregister);
 }
 
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#10 lore raw

PATCH 9/21 emulator: Add APIs to send GAtServer result

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Defines APIs to send final/intermediate/unsolicited result to DUN client.
Please enter the commit message for your changes. Lines starting

---
 include/emulator.h |    2 ++
 src/emulator.c     |   28 ++++++++++++++++++++++++++++
 src/ofono.h        |   15 +++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)
include/emulator.h +2 -0
index 99ae218..0d5568c 100644
@@ -36,6 +36,8 @@ enum ofono_emulator_status {
 	OFONO_EMULATOR_STATUS_DESTROY,
 };
 
+enum _GAtServerResult;
+
 struct ofono_emulator_driver {
 	const char *name;
 	enum ofono_atom_type type;
src/emulator.c +28 -0
index c68dbf8..455af11 100644
@@ -82,6 +82,34 @@ static void ofono_emulator_release_id(int id)
 	ofono_emulator_ids &= ~(0x1 << id);
 }
 
+void ofono_emulator_send_final(struct ofono_emulator *e, GAtServerResult result)
+{
+	g_at_server_send_final(e->server, result);
+}
+
+void ofono_emulator_send_ext_final(struct ofono_emulator *e, const char *result)
+{
+	g_at_server_send_ext_final(e->server, result);
+}
+
+void ofono_emulator_send_intermediate(struct ofono_emulator *e,
+						const char *result)
+{
+	g_at_server_send_intermediate(e->server, result);
+}
+
+void ofono_emulator_send_unsolicited(struct ofono_emulator *e,
+						const char *result)
+{
+	g_at_server_send_unsolicited(e->server, result);
+}
+
+void ofono_emulator_send_info(struct ofono_emulator *e, const char *line,
+						gboolean last)
+{
+	g_at_server_send_info(e->server, line, last);
+}
+
 static void notify_status_watches(struct ofono_emulator *e, void *data)
 {
 	struct ofono_watchlist_item *item;
src/ofono.h +15 -0
index 247152b..4c11e1f 100644
@@ -434,3 +434,18 @@ unsigned int __ofono_emulator_add_status_watch(struct ofono_emulator *e,
 
 gboolean __ofono_emulator_remove_status_watch(struct ofono_emulator *e,
 						unsigned int id);
+
+void ofono_emulator_send_final(struct ofono_emulator *e,
+					enum _GAtServerResult result);
+
+void ofono_emulator_send_ext_final(struct ofono_emulator *e,
+					const char *result);
+
+void ofono_emulator_send_intermediate(struct ofono_emulator *e,
+					const char *result);
+
+void ofono_emulator_send_unsolicited(struct ofono_emulator *e,
+					const char *result);
+
+void ofono_emulator_send_info(struct ofono_emulator *e, const char *line,
+					gboolean last);
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#11 lore raw

PATCH 10/21 emulator: Implement dialing up for DUN

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

It handles client ATD*99# request and complete GPRS connection. Pass client IP address through IPCP packet to client side.

---
 include/emulator.h |   30 +++++++
 src/emulator.c     |  221 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 251 insertions(+), 0 deletions(-)
include/emulator.h +30 -0
index 0d5568c..e6eeb06 100644
@@ -34,6 +34,9 @@ enum ofono_emulator_status {
 	OFONO_EMULATOR_STATUS_IDLE = 0,
 	OFONO_EMULATOR_STATUS_CREATE,
 	OFONO_EMULATOR_STATUS_DESTROY,
+	OFONO_EMULATOR_STATUS_DUN_CONNECT,
+	OFONO_EMULATOR_STATUS_DUN_CONNECTED,
+	OFONO_EMULATOR_STATUS_DUN_DISCONNECTED,
 };
 
 enum _GAtServerResult;
@@ -46,6 +49,33 @@ struct ofono_emulator_driver {
 	void (*remove)();
 };
 
+typedef void (*ofono_emulator_cb_t)(enum _GAtServerResult res, void *data);
+
+struct ofono_emulator_req {
+	void *data;
+	ofono_emulator_cb_t cb;
+	void *cb_data;
+};
+
+typedef void (*ofono_emulator_gprs_connect_cb)(const struct ofono_error *error,
+						const char *interface,
+						const char *local,
+						const char *peer,
+						const char **dns, void *data);
+
+struct ofono_emulator_gprs_connect_req {
+	const char *dial_str;
+	ofono_emulator_gprs_connect_cb cb;
+	void *cb_data;
+};
+
+struct ofono_emulator_gprs_context_req {
+	const char *proto;
+	const char *apn;
+	ofono_emulator_cb_t cb;
+	void *cb_data;
+};
+
 int ofono_emulator_enable(struct ofono_emulator *emulator, GIOChannel *channel);
 void ofono_emulator_remove(gpointer user_data);
 struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
src/emulator.c +221 -0

251 lines not on this page · raw message

Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#12 lore raw

PATCH 11/21 gprs: Make gprs_proto_to/from_string non-static

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

So DUN server could share gprs_proto_to_string and gprs_proto_from_string.

---
 include/gprs-context.h |    4 ++++
 src/gprs.c             |    4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
include/gprs-context.h +4 -0
index c29c0dc..19c1b98 100644
@@ -95,6 +95,10 @@ struct ofono_modem *ofono_gprs_context_get_modem(struct ofono_gprs_context *gc);
 void ofono_gprs_context_set_type(struct ofono_gprs_context *gc,
 					enum ofono_gprs_context_type type);
 
+gboolean gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto);
+
+const char *gprs_proto_to_string(enum ofono_gprs_proto proto);
+
 #ifdef __cplusplus
 }
 #endif
src/gprs.c +2 -2
index c7793ea..9e8fae3 100644
@@ -184,7 +184,7 @@ static gboolean gprs_context_string_to_type(const char *str,
 	return FALSE;
 }
 
-static const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
+const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
 {
 	switch (proto) {
 	case OFONO_GPRS_PROTO_IP:
@@ -196,7 +196,7 @@ static const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
 	return NULL;
 }
 
-static gboolean gprs_proto_from_string(const char *str,
+gboolean gprs_proto_from_string(const char *str,
 					enum ofono_gprs_proto *proto)
 {
 	if (g_str_equal(str, "ip")) {
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#13 lore raw

PATCH 12/21 gprs: ignore the case of proto str when comparing

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Use g_ascii_strcasecmp in gprs_proto_from_string when getting the GPRS protocol from string.

---
 src/gprs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
src/gprs.c +2 -2
index 9e8fae3..830e143 100644
@@ -199,10 +199,10 @@ const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
 gboolean gprs_proto_from_string(const char *str,
 					enum ofono_gprs_proto *proto)
 {
-	if (g_str_equal(str, "ip")) {
+	if (g_ascii_strcasecmp(str, "ip")) {
 		*proto = OFONO_GPRS_PROTO_IP;
 		return TRUE;
-	} else if (g_str_equal(str, "ipv6")) {
+	} else if (g_ascii_strcasecmp(str, "ipv6")) {
 		*proto = OFONO_GPRS_PROTO_IPV6;
 		return TRUE;
 	}
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#14 lore raw

PATCH 13/21 emulator: Register mandatory AT command handlers

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Register mandatory AT command handlers for DUN server.

---
 include/emulator.h |    2 +
 src/emulator.c     |  380 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 382 insertions(+), 0 deletions(-)
include/emulator.h +2 -0
index e6eeb06..71ed78a 100644
@@ -37,6 +37,8 @@ enum ofono_emulator_status {
 	OFONO_EMULATOR_STATUS_DUN_CONNECT,
 	OFONO_EMULATOR_STATUS_DUN_CONNECTED,
 	OFONO_EMULATOR_STATUS_DUN_DISCONNECTED,
+	OFONO_EMULATOR_STATUS_SET_CGATT,
+	OFONO_EMULATOR_STATUS_SET_CGDCONT,
 };
 
 enum _GAtServerResult;
src/emulator.c +380 -0

404 lines not on this page · raw message

Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#15 lore raw

PATCH 14/21 gprs: Refactor to share remove_context method

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Remove duplicated code in gprs_deactivate_for_remove and gprs_remove_context. So they could share the same remove_context method.

---
 src/gprs.c |   59 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 29 insertions(+), 30 deletions(-)
src/gprs.c +29 -30
index 830e143..05e1c70 100644
@@ -1652,26 +1652,14 @@ static DBusMessage *gprs_add_context(DBusConnection *conn,
 	return NULL;
 }
 
-static void gprs_deactivate_for_remove(const struct ofono_error *error,
-						void *data)
+static void remove_context(struct pri_context *ctx)
 {
-	struct pri_context *ctx = data;
 	struct ofono_gprs *gprs = ctx->gprs;
 	DBusConnection *conn;
 	char *path;
 	const char *atompath;
 
-	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
-		DBG("Removing context failed with error: %s",
-				telephony_error_to_str(error));
-
-		__ofono_dbus_pending_reply(&gprs->pending,
-					__ofono_error_failed(gprs->pending));
-		return;
-	}
-
-	gprs_cid_release(gprs, ctx->context.cid);
-	ctx->context.cid = 0;
+	DBG("%s", ctx->path);
 
 	if (gprs->settings) {
 		g_key_file_remove_group(gprs->settings, ctx->key, NULL);
@@ -1684,9 +1672,6 @@ static void gprs_deactivate_for_remove(const struct ofono_error *error,
 	context_dbus_unregister(ctx);
 	gprs->contexts = g_slist_remove(gprs->contexts, ctx);
 
-	__ofono_dbus_pending_reply(&gprs->pending,
-				dbus_message_new_method_return(gprs->pending));
-
 	atompath = __ofono_atom_get_path(gprs->atom);
 	conn = ofono_dbus_get_connection();
 	g_dbus_emit_signal(conn, atompath, OFONO_CONNECTION_MANAGER_INTERFACE,
@@ -1695,13 +1680,38 @@ static void gprs_deactivate_for_remove(const struct ofono_error *error,
 	g_free(path);
 }
 
+
+static void gprs_deactivate_for_remove(const struct ofono_error *error,
+						void *data)
+{
+	struct pri_context *ctx = data;
+	struct ofono_gprs *gprs = ctx->gprs;
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+		DBG("Removing context failed with error: %s",
+				telephony_error_to_str(error));
+
+		__ofono_dbus_pending_reply(&gprs->pending,
+					__ofono_error_failed(gprs->pending));
+		return;
+	}
+
+	gprs_cid_release(gprs, ctx->context.cid);
+	ctx->context.cid = 0;
+
+	remove_context(ctx);
+
+	if (gprs->pending)
+		__ofono_dbus_pending_reply(&gprs->pending,
+				dbus_message_new_method_return(gprs->pending));
+}
+
 static DBusMessage *gprs_remove_context(DBusConnection *conn,
 					DBusMessage *msg, void *data)
 {
 	struct ofono_gprs *gprs = data;
 	struct pri_context *ctx;
 	const char *path;
-	const char *atompath;
 
 	if (gprs->pending)
 		return __ofono_error_busy(msg);
@@ -1730,22 +1740,11 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn,
 		return NULL;
 	}
 
-	if (gprs->settings) {
-		g_key_file_remove_group(gprs->settings, ctx->key, NULL);
-		storage_sync(gprs->imsi, SETTINGS_STORE, gprs->settings);
-	}
-
 	DBG("Unregistering context: %s", ctx->path);
-	context_dbus_unregister(ctx);
-	gprs->contexts = g_slist_remove(gprs->contexts, ctx);
+	remove_context(ctx);
 
 	g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);
 
-	atompath = __ofono_atom_get_path(gprs->atom);
-	g_dbus_emit_signal(conn, atompath, OFONO_CONNECTION_MANAGER_INTERFACE,
-				"ContextRemoved", DBUS_TYPE_OBJECT_PATH, &path,
-				DBUS_TYPE_INVALID);
-
 	return NULL;
 }
 
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#16 lore raw

PATCH 15/21 gprs: Add DUN +CGATT support in gprs atom

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

DUN client may request to attach/deattach GPRS network. Use gprs_netreg_update to set attach/deattach status.

---
 src/gprs.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
src/gprs.c +19 -0
index 05e1c70..580188e 100644
@@ -43,6 +43,8 @@
 #include "common.h"
 #include "storage.h"
 #include "idmap.h"
+#include "gatserver.h"
+
 
 #define GPRS_FLAG_ATTACHING 0x1
 #define GPRS_FLAG_RECHECK 0x2
@@ -2016,14 +2018,31 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
 	}
 }
 
+static void ofono_gprs_set_cgatt(struct ofono_gprs *gprs,
+				struct ofono_emulator_req *req)
+{
+	int *mode = req->data;
+
+	gprs->powered = *mode;
+
+	gprs_netreg_update(gprs);
+
+	req->cb(G_AT_SERVER_RESULT_OK, req->cb_data);
+}
+
 static void dun_status_watch(struct ofono_emulator *e,
 					enum ofono_emulator_status status,
 					void *data, void *user_data)
 {
+	struct ofono_gprs *gprs = user_data;
+
 	if (e == NULL)
 		return;
 
 	switch (status) {
+	case OFONO_EMULATOR_STATUS_SET_CGATT:
+		ofono_gprs_set_cgatt(gprs, data);
+		break;
 	default:
 		break;
 	}
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#17 lore raw

PATCH 16/21 gprs: Add DUN +CGDCONT support in gprs atom

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

DUN client may request to define the APN of context. Find the existing context and update the APN.

---
 src/gprs.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
src/gprs.c +46 -0
index 580188e..0feb344 100644
@@ -60,6 +60,13 @@
 static GSList *g_drivers = NULL;
 static GSList *g_context_drivers = NULL;
 
+struct gprs_dun_data {
+	ofono_emulator_gprs_connect_cb cb;
+	void *cb_data;
+	struct pri_context *context;
+	struct pri_context *dun;
+};
+
 struct ofono_gprs {
 	GSList *contexts;
 	ofono_bool_t attached;
@@ -87,6 +94,7 @@ struct ofono_gprs {
 	struct ofono_emulator *dun;
 	unsigned int dun_watch;
 	unsigned int dun_status_watch;
+	struct gprs_dun_data dun_data;
 };
 
 struct ofono_gprs_context {
@@ -2030,6 +2038,41 @@ static void ofono_gprs_set_cgatt(struct ofono_gprs *gprs,
 	req->cb(G_AT_SERVER_RESULT_OK, req->cb_data);
 }
 
+static void ofono_gprs_set_cgdcont(struct ofono_gprs *gprs,
+				struct ofono_emulator_gprs_context_req *req)
+{
+	struct gprs_dun_data *data = &gprs->dun_data;
+	struct pri_context *context = NULL;
+	enum ofono_gprs_proto proto;
+	GSList *l;
+
+	gprs_proto_from_string(req->proto, &proto);
+
+	for (l = gprs->contexts; l; l = l->next) {
+		struct pri_context *ctx = l->data;
+
+		if (ctx->type != OFONO_GPRS_CONTEXT_TYPE_INTERNET)
+			continue;
+
+		if (proto != ctx->context.proto)
+			continue;
+
+		context = ctx;
+		break;
+	}
+
+	if (context == NULL)
+		goto error;
+
+	strcpy(context->context.apn, req->apn);
+	data->context = context;
+	req->cb(G_AT_SERVER_RESULT_OK, req->cb_data);
+
+	return;
+error:
+	req->cb(G_AT_SERVER_RESULT_ERROR, req->cb_data);
+}
+
 static void dun_status_watch(struct ofono_emulator *e,
 					enum ofono_emulator_status status,
 					void *data, void *user_data)
@@ -2043,6 +2086,9 @@ static void dun_status_watch(struct ofono_emulator *e,
 	case OFONO_EMULATOR_STATUS_SET_CGATT:
 		ofono_gprs_set_cgatt(gprs, data);
 		break;
+	case OFONO_EMULATOR_STATUS_SET_CGDCONT:
+		ofono_gprs_set_cgdcont(gprs, data);
+		break;
 	default:
 		break;
 	}
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#18 lore raw

PATCH 17/21 gprs: Add DUN server GPRS connect support

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Implement dial up networking in GPRS atom.

---
 src/gprs.c |  229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 227 insertions(+), 2 deletions(-)
src/gprs.c +227 -2
index 0feb344..e90f043 100644
@@ -57,6 +57,10 @@
 #define MAX_CONTEXTS 256
 #define SUSPEND_TIMEOUT 8
 
+#define DUN_LOCAL "192.168.1.1"
+#define DUN_PEER "192.168.1.2"
+#define DUN_CONNECT_TIMEOUT 20
+
 static GSList *g_drivers = NULL;
 static GSList *g_context_drivers = NULL;
 
@@ -95,6 +99,9 @@ struct ofono_gprs {
 	unsigned int dun_watch;
 	unsigned int dun_status_watch;
 	struct gprs_dun_data dun_data;
+	int attach_source;
+	int context_source;
+	int timeout_source;
 };
 
 struct ofono_gprs_context {
@@ -136,6 +143,7 @@ struct pri_context {
 };
 
 static void gprs_netreg_update(struct ofono_gprs *gprs);
+static gboolean dun_connect_remove(gpointer user_data);
 static void gprs_deactivate_next(struct ofono_gprs *gprs);
 
 static const char *gprs_context_default_name(enum ofono_gprs_context_type type)
@@ -676,7 +684,9 @@ static void pri_activate_callback(const struct ofono_error *error,
 	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
 		DBG("Activating context failed with error: %s",
 				telephony_error_to_str(error));
-		__ofono_dbus_pending_reply(&ctx->pending,
+
+		if (ctx->pending)
+			__ofono_dbus_pending_reply(&ctx->pending,
 					__ofono_error_failed(ctx->pending));
 
 		gprs_cid_release(ctx->gprs, ctx->context.cid);
@@ -684,11 +694,15 @@ static void pri_activate_callback(const struct ofono_error *error,
 		ctx->context_driver->inuse = FALSE;
 		ctx->context_driver = NULL;
 
+		if (ctx->gprs->dun)
+			dun_connect_remove(ctx->gprs);
+
 		return;
 	}
 
 	ctx->active = TRUE;
-	__ofono_dbus_pending_reply(&ctx->pending,
+	if (ctx->pending)
+		__ofono_dbus_pending_reply(&ctx->pending,
 				dbus_message_new_method_return(ctx->pending));
 
 	/*
@@ -1967,6 +1981,27 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
 	gprs->cid_map = idmap_new_from_range(min, max);
 }
 
+static void ofono_gprs_remove_sources(struct ofono_gprs *gprs)
+{
+	if (gprs == NULL)
+		return;
+
+	if (gprs->timeout_source) {
+		g_source_remove(gprs->timeout_source);
+		gprs->timeout_source = 0;
+	}
+
+	if (gprs->attach_source) {
+		g_source_remove(gprs->attach_source);
+		gprs->attach_source = 0;
+	}
+
+	if (gprs->context_source) {
+		g_source_remove(gprs->context_source);
+		gprs->context_source = 0;
+	}
+}
+
 static void gprs_context_unregister(struct ofono_atom *atom)
 {
 	struct ofono_gprs_context *gc = __ofono_atom_get_data(atom);
@@ -1974,6 +2009,8 @@ static void gprs_context_unregister(struct ofono_atom *atom)
 	if (gc->gprs == NULL)
 		return;
 
+	ofono_gprs_remove_sources(gc->gprs);
+
 	gc->gprs->context_drivers = g_slist_remove(gc->gprs->context_drivers,
 							gc);
 	gc->gprs = NULL;
@@ -2026,6 +2063,183 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
 	}
 }
 
+static ofono_bool_t set_primary_context_powered(struct pri_context *ctx,
+						ofono_bool_t value)
+{
+	struct ofono_gprs_context *gc = ctx->context_driver;
+
+	if (gc == NULL || gc->driver->activate_primary == NULL ||
+			gc->driver->deactivate_primary == NULL ||
+			ctx->gprs->cid_map == NULL)
+		return FALSE;
+
+	if (ctx->pending)
+		return FALSE;
+
+	if (ctx->active == value)
+		return FALSE;
+
+	if (value && !ctx->gprs->attached)
+		return FALSE;
+
+	if (ctx->gprs->flags & GPRS_FLAG_ATTACHING)
+		return FALSE;
+
+	if (value) {
+		ctx->context.cid = gprs_cid_alloc(ctx->gprs);
+
+		if (ctx->context.cid == 0)
+			return FALSE;
+
+		if (ctx->context.cid !=
+				idmap_get_min(ctx->gprs->cid_map)) {
+			ofono_error("Multiple active contexts are"
+					" not yet supported");
+
+			gprs_cid_release(ctx->gprs, ctx->context.cid);
+			ctx->context.cid = 0;
+
+			return FALSE;
+		}
+	}
+
+	if (value)
+		gc->driver->activate_primary(gc, &ctx->context,
+					pri_activate_callback, ctx);
+	else
+		gc->driver->deactivate_primary(gc, ctx->context.cid,
+					pri_deactivate_callback, ctx);
+
+	return TRUE;
+}
+
+static void ofono_gprs_dun_disconnect(struct ofono_gprs *gprs,
+				struct ofono_emulator_req *req)
+{
+	struct pri_context *context = gprs->dun_data.context;
+
+	ofono_gprs_remove_sources(gprs);
+
+	if (context->active) {
+		struct ofono_gprs_context *gc = context->context_driver;
+
+		gc->driver->deactivate_primary(gc, context->context.cid,
+					gprs_deactivate_for_remove, context);
+	} else
+		remove_context(context);
+}
+
+static gboolean dun_connect_remove(gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_dun_data *data = &gprs->dun_data;
+	struct ofono_error error;
+
+	ofono_gprs_remove_sources(gprs);
+	remove_context(data->context);
+
+	error.type = OFONO_ERROR_TYPE_FAILURE;
+	data->cb(&error, NULL, NULL, NULL, NULL, data->cb_data);
+
+	data->cb = NULL;
+	data->cb_data = NULL;
+	data->context = NULL;
+	data->dun = NULL;
+
+	return FALSE;
+}
+
+static gboolean pri_context_update(gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_dun_data *data = &gprs->dun_data;
+	struct pri_context *context = data->context;
+	struct context_settings *settings = context->settings;
+	struct ofono_error error;
+
+	DBG("active %d\n", context->active);
+
+	if (context->active != TRUE)
+		return TRUE;
+
+	gprs->context_source = 0;
+	g_source_remove(gprs->timeout_source);
+
+	error.type = OFONO_ERROR_TYPE_NO_ERROR;
+
+	data->cb(&error, settings->interface, DUN_LOCAL, DUN_PEER,
+					(const char **)settings->dns,
+					data->cb_data);
+
+	return FALSE;
+}
+
+static gboolean gprs_attach_update(gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_dun_data *data = &gprs->dun_data;
+	struct pri_context *context = data->context;
+
+	DBG("attached %d driver attached %d\n", gprs->attached,
+						gprs->driver_attached);
+
+	if (gprs->attached != TRUE || gprs->driver_attached != TRUE)
+		return TRUE;
+
+	gprs->attach_source = 0;
+
+	if (context->active != TRUE) {
+		set_primary_context_powered(context, TRUE);
+
+		/* wait until the primary context is actived */
+		gprs->context_source = g_timeout_add_seconds(1,
+						pri_context_update, gprs);
+		return FALSE;
+	}
+
+	pri_context_update(gprs);
+
+	return FALSE;
+}
+
+static void ofono_gprs_dun_connect(struct ofono_gprs *gprs,
+				struct ofono_emulator_gprs_connect_req *req)
+{
+	const char *dial_str = req->dial_str;
+	struct gprs_dun_data *data = &gprs->dun_data;
+	struct ofono_error error;
+
+	DBG("%s", dial_str);
+
+	if (data->context == NULL)
+		goto error;
+
+	data->cb = req->cb;
+	data->cb_data = req->cb_data;
+
+	gprs->timeout_source = g_timeout_add_seconds(DUN_CONNECT_TIMEOUT,
+						dun_connect_remove, gprs);
+
+	/* check gprs attaching status */
+	if (!gprs->powered || !gprs->attached || !gprs->driver_attached) {
+		gprs->powered = TRUE;
+
+		gprs_netreg_update(gprs);
+
+		/* wait until GPRS is attached */
+		gprs->attach_source = g_timeout_add_seconds(1,
+						gprs_attach_update, gprs);
+		return;
+	}
+
+	gprs_attach_update(gprs);
+
+	return;
+error:
+	error.type = OFONO_ERROR_TYPE_FAILURE;
+	req->cb(&error, NULL, NULL, NULL, NULL, req->cb_data);
+}
+
 static void ofono_gprs_set_cgatt(struct ofono_gprs *gprs,
 				struct ofono_emulator_req *req)
 {
@@ -2083,12 +2297,21 @@ static void dun_status_watch(struct ofono_emulator *e,
 		return;
 
 	switch (status) {
+	case OFONO_EMULATOR_STATUS_DUN_CONNECT:
+		ofono_gprs_dun_connect(gprs, data);
+		break;
+	case OFONO_EMULATOR_STATUS_DUN_DISCONNECTED:
+		ofono_gprs_dun_disconnect(gprs, data);
+		break;
 	case OFONO_EMULATOR_STATUS_SET_CGATT:
 		ofono_gprs_set_cgatt(gprs, data);
 		break;
 	case OFONO_EMULATOR_STATUS_SET_CGDCONT:
 		ofono_gprs_set_cgdcont(gprs, data);
 		break;
+	case OFONO_EMULATOR_STATUS_DESTROY:
+		ofono_gprs_remove_sources(gprs);
+		break;
 	default:
 		break;
 	}
@@ -2287,6 +2510,8 @@ static void gprs_unregister(struct ofono_atom *atom)
 		gprs->dun = NULL;
 	}
 
+	ofono_gprs_remove_sources(gprs);
+
 	ofono_modem_remove_interface(modem,
 					OFONO_CONNECTION_MANAGER_INTERFACE);
 	g_dbus_unregister_interface(conn, path,
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#19 lore raw

PATCH 18/21 gprs: Add status watch functions

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

So DUN server could watch GPRS status changes and notify client unsolicited results like +CGREG.

---
 include/gprs.h |    9 +++++++++
 src/gprs.c     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 0 deletions(-)
include/gprs.h +9 -0
index ad7925c..7985115 100644
@@ -36,6 +36,8 @@ typedef void (*ofono_gprs_status_cb_t)(const struct ofono_error *error,
 
 typedef void (*ofono_gprs_cb_t)(const struct ofono_error *error, void *data);
 
+typedef void (*ofono_gprs_status_notify_cb_t)(const int status, void *data);
+
 struct ofono_gprs_driver {
 	const char *name;
 	int (*probe)(struct ofono_gprs *gprs, unsigned int vendor,
@@ -77,6 +79,13 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
 void ofono_gprs_add_context(struct ofono_gprs *gprs,
 				struct ofono_gprs_context *gc);
 
+unsigned int __ofono_gprs_add_status_watch(struct ofono_gprs *gprs,
+				ofono_gprs_status_notify_cb_t cb,
+				void *data, ofono_destroy_func destroy);
+
+gboolean __ofono_gprs_remove_status_watch(struct ofono_gprs *gprs,
+						unsigned int id);
+
 #ifdef __cplusplus
 }
 #endif
src/gprs.c +55 -0

91 lines not on this page · raw message

Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#20 lore raw

PATCH 19/21 gprs: Add gprs_get_status

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

DUN server want to get latest GPRS status.

---
 include/gprs.h |    2 ++
 src/gprs.c     |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
include/gprs.h +2 -0
index 7985115..05cc086 100644
@@ -86,6 +86,8 @@ unsigned int __ofono_gprs_add_status_watch(struct ofono_gprs *gprs,
 gboolean __ofono_gprs_remove_status_watch(struct ofono_gprs *gprs,
 						unsigned int id);
 
+int ofono_gprs_get_status(struct ofono_gprs *gprs);
+
 #ifdef __cplusplus
 }
 #endif
src/gprs.c +9 -0
index 895d95b..4ef33ef 100644
@@ -2487,6 +2487,15 @@ void ofono_gprs_context_set_type(struct ofono_gprs_context *gc,
 	gc->type = type;
 }
 
+
+int ofono_gprs_get_status(struct ofono_gprs *gprs)
+{
+	if (gprs == NULL)
+		return -1;
+
+	return gprs->status;
+}
+
 int ofono_gprs_driver_register(const struct ofono_gprs_driver *d)
 {
 	DBG("driver: %p, name: %s", d, d->name);
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#21 lore raw

PATCH 20/21 emulator: Watch GPRS status changes

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Watch GPRS status update to notify DUN client, such as +CGREG unsolicited result.

---
 src/emulator.c |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 94 insertions(+), 0 deletions(-)
src/emulator.c +94 -0
index 2a089a1..7701510 100644
@@ -55,6 +55,7 @@ struct modem_settings {
 	int cgreg;
 	int cops;
 	int attached;
+	int gprs_status;
 };
 
 struct ofono_emulator {
@@ -68,6 +69,9 @@ struct ofono_emulator {
 	struct modem_settings settings;
 	enum ofono_emulator_status status;
 	struct ofono_watchlist *status_watches;
+	struct ofono_gprs *gprs;
+	unsigned int gprs_watch;
+	unsigned int gprs_status_watch;
 };
 
 static GSList *emulator_drivers = NULL;
@@ -305,12 +309,16 @@ static void cgreg_cb(GAtServerRequestType type, GAtResult *result,
 					gpointer user_data)
 {
 	struct ofono_emulator *e = user_data;
+	char buf[256];
 
 	switch (type) {
 	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
 		ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
 		break;
 	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		snprintf(buf, sizeof(buf), "+CGREG: %d, %d", e->settings.cgreg,
+					e->settings.gprs_status);
+		ofono_emulator_send_info(e, buf, TRUE);
 		ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
 		break;
 	case G_AT_SERVER_REQUEST_TYPE_SET:
@@ -710,6 +718,78 @@ error:
 	g_at_server_send_final(server, res);
 }
 
+static void emulator_gprs_update(struct ofono_emulator *e)
+{
+	GAtServer *server = e->server;
+	char buf[256];
+
+	switch (e->settings.cgreg) {
+	case 0:
+		break;
+	case 1:
+		snprintf(buf, sizeof(buf), "+CGREG: %d",
+						e->settings.gprs_status);
+		g_at_server_send_unsolicited(server, buf);
+		break;
+	case 2:
+		snprintf(buf, sizeof(buf), "+CGREG: %d",
+						e->settings.gprs_status);
+		g_at_server_send_unsolicited(server, buf);
+		break;
+	default:
+		break;
+	}
+}
+
+static void gprs_status_changed(int status, void *data)
+{
+	struct ofono_emulator *e = data;
+
+	DBG("%d", status);
+
+	e->settings.gprs_status = status;
+
+	emulator_gprs_update(e);
+}
+
+static void gprs_watch(struct ofono_atom *atom,
+				enum ofono_atom_watch_condition cond,
+				void *data)
+{
+	struct ofono_emulator *e = data;
+	struct ofono_gprs *gprs;
+
+	if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+		e->gprs_status_watch = 0;
+		e->gprs = NULL;
+		return;
+	}
+
+	gprs = __ofono_atom_get_data(atom);
+	e->gprs = gprs;
+	e->settings.gprs_status = ofono_gprs_get_status(gprs);
+	e->gprs_status_watch = __ofono_gprs_add_status_watch(e->gprs,
+					gprs_status_changed, e, NULL);
+
+	emulator_gprs_update(e);
+}
+
+static void add_gprs_watches(struct ofono_emulator *e)
+{
+	struct ofono_modem *modem = e->modem;
+	struct ofono_atom *gprs_atom;
+
+	e->gprs_watch = __ofono_modem_add_atom_watch(modem,
+					OFONO_ATOM_TYPE_GPRS,
+					gprs_watch, e, NULL);
+
+	gprs_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_GPRS);
+
+	if (gprs_atom && __ofono_atom_get_registered(gprs_atom))
+		gprs_watch(gprs_atom,
+				OFONO_ATOM_WATCH_CONDITION_REGISTERED, e);
+}
+
 int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 {
 	if (channel == NULL)
@@ -734,6 +814,8 @@ int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 	g_at_server_register(e->server, "+CGATT", cgatt_cb, e, NULL);
 	g_at_server_register(e->server, "+CGDCONT", cgdcont_cb, e, NULL);
 
+	add_gprs_watches(e);
+
 	return 0;
 }
 
@@ -761,6 +843,18 @@ static void emulator_remove(struct ofono_atom *atom)
 	if (e->server)
 		emulator_disable(e);
 
+	if (e->gprs_watch) {
+		if (e->gprs_status_watch) {
+			__ofono_gprs_remove_status_watch(e->gprs,
+						e->gprs_status_watch);
+			e->gprs_status_watch = 0;
+		}
+
+		__ofono_modem_remove_atom_watch(e->modem, e->gprs_watch);
+		e->gprs_watch = 0;
+		e->gprs = NULL;
+	}
+
 	e->status = OFONO_EMULATOR_STATUS_DESTROY;
 	notify_status_watches(e, NULL);
 
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#22 lore raw

PATCH 21/21 emulator: Watch netreg status changes

In reply to Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Watch netreg status update to notify DUN client, such as +CREG unsolicited result.

---
 src/emulator.c |  106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)
src/emulator.c +106 -0
index 7701510..3444461 100644
@@ -56,6 +56,9 @@ struct modem_settings {
 	int cops;
 	int attached;
 	int gprs_status;
+	int netreg_status;
+	int netreg_lac;
+	int netreg_ci;
 };
 
 struct ofono_emulator {
@@ -72,6 +75,9 @@ struct ofono_emulator {
 	struct ofono_gprs *gprs;
 	unsigned int gprs_watch;
 	unsigned int gprs_status_watch;
+	struct ofono_netreg *netreg;
+	unsigned int netreg_watch;
+	unsigned int netreg_status_watch;
 };
 
 static GSList *emulator_drivers = NULL;
@@ -265,12 +271,19 @@ static void creg_cb(GAtServerRequestType type, GAtResult *result,
 					gpointer user_data)
 {
 	struct ofono_emulator *e = user_data;
+	char buf[256];
 
 	switch (type) {
 	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
 		ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
 		break;
 	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		snprintf(buf, sizeof(buf), "+CREG: %d, %x, %x, %x",
+						e->settings.creg,
+						e->settings.netreg_status,
+						e->settings.netreg_lac,
+						e->settings.netreg_ci);
+		ofono_emulator_send_info(e, buf, TRUE);
 		ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
 		break;
 	case G_AT_SERVER_REQUEST_TYPE_SET:
@@ -790,6 +803,86 @@ static void add_gprs_watches(struct ofono_emulator *e)
 				OFONO_ATOM_WATCH_CONDITION_REGISTERED, e);
 }
 
+static void emulator_netreg_update(struct ofono_emulator *e)
+{
+	GAtServer *server = e->server;
+	char buf[256];
+
+	switch (e->settings.creg) {
+	case 0:
+		break;
+	case 1:
+		snprintf(buf, sizeof(buf), "+CREG: %d",
+						e->settings.netreg_status);
+		g_at_server_send_unsolicited(server, buf);
+		break;
+	case 2:
+		snprintf(buf, sizeof(buf), "+CREG: %d, %x, %x",
+						e->settings.netreg_status,
+						e->settings.netreg_lac,
+						e->settings.netreg_ci);
+		g_at_server_send_unsolicited(server, buf);
+		break;
+	default:
+		break;
+	}
+}
+
+static void netreg_status_changed(int status, int lac, int ci, int tech,
+					const char *mcc, const char *mnc,
+					void *data)
+{
+	struct ofono_emulator *e = data;
+
+	DBG("%d %d %d", status, lac, ci);
+
+	e->settings.netreg_status = status;
+	e->settings.netreg_lac = lac;
+	e->settings.netreg_ci = ci;
+
+	emulator_netreg_update(e);
+}
+
+static void netreg_watch(struct ofono_atom *atom,
+				enum ofono_atom_watch_condition cond,
+				void *data)
+{
+	struct ofono_emulator *e = data;
+	struct ofono_netreg *netreg;
+
+	if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+		e->netreg_status_watch = 0;
+		e->netreg = NULL;
+		return;
+	}
+
+	netreg = __ofono_atom_get_data(atom);
+	e->netreg = netreg;
+	e->settings.netreg_status = ofono_netreg_get_status(netreg);
+	e->settings.netreg_lac = ofono_netreg_get_location(netreg);
+	e->settings.netreg_ci = ofono_netreg_get_cellid(netreg);
+	e->netreg_status_watch = __ofono_netreg_add_status_watch(e->netreg,
+					netreg_status_changed, e, NULL);
+
+	emulator_netreg_update(e);
+}
+
+static void add_netreg_watches(struct ofono_emulator *e)
+{
+	struct ofono_modem *modem = e->modem;
+	struct ofono_atom *netreg_atom;
+
+	e->netreg_watch = __ofono_modem_add_atom_watch(modem,
+					OFONO_ATOM_TYPE_NETREG,
+					netreg_watch, e, NULL);
+
+	netreg_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_NETREG);
+
+	if (netreg_atom && __ofono_atom_get_registered(netreg_atom))
+		netreg_watch(netreg_atom,
+				OFONO_ATOM_WATCH_CONDITION_REGISTERED, e);
+}
+
 int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 {
 	if (channel == NULL)
@@ -815,6 +908,7 @@ int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 	g_at_server_register(e->server, "+CGDCONT", cgdcont_cb, e, NULL);
 
 	add_gprs_watches(e);
+	add_netreg_watches(e);
 
 	return 0;
 }
@@ -855,6 +949,18 @@ static void emulator_remove(struct ofono_atom *atom)
 		e->gprs = NULL;
 	}
 
+	if (e->netreg_watch) {
+		if (e->netreg_status_watch) {
+			__ofono_netreg_remove_status_watch(e->netreg,
+						e->netreg_status_watch);
+			e->netreg_status_watch = 0;
+		}
+
+		__ofono_modem_remove_atom_watch(e->modem, e->netreg_watch);
+		e->netreg_watch = 0;
+		e->netreg = NULL;
+	}
+
 	e->status = OFONO_EMULATOR_STATUS_DESTROY;
 	notify_status_watches(e, NULL);
 
Signature · 13 lines
1.7.1

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#23 lore raw
In reply to Frédéric Dalleau
Quoted 1 line · you

This is rebased as of head of today

This seems quite useless work to me.

There are a number of AT commands that are required but really do not belong in oFono. Consider for example AT+CKPD/AT+CTSA/AT+CMEC input emulation and AT+CBC* battery notifications. Those things have nothing to do with Cellular other than the C in the command prefix. Then we have commands that are related to cellular functionality but higher-level than oFono, like AT+CPB* for phonebook.

Now, I recognize this patch only attempts to provide BT DUN profile, not the whole 27.007 set. But doing that in userspace in oFono is probably the slowest and most inefficient approach to the problem. And MeeGo will have to solve the more general problem in any case, if MeeGo cellular devices are to be certified.

Signature · 2 lines
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
#24 lore raw
Quoted 1 line · Rémi Denis-Courmont

This seems quite useless work to me.

This patch has been on the list for some time now. Why didn't you express your concern before that?

Quoted 2 lines

There are a number of AT commands that are required but really do not belong in oFono...

For sure nobody wants oFono depend on everything in the world. But at some point, one component will need to do the final job of handling the AT command. Whether it is oFono or something else I personally don't bother. Having it inside oFono through the plugin mechanism will avoid some additional layer of IPC.

Quoted 2 lines

But doing that in userspace in oFono is probably the slowest
and most inefficient approach to the problem.

Nowadays, relaying a gprs connection at 56k doesn't need to be done in a kernel module.
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#25 lore raw
Quoted 5 lines · you
Quoted 1 line · Rémi Denis-Courmont

This seems quite useless work to me.

This patch has been on the list for some time now. Why didn't you express your concern before that?

I did point out limitations on some earlier occasion.

I also pointed out the problem to Aki and Marcel privately a long time ago.

Quoted 5 lines
Quoted 2 lines

But doing that in userspace in oFono is probably the slowest
and most inefficient approach to the problem.

Nowadays, relaying a gprs connection at 56k doesn't need to be done in a kernel module.

HSPA category certification is achieved with PPP over USB and using the "final user" software. So we are talking about bandwidth in the 10 Mb/s order of magnitude on contemporary products.

Signature · 2 lines
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
#26 lore raw
Quoted 2 lines · Rémi Denis-Courmont

HSPA category certification is achieved with PPP over USB and using the "final user" software. So we are talking about bandwidth in the 10 Mb/s order

This is another story. The patch uses the oFono ppp layer. This is the author's choice and I respect this choice.

Why do you think it cannot handle your requirements?
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#27 lore raw
Quoted 9 lines · you
Quoted 3 lines · Rémi Denis-Courmont

HSPA category certification is achieved with PPP over USB and using the "final user" software. So we are talking about bandwidth in the 10 Mb/s order

This is another story. The patch uses the oFono ppp layer. This is the author's choice and I respect this choice.

Why do you think it cannot handle your requirements?

I don't know if it can. I am only pointing out that we are not talking about orders of magnitude higher bandwidth than V90 which you invoked.

Signature · 2 lines
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
#3 lore raw

Re: [PATCH 02/21] bluetooth: Add Btio library for DUN

In reply to Frédéric Dalleau

Hi Frédéric,

Quoted 5 lines · Frédéric Dalleau

From: Zhenhua Zhang <[email protected]>

Btio library is the low level socket API for BT RFCOMM connection. We share the same library among BlueZ, Obex and oFono. So make sure you synchronize to other two projects when you make changes to btio.[ch].

Quoted 9 lines
---
 Makefile.am  |    8 +-
 btio/btio.c  | 1299 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 btio/btio.h  |   97 +++++
 configure.ac |    5 +
 4 files changed, 1407 insertions(+), 2 deletions(-)
 create mode 100644 btio/btio.c
 create mode 100644 btio/btio.h

This patch has been applied, thanks.

Regards,
-Denis

#28 lore raw
In reply to Frédéric Dalleau

Hi all,

Quoted 37 lines · Frédéric Dalleau

This is rebased as of head of today

Zhenhua Zhang (21):
bluetooth: Add reference count for bluetooth utils
bluetooth: Add Btio library for DUN
bluetooth: Add bluetooth server support for DUN
emulator: Add emulator atom in oFono
dun_gw: Add DUN server plugin for oFono
gprs: Rename status_watch to netreg_status_watch
emulator: Add status watches for ofono emulator
emulator: Add emulator status watches in gprs atom
emulator: Add APIs to send GAtServer result
emulator: Implement dialing up for DUN
gprs: Make gprs_proto_to/from_string non-static
gprs: ignore the case of proto str when comparing
emulator: Register mandatory AT command handlers
gprs: Refactor to share remove_context method
gprs: Add DUN +CGATT support in gprs atom
gprs: Add DUN +CGDCONT support in gprs atom
gprs: Add DUN server GPRS connect support
gprs: Add status watch functions
gprs: Add gprs_get_status
emulator: Watch GPRS status changes
emulator: Watch netreg status changes

 Makefile.am            |   15 +-
 btio/btio.c            | 1299 ++++++++++++++++++++++++++++++++++++++++++++++++
 btio/btio.h            |   97 ++++
 configure.ac           |    5 +
 include/emulator.h     |   94 ++++
 include/gprs-context.h |    4 +
 include/gprs.h         |   11 +
 plugins/bluetooth.c    |  441 ++++++++++++++++-
 plugins/bluetooth.h    |   15 +
 plugins/dun_gw.c       |  115 +++++
 src/emulator.c         | 1072 +++++++++++++++++++++++++++++++++++++++
 src/gprs.c             |  500 +++++++++++++++++--
Quoted 8 lines
 src/modem.c            |    1 +
 src/ofono.h            |   31 ++
 14 files changed, 3636 insertions(+), 64 deletions(-)
 create mode 100644 btio/btio.c
 create mode 100644 btio/btio.h
 create mode 100644 include/emulator.h
 create mode 100644 plugins/dun_gw.c
 create mode 100644 src/emulator.c

So I took this patches as a base to finish the DUN implementation on oFono. The DUN Server is now working, it accepts a ATD*99 from the client and start the PPP negotiation, then create the ppp interface to flow the internet connection to the client. Code is here:

git://git.profusion.mobi/users/padovan/ofono.git dun

This not rebased upstream because I didn't touch the bluetooth patches yet, mostly due the fact that Frédéric Danis is working on them.

The next step is to implement the packet forwarding to the ppp interface inside ConnMan, you can follow the discussion and implementation in the ConnMan mailing list.

http://www.mail-archive.com/connman(a)connman.net/msg03092.html

Signature · 2 lines
Gustavo F. Padovan
http://profusion.mobi