[RFC v4 5/8] dbusoob: Add support for Class in AddRemoteData

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Class received in AddRemoteData is stored for future use when device
object is created.

---
 plugins/dbusoob.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index 2ae80fa..97de9c0 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -43,6 +43,7 @@
 #include "event.h"
 #include "error.h"
 #include "oob.h"
+#include "storage.h"
 
 #define OOB_INTERFACE	"org.bluez.OutOfBand"
 
@@ -55,6 +56,7 @@ struct oob_data {
 	char *addr;
 	uint8_t *hash;
 	uint8_t *randomizer;
+	uint32_t class;
 };
 
 static GSList *oob_requests = NULL;
@@ -189,6 +191,12 @@ static gboolean parse_data(DBusMessageIter *data, struct oob_data *remote_data)
 
 			if (size != 16)
 				return FALSE;
+		} else if (strcasecmp(key, "Class") == 0) {
+			if (var != DBUS_TYPE_UINT32)
+				return FALSE;
+
+			dbus_message_iter_get_basic(&value,
+							&remote_data->class);
 		}
 
 		dbus_message_iter_next(data);
@@ -223,6 +231,13 @@ static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data)
 			return FALSE;
 	}
 
+	if (data->class) {
+		bdaddr_t local;
+		adapter_get_address(adapter, &local);
+
+		write_remote_class(&local, &bdaddr, data->class);
+	}
+
 	return TRUE;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux