Skip to contentSkip to conversation

GetMajorClass

PATCH In review Claudio Takahasi 2 participants 2 messages Feb 23, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GetMajorClass

Hi Marcel,

Here is the GetMajorClass service implemented according to your
suggestion: it is returning "computer" for now.

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

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

dbus-device.c +15 -0
diff -u -r1.10 dbus-device.c
@@ -100,6 +100,20 @@
 	return reply;
 }
 
+static DBusMessage* handle_dev_get_major_class_req(DBusMessage *msg, void *data)
+{
+	DBusMessage *reply;
+	const char *str_ptr = "computer";
+
+	reply = dbus_message_new_method_return(msg);
+
+	/*FIXME: Check the real device major class */
+	dbus_message_append_args(reply, DBUS_TYPE_STRING, &str_ptr,
+					DBUS_TYPE_INVALID);
+
+	return reply;
+}
+
 static DBusMessage* handle_dev_get_manufacturer_req(DBusMessage *msg, void *data)
 {
 	struct hci_dbus_data *dbus_data = data;
@@ -807,6 +821,7 @@
 	{ DEV_GET_COMPANY,		handle_dev_get_company_req,		DEV_GET_COMPANY_SIGNATURE		},
 	{ DEV_GET_DISCOVERABLE_TO,	handle_dev_get_discoverable_to_req,	DEV_GET_DISCOVERABLE_TO_SIGNATURE	},
 	{ DEV_GET_FEATURES,		handle_dev_get_features_req,		DEV_GET_FEATURES_SIGNATURE		},
+	{ DEV_GET_MAJOR_CLASS,		handle_dev_get_major_class_req,		DEV_GET_MAJOR_CLASS_SIGNATURE		},
 	{ DEV_GET_MANUFACTURER,		handle_dev_get_manufacturer_req,	DEV_GET_MANUFACTURER_SIGNATURE		},
 	{ DEV_GET_MODE,			handle_dev_get_mode_req,		DEV_GET_MODE_SIGNATURE			},
 	{ DEV_GET_NAME,			handle_dev_get_name_req,		DEV_GET_NAME_SIGNATURE			},

Index: hcid/dbus.h
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus.h,v
retrieving revision 1.28

dbus.h +2 -0
diff -u -r1.28 dbus.h
@@ -112,6 +112,7 @@
 #define DEV_GET_COMPANY			"GetCompany"
 #define DEV_GET_DISCOVERABLE_TO		"GetDiscoverableTimeout"
 #define DEV_GET_FEATURES		"GetFeatures"
+#define DEV_GET_MAJOR_CLASS		"GetMajorClass"
 #define DEV_GET_MANUFACTURER		"GetManufacturer"
 #define DEV_GET_MODE			"GetMode"
 #define DEV_GET_NAME			"GetName"
@@ -146,6 +147,7 @@
 #define DEV_GET_COMPANY_SIGNATURE			__END_SIG__
 #define DEV_GET_DISCOVERABLE_TO_SIGNATURE		__END_SIG__
 #define DEV_GET_FEATURES_SIGNATURE			__END_SIG__
+#define DEV_GET_MAJOR_CLASS_SIGNATURE			__END_SIG__
 #define DEV_GET_MANUFACTURER_SIGNATURE			__END_SIG__
 #define DEV_GET_MODE_SIGNATURE				__END_SIG__
 #define DEV_GET_NAME_SIGNATURE				__END_SIG__
maintainer
#1 lore raw

Hi Claudio,

Quoted 2 lines

Here is the GetMajorClass service implemented according to your
suggestion: it is returning "computer" for now.

the patch has been applied. Thanks.

The whole topic with the class of device settings is still open for discussion. However after reading the specification once again, I figured that we have to make the major class a config file option and not changeable by the user. It will be getting too complex if we wanna add support for access points or other classes that make use of the minor device class in a different way. My current approach is to make the major class and service classes readable and the minor class is also changeable if the major class is "computer".

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel