linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arik Nemtsov <arik@wizery.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Arik Nemtsov <arik@wizery.com>
Subject: [PATCH 4/8] proximity: reporter: save global D-Bus connection
Date: Thu,  8 Mar 2012 15:57:08 +0200	[thread overview]
Message-ID: <1331215032-27695-5-git-send-email-arik@wizery.com> (raw)
In-Reply-To: <1331215032-27695-1-git-send-email-arik@wizery.com>

This connection will be used by reporter GATT sub-profiles.
---
 proximity/reporter.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/proximity/reporter.c b/proximity/reporter.c
index 9777574..f7744f5 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -29,6 +29,7 @@
 #include <glib.h>
 #include <bluetooth/uuid.h>
 #include <adapter.h>
+#include <errno.h>
 
 #include "log.h"
 
@@ -38,6 +39,7 @@
 #include "attrib-server.h"
 #include "reporter.h"
 
+static DBusConnection *connection;
 #define IMMEDIATE_ALERT_SVC_UUID	0x1802
 #define LINK_LOSS_SVC_UUID		0x1803
 #define TX_POWER_SVC_UUID		0x1804
@@ -177,6 +179,9 @@ int reporter_init(struct btd_adapter *adapter)
 		return -1;
 	}
 
+	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+	if (connection == NULL)
+		return -EIO;
 	DBG("Proximity Reporter for adapter %p", adapter);
 
 	register_link_loss(adapter);
@@ -188,4 +193,5 @@ int reporter_init(struct btd_adapter *adapter)
 
 void reporter_exit(struct btd_adapter *adapter)
 {
+	dbus_connection_unref(connection);
 }
-- 
1.7.5.4


  parent reply	other threads:[~2012-03-08 13:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 13:57 [PATCH 0/8] Implement ProximityReporter profiles Arik Nemtsov
2012-03-08 13:57 ` [PATCH 1/8] att: add remote btd_device to ATT read/write callbacks Arik Nemtsov
2012-03-08 13:57 ` [PATCH 2/8] adapter: add API to find an existing device by D-Bus path Arik Nemtsov
2012-03-08 13:57 ` [PATCH 3/8] adapter: add DeviceAdded signal when existing device is added Arik Nemtsov
2012-03-08 13:57 ` Arik Nemtsov [this message]
2012-03-08 13:57 ` [PATCH 5/8] proximity: reporter: move definitions to .h and add util function Arik Nemtsov
2012-03-08 13:57 ` [PATCH 6/8] proximity: link loss: implement link loss server Arik Nemtsov
2012-03-14 13:09   ` Anderson Lizardo
2012-03-14 20:54     ` Arik Nemtsov
2012-03-08 13:57 ` [PATCH 7/8] proximity: immediate alert: implement immediate alert server Arik Nemtsov
2012-03-08 13:57 ` [PATCH 8/8] proximity: reporter: implement D-Bus API Arik Nemtsov
2012-03-14 13:19   ` Anderson Lizardo
2012-03-14 20:56     ` Arik Nemtsov

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=1331215032-27695-5-git-send-email-arik@wizery.com \
    --to=arik@wizery.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).