Skip to contentSkip to conversation

BondingCreated && BondingFailed

PATCH In review Claudio Takahasi 2 participants 4 messages Feb 17, 2006 – Feb 20, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BondingCreated && BondingFailed

Hi Marcel,

Here is another small patch...

According with the BlueZ D-Bus API the bonding result must be sent using the BondingCreated and BondingFailed signals.

In the current code, the bonding result the status is added in the signal argument.

The next step is start the development of the missing bonding
services: RemoveBonding, HasBonding and ListBonding.

Regards,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT

hcid/dbus.c +1 -3
@@ -457,16 +457,14 @@
 	snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id);
 
 	message = dbus_message_new_signal(path, DEVICE_INTERFACE,
-						DEV_SIG_BONDING_CREATED);
+						(!status?DEV_SIG_BONDING_CREATED:DEV_SIG_BONDING_FAILED));
 	if (message == NULL) {
 		syslog(LOG_ERR, "Can't allocate D-BUS remote name message");
 		goto failed;
 	}
 
-	/*FIXME: create the signal based on status value - BondingCreated or BondingFailed*/
 	dbus_message_append_args(message,
 					DBUS_TYPE_STRING, &peer_addr,
-					DBUS_TYPE_BYTE, &status,
 					DBUS_TYPE_INVALID);
 
 	if (dbus_connection_send(connection, message, NULL) == FALSE) {
maintainer
#1 lore raw

Hi Claudio,

Quoted 7 lines

Here is another small patch...

According with the BlueZ D-Bus API the bonding result must be sent using the BondingCreated and BondingFailed signals.

In the current code, the bonding result the status is added in the signal argument.

do something like

signal = status ? DEV_SIG_BONDING_CREATED : DEV_SIG_BONDING_FAILED;

and then call it with dbus_message_new_signal(..., signal).

This end up in cleaner code and is easier to understand later.

Quoted 2 lines

The next step is start the development of the missing bonding
services: RemoveBonding, HasBonding and ListBonding.

The textfile library should have all stuff for it all ready. So it should be really easy to add.

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Hi Marcel,

Quoted 10 lines · Marcel Holtmann

Hi Claudio,

Quoted 7 lines

Here is another small patch...

According with the BlueZ D-Bus API the bonding result must be sent using the BondingCreated and BondingFailed signals.

In the current code, the bonding result the status is added in the signal argument.

Quoted 7 lines

do something like

signal = status ? DEV_SIG_BONDING_CREATED : DEV_SIG_BONDING_FAILED;

and then call it with dbus_message_new_signal(..., signal).

This end up in cleaner code and is easier to understand later.

[Claudio Takahasi]
Modification done!

Quoted 6 lines
Quoted 3 lines

The next step is start the development of the missing bonding
services: RemoveBonding, HasBonding and ListBonding.

The textfile library should have all stuff for it all ready. So it should be really easy to add.

[Claudio Takahasi]
I've never checked the textfile functions. I will try understand the implemented functions and send you new patches soon.

Regards,
Claudio.

Quoted 8 lines

Regards

Marcel

Quoted 10 lines

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT

hcid/dbus.c +9 -4
@@ -453,6 +453,7 @@
 {
 	DBusMessage *message = NULL;
 	char *local_addr, *peer_addr;
+	const char *name;
 	bdaddr_t tmp;
 	char path[MAX_PATH_LENGTH];
 	int id;
@@ -468,17 +469,21 @@
 
 	snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id);
 
-	message = dbus_message_new_signal(path, DEVICE_INTERFACE,
-						DEV_SIG_BONDING_CREATED);
+	/*
+	 * 0x00: authentication request successfully completed
+	 * 0x01-0x0F: authentication request failed
+	 */
+	name = ( !status? DEV_SIG_BONDING_CREATED : DEV_SIG_BONDING_FAILED);
+
+	message = dbus_message_new_signal(path, DEVICE_INTERFACE, name);
+
 	if (message == NULL) {
 		syslog(LOG_ERR, "Can't allocate D-BUS remote name message");
 		goto failed;
 	}
 
-	/*FIXME: create the signal based on status value - BondingCreated or BondingFailed*/
 	dbus_message_append_args(message,
 					DBUS_TYPE_STRING, &peer_addr,
-					DBUS_TYPE_BYTE, &status,
 					DBUS_TYPE_INVALID);
 
 	if (dbus_connection_send(connection, message, NULL) == FALSE) {
maintainer
#3 lore raw

Hi Claudio,

Quoted 7 lines
Quoted 5 lines

signal = status ? DEV_SIG_BONDING_CREATED : DEV_SIG_BONDING_FAILED;

and then call it with dbus_message_new_signal(..., signal).

This end up in cleaner code and is easier to understand later.

Modification done!

and patch is applied to the CVS.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The next step is start the development of the missing bonding
services: RemoveBonding, HasBonding and ListBonding.

The textfile library should have all stuff for it all ready. So it should be really easy to add.

I've never checked the textfile functions. I will try understand the implemented functions and send you new patches soon.

Take a look at the GetAlias function. This will give you a nice example on how easy this will be.

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel