Skip to contentSkip to conversation

sap: add basic sap plugin

PATCH New Gustavo F. Padovan 1 participant 1 message Sep 22, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sap: add basic sap plugin

From: "Gustavo F. Padovan" <[email protected]>

---
 Makefile.am         |    3 +
 plugins/bluetooth.c |    1 -
 plugins/bluetooth.h |   12 +++
 plugins/hfp_hf.c    |    2 -
 plugins/sap.c       |  266 +++++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/telit.c     |   10 ++
 6 files changed, 291 insertions(+), 3 deletions(-)
 create mode 100644 plugins/sap.c
Makefile.am +3 -0
index 71962ea..8771cb2 100644
@@ -369,6 +369,9 @@ builtin_sources += plugins/hfp_ag.c plugins/bluetooth.h
 builtin_modules += dun_gw
 builtin_sources += plugins/dun_gw.c plugins/bluetooth.h
 
+builtin_modules += sap
+builtin_sources += plugins/sap.c plugins/bluetooth.h
+
 builtin_modules += connman
 builtin_sources += plugins/connman.c
 
plugins/bluetooth.c +0 -1
index a286dd4..274d25b 100644
@@ -33,7 +33,6 @@
 #include <gdbus.h>
 
 #define OFONO_API_SUBJECT_TO_CHANGE
-#include <ofono/dbus.h>
 #include <ofono/plugin.h>
 #include <ofono/log.h>
 
plugins/bluetooth.h +12 -0
index 4056f0a..b21ab64 100644
@@ -19,6 +19,9 @@
  *
  */
 
+#include <ofono/modem.h>
+#include <ofono/dbus.h>
+
 #define	BLUEZ_SERVICE "org.bluez"
 #define	BLUEZ_MANAGER_INTERFACE		BLUEZ_SERVICE ".Manager"
 #define	BLUEZ_ADAPTER_INTERFACE		BLUEZ_SERVICE ".Adapter"
@@ -30,6 +33,7 @@
 #define DUN_GW_UUID	"00001103-0000-1000-8000-00805f9b34fb"
 #define HFP_AG_UUID	"0000111f-0000-1000-8000-00805f9b34fb"
 #define HFP_HS_UUID	"0000111e-0000-1000-8000-00805f9b34fb"
+#define SAP_UUID	"0000112d-0000-1000-8000-00805f9b34fb"
 
 struct bluetooth_profile {
 	const char *name;
@@ -39,6 +43,10 @@ struct bluetooth_profile {
 	void (*set_alias)(const char *device, const char *);
 };
 
+struct bluetooth_sap_driver {
+	const char *name;
+};
+
 struct server;
 
 typedef void (*ConnectFunc)(GIOChannel *io, GError *err, gpointer user_data);
@@ -60,3 +68,7 @@ int bluetooth_send_with_reply(const char *path, const char *interface,
 				void *user_data, DBusFreeFunction free_func,
 				int timeout, int type, ...);
 void bluetooth_parse_properties(DBusMessage *reply, const char *property, ...);
+
+int bluetooth_sap_client_register(struct bluetooth_sap_driver *sap,
+					struct ofono_modem *modem);
+void bluetooth_sap_client_unregister(struct ofono_modem *modem);
plugins/hfp_hf.c +0 -2
index 0c6ed83..d5f26c0 100644
@@ -45,8 +45,6 @@
 
 #include <drivers/hfpmodem/slc.h>
 
-#include <ofono/dbus.h>
-
 #include "bluetooth.h"
 
 #define	BLUEZ_GATEWAY_INTERFACE		BLUEZ_SERVICE ".HandsfreeGateway"
plugins/sap.c new file +266 -0

266 lines not on this page · raw message

plugins/telit.c +10 -0
index 9c8eb0d..18cf0c4 100644
@@ -54,6 +54,8 @@
 #include <drivers/atmodem/atutil.h>
 #include <drivers/atmodem/vendor.h>
 
+#include "bluetooth.h"
+
 static const char *none_prefix[] = { NULL };
 static const char *qss_prefix[] = { "#QSS:", NULL };
 
@@ -63,6 +65,10 @@ struct telit_data {
 	guint sim_inserted_source;
 };
 
+static struct bluetooth_sap_driver sap_driver = {
+	.name = "telit",
+};
+
 static void telit_debug(const char *str, void *user_data)
 {
 	const char *prefix = user_data;
@@ -82,6 +88,8 @@ static int telit_probe(struct ofono_modem *modem)
 
 	ofono_modem_set_data(modem, data);
 
+	bluetooth_sap_client_register(&sap_driver, modem);
+
 	return 0;
 }
 
@@ -91,6 +99,8 @@ static void telit_remove(struct ofono_modem *modem)
 
 	DBG("%p", modem);
 
+	bluetooth_sap_client_unregister(modem);
+
 	ofono_modem_set_data(modem, NULL);
 
 	if (data->sim_inserted_source > 0)
Signature · 1 line
1.7.6.2