Skip to contentSkip to conversation

Patch: GetRemoteClass

Bluez-devel Denis KENZIOR 3 participants 4 messages Aug 1, 2006 – Aug 9, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

All,

Attached is a patch to get remote class of device information as a uint32. This introduces a new method with signature:
uint32 GetRemoteClass(string address), which returns the class of device information encoded as a 32 bit integer.

The reasoning is that some applications might want to rely on their own conversion routines for the Major, Minor and Service class attributes, and thus the DBUS GetRemoteMajorClass, GetRemoteMinorClass, etc methods that return strings are not useful.

Thoughts?

-Denis

Index: dbus-adapter.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-adapter.c,v retrieving revision 1.67

dbus-adapter.c +21 -0
diff -u -r1.67 dbus-adapter.c
@@ -1276,6 +1276,26 @@
 	return send_reply_and_unref(conn, reply);
 }
 
+static DBusHandlerResult handle_dev_get_remote_class_req(DBusConnection *conn,
+								DBusMessage *msg,
+								void *data)
+{
+	DBusMessage *reply;
+	uint32_t class;
+
+	if (get_remote_class(conn, msg, data, &class) < 0)
+		return DBUS_HANDLER_RESULT_HANDLED;
+
+	reply = dbus_message_new_method_return(msg);
+	if (!reply)
+		return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+	dbus_message_append_args(reply, DBUS_TYPE_UINT32, &class,
+					DBUS_TYPE_INVALID);
+
+	return send_reply_and_unref(conn, reply);
+}
+
 static DBusHandlerResult handle_dev_get_remote_name_req(DBusConnection *conn, DBusMessage *msg, void *data)
 {
 	char filename[PATH_MAX + 1];
@@ -2333,6 +2353,7 @@
 	{ "GetRemoteMajorClass",			handle_dev_get_remote_major_class_req	},
 	{ "GetRemoteMinorClass",			handle_dev_get_remote_minor_class_req	},
 	{ "GetRemoteServiceClasses",			handle_dev_get_remote_service_cls_req	},
+	{ "GetRemoteClass",				handle_dev_get_remote_class_req		},
 	{ "GetRemoteName",				handle_dev_get_remote_name_req		},
 	{ "GetRemoteAlias",				handle_dev_get_remote_alias_req		},
 	{ "SetRemoteAlias",				handle_dev_set_remote_alias_req		},

Index: dbus-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-api.txt,v retrieving revision 1.39

dbus-api.txt +8 -0
diff -u -r1.39 dbus-api.txt
@@ -461,6 +461,14 @@
 			Possible errors: org.bluez.Error.InvalidArguments
 			                 org.bluez.Error.NotAvailable
 
+		uint32 GetRemoteClass(string address)
+
+			Get the remote major, minor, and service classes 
+			encoded as 32 bit integer.
+
+			Possible errors: org.bluez.Error.InvalidArguments
+					 org.bluez.Error.NotAvailable
+
 		string GetRemoteName(string address)
 
 			Get adapter name for a remote device. This request

-------------------------------------------------------------------------
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

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Denis,

Quoted 9 lines

Attached is a patch to get remote class of device information as a uint32. This introduces a new method with signature:
uint32 GetRemoteClass(string address), which returns the class of device information encoded as a 32 bit integer.

The reasoning is that some applications might want to rely on their own conversion routines for the Major, Minor and Service class attributes, and thus the DBUS GetRemoteMajorClass, GetRemoteMinorClass, etc methods that return strings are not useful.

the patch is clean. So before I apply it and so extend the API, does someone else thinks it is useful to have?

Regards

Marcel

-------------------------------------------------------------------------
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
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Hi All,

Quoted 7 lines · Marcel Holtmann

Hi Denis,

Quoted 5 lines

Attached is a patch to get remote class of device information as a uint32. This introduces a new method with signature:
uint32 GetRemoteClass(string address), which returns the class of device information encoded as a 32 bit integer.

Quoted 8 lines
Quoted 4 lines

The reasoning is that some applications might want to rely on their own conversion routines for the Major, Minor and Service class attributes, and thus the DBUS GetRemoteMajorClass, GetRemoteMinorClass, etc methods that return strings are not useful.

the patch is clean. So before I apply it and so extend the API, does someone else thinks it is useful to have?

I'm currently not using the DBUS API, but I think this would be something very usefull.

Ciao,

Peter

-------------------------------------------------------------------------
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
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#3 lore raw

Hi Peter,

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Attached is a patch to get remote class of device information as a uint32. This introduces a new method with signature:
uint32 GetRemoteClass(string address), which returns the class of device information encoded as a 32 bit integer.

The reasoning is that some applications might want to rely on their own conversion routines for the Major, Minor and Service class attributes, and thus the DBUS GetRemoteMajorClass, GetRemoteMinorClass, etc methods that return strings are not useful.

Quoted 5 lines
Quoted 3 lines

the patch is clean. So before I apply it and so extend the API, does someone else thinks it is useful to have?

I'm currently not using the DBUS API, but I think this would be something very usefull.

that's fair enough. I applied the patch to the CVS now.

Regards

Marcel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel