All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Danis <frederic.danis@access-company.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] RemoteNameRequested signal during discovery patch
Date: Fri, 09 Mar 2007 14:50:40 +0100	[thread overview]
Message-ID: <45F16630.9000606@access-company.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Hello,

I wrote a little patch to add a DBus signal when a remote name is asked 
by the service daemon during discovery, so discovery applications can 
display this information to user.

Regards

Fred

-- 
-----------------------------------------------
It is not by improving the oil lamp that one invents the electric bulb!
-----------------------------------------------
Danis Frederic                   Access Company
Software engineer
Mail : mailto:frederic.danis@access-company.com
-----------------------------------------------


[-- Attachment #2: hcid_name_requested_signal.patch --]
[-- Type: text/plain, Size: 2735 bytes --]

? hcid/.deps
? hcid/.libs
? hcid/Makefile
? hcid/Makefile.in
? hcid/hcid
? hcid/lexer.c
? hcid/parser.c
? hcid/parser.h
Index: hcid/dbus-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-api.txt,v
retrieving revision 1.108
diff -u -r1.108 dbus-api.txt
--- hcid/dbus-api.txt	6 Mar 2007 13:37:39 -0000	1.108
+++ hcid/dbus-api.txt	9 Mar 2007 11:14:46 -0000
@@ -1021,6 +1021,11 @@
 			This signal will be sent every time the service daemon
 			tries to resolve a remote and this fails.
 
+		void RemoteNameRequested(string address)
+
+			This signal will be sent every time the service daemon
+			tries to resolve a remote name during discovery.
+
 		void RemoteAliasChanged(string address, string alias)
 
 			After changing an alias with SetRemoteAlias this
Index: hcid/dbus-hci.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-hci.c,v
retrieving revision 1.16
diff -u -r1.16 dbus-hci.c
--- hcid/dbus-hci.c	26 Feb 2007 14:13:50 -0000	1.16
+++ hcid/dbus-hci.c	9 Mar 2007 11:14:47 -0000
@@ -1005,7 +1005,7 @@
 
 	/* send at least one request or return failed if the list is empty */
 	do {
-		DBusMessage *failed_signal = NULL;
+		DBusMessage *signal = NULL;
 		struct remote_dev_info *dev = l->data;
 		char *peer_addr;
 		bdaddr_t tmp;
@@ -1023,7 +1023,7 @@
 		if (hci_send_req(dd, &rq, 500) < 0) {
 			error("Unable to send the HCI remote name request: %s (%d)",
 						strerror(errno), errno);
-			failed_signal = dev_signal_factory(adapter->dev_id,
+			signal = dev_signal_factory(adapter->dev_id,
 						"RemoteNameFailed",
 						DBUS_TYPE_STRING, &peer_addr,
 						DBUS_TYPE_INVALID);
@@ -1032,21 +1032,30 @@
 		if (rp.status) {
 			error("Remote name request failed with status 0x%02x",
 					rp.status);
-			failed_signal = dev_signal_factory(adapter->dev_id,
+			signal = dev_signal_factory(adapter->dev_id,
 						"RemoteNameFailed",
 						DBUS_TYPE_STRING, &peer_addr,
 						DBUS_TYPE_INVALID);
 		}
 
-		free(peer_addr);
-
-		if (!failed_signal) {
+		if (!signal) {
 			req_sent = 1;
-			break;
+			/* if we are in discovery, inform application of getting name */
+			if (adapter->discov_type & (STD_INQUIRY | PERIODIC_INQUIRY)) {
+				signal = dev_signal_factory(adapter->dev_id,
+							"RemoteNameRequested",
+							DBUS_TYPE_STRING, &peer_addr,
+							DBUS_TYPE_INVALID);
+			} else {
+				free(peer_addr);
+				break;
+			}
 		}
 
-		send_message_and_unref(connection, failed_signal);
-		failed_signal = NULL;
+		free(peer_addr);
+
+		send_message_and_unref(connection, signal);
+		signal = NULL;
 
 		/* if failed, request the next element */
 		/* remove the element from the list */

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

             reply	other threads:[~2007-03-09 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-09 13:50 Frederic Danis [this message]
2007-03-30 16:09 ` [Bluez-devel] RemoteNameRequested signal during discovery patch Frederic Danis
2007-03-30 16:13   ` Marcel Holtmann
2007-03-30 16:49     ` Frederic Danis
2007-03-31 15:25     ` Johan Hedberg
2007-04-03 19:05       ` Marcel Holtmann
2007-04-24 17:29         ` Frederic Danis
2007-04-24 18:20           ` Marcel Holtmann

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=45F16630.9000606@access-company.com \
    --to=frederic.danis@access-company.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.