linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 4/6] client: add bluetooth transport driver
Date: Fri, 20 Jan 2012 11:49:59 +0200	[thread overview]
Message-ID: <1327053001-9506-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1327053001-9506-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 Makefile.am        |    1 +
 client/bluetooth.c |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 client/bluetooth.h |   25 +++++++++++++++++++
 client/manager.c   |   20 ++++++++-------
 4 files changed, 106 insertions(+), 9 deletions(-)
 create mode 100644 client/bluetooth.c
 create mode 100644 client/bluetooth.h

diff --git a/Makefile.am b/Makefile.am
index 32ccc89..6697fa1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -117,6 +117,7 @@ client_obex_client_SOURCES = $(gdbus_sources) $(gobex_sources) \
 				client/main.c src/log.h src/log.c \
 				client/manager.h client/manager.c \
 				client/session.h client/session.c \
+				client/bluetooth.h client/bluetooth.c \
 				client/sync.h client/sync.c \
 				client/pbap.h client/pbap.c \
 				client/ftp.h client/ftp.c \
diff --git a/client/bluetooth.c b/client/bluetooth.c
new file mode 100644
index 0000000..5bde9be
--- /dev/null
+++ b/client/bluetooth.c
@@ -0,0 +1,69 @@
+/*
+ *
+ *  OBEX Client
+ *
+ *  Copyright (C) 2012 Intel Corporation
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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 <errno.h>
+#include <inttypes.h>
+
+#include <glib.h>
+
+#include "log.h"
+#include "transport.h"
+#include "bluetooth.h"
+
+static guint bluetooth_connect(const char *source, const char *destination,
+				const char *service, uint16_t port,
+				obc_transport_func func, void *user_data)
+{
+	DBG("");
+
+	return 0;
+}
+
+static void bluetooth_disconnect(guint id)
+{
+	DBG("");
+}
+
+static struct obc_transport bluetooth = {
+	.name = "Bluetooth",
+	.connect = bluetooth_connect,
+	.disconnect = bluetooth_disconnect,
+};
+
+int bluetooth_init(void)
+{
+	DBG("");
+
+	return obc_transport_register(&bluetooth);
+}
+
+void bluetooth_exit(void)
+{
+	DBG("");
+
+	obc_transport_unregister(&bluetooth);
+}
diff --git a/client/bluetooth.h b/client/bluetooth.h
new file mode 100644
index 0000000..968e131
--- /dev/null
+++ b/client/bluetooth.h
@@ -0,0 +1,25 @@
+/*
+ *
+ *  OBEX Client
+ *
+ *  Copyright (C) 2011 Intel Corporation
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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
+ *
+ */
+
+int bluetooth_init(void);
+void bluetooth_exit(void);
diff --git a/client/manager.c b/client/manager.c
index 7841753..2e01e54 100644
--- a/client/manager.c
+++ b/client/manager.c
@@ -37,6 +37,7 @@
 #include "log.h"
 #include "session.h"
 #include "manager.h"
+#include "bluetooth.h"
 #include "opp.h"
 #include "ftp.h"
 #include "pbap.h"
@@ -557,11 +558,12 @@ static GDBusMethodTable client_methods[] = {
 
 static DBusConnection *conn = NULL;
 
-static struct target_module {
+static struct obc_module {
 	const char *name;
 	int (*init) (void);
 	void (*exit) (void);
-} targets[] = {
+} modules[] = {
+	{ "bluetooth", bluetooth_init, bluetooth_exit },
 	{ "opp", opp_init, opp_exit },
 	{ "ftp", ftp_init, ftp_exit },
 	{ "pbap", pbap_init, pbap_exit },
@@ -573,7 +575,7 @@ static struct target_module {
 int manager_init(void)
 {
 	DBusError derr;
-	struct target_module *target;
+	struct obc_module *module;
 
 	dbus_error_init(&derr);
 
@@ -593,11 +595,11 @@ int manager_init(void)
 		return -1;
 	}
 
-	for (target = targets; target && target->init; target++) {
-		if (target->init() < 0)
+	for (module = modules; module && module->init; module++) {
+		if (module->init() < 0)
 			continue;
 
-		DBG("Target %s loaded", target->name);
+		DBG("Module %s loaded", module->name);
 	}
 
 	return 0;
@@ -605,13 +607,13 @@ int manager_init(void)
 
 void manager_exit(void)
 {
-	struct target_module *target;
+	struct obc_module *module;
 
 	if (conn == NULL)
 		return;
 
-	for (target = targets; target && target->exit; target++)
-		target->exit();
+	for (module = modules; module && module->exit; module++)
+		module->exit();
 
 	g_dbus_unregister_interface(conn, CLIENT_PATH, CLIENT_INTERFACE);
 	dbus_connection_unref(conn);
-- 
1.7.7.5


  parent reply	other threads:[~2012-01-20  9:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20  9:49 [PATCH obexd 1/6] client: fix circular dependency of session and transfer Luiz Augusto von Dentz
2012-01-20  9:49 ` [PATCH obexd 2/6] client: remove unused field Luiz Augusto von Dentz
2012-01-20  9:49 ` [PATCH obexd 3/6] client: add support for transport drivers Luiz Augusto von Dentz
2012-01-20  9:49 ` Luiz Augusto von Dentz [this message]
2012-01-20  9:50 ` [PATCH obexd 5/6] client: move bluetooth specific code from session.c to bluetooth.c Luiz Augusto von Dentz
2012-01-20  9:50 ` [PATCH obexd 6/6] client: simplify handling of D-Bus pending calls in bluetooth.c Luiz Augusto von Dentz
2012-01-20 15:05 ` [PATCH obexd 1/6] client: fix circular dependency of session and transfer Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327053001-9506-4-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).