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 v8 2/6] proximity: reporter: save global D-Bus connection
Date: Mon,  2 Apr 2012 22:12:38 +0300	[thread overview]
Message-ID: <1333393962-21394-2-git-send-email-arik@wizery.com> (raw)
In-Reply-To: <1333393962-21394-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 bbb97ea..c5a3bb8 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -52,6 +52,8 @@ enum {
 	HIGH_ALERT = 0x02,
 };
 
+static DBusConnection *connection;
+
 static void register_link_loss(struct btd_adapter *adapter)
 {
 	uint16_t start_handle, h;
@@ -179,6 +181,9 @@ int reporter_init(struct btd_adapter *adapter)
 		return -ENOTSUP;
 	}
 
+	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+	if (connection == NULL)
+		return -EIO;
 	DBG("Proximity Reporter for adapter %p", adapter);
 
 	register_link_loss(adapter);
@@ -190,4 +195,5 @@ int reporter_init(struct btd_adapter *adapter)
 
 void reporter_exit(struct btd_adapter *adapter)
 {
+	dbus_connection_unref(connection);
 }
-- 
1.7.5.4


  reply	other threads:[~2012-04-02 19:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 19:12 [PATCH v8 1/6] att: add remote btd_device to ATT read/write callbacks Arik Nemtsov
2012-04-02 19:12 ` Arik Nemtsov [this message]
2012-04-02 19:12 ` [PATCH v8 3/6] proximity: reporter: move definitions to .h and add util function Arik Nemtsov
2012-04-02 19:12 ` [PATCH v8 4/6] proximity: link loss: implement link loss server Arik Nemtsov
2012-04-02 19:12 ` [PATCH v8 5/6] proximity: immediate alert: implement immediate alert server Arik Nemtsov
2012-04-02 19:12 ` [PATCH v8 6/6] proximity: reporter: implement D-Bus API Arik Nemtsov
2012-04-03 10:52 ` [PATCH v8 1/6] att: add remote btd_device to ATT read/write callbacks 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=1333393962-21394-2-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).