[PATCH v2 4/6] obexd: Register notification handler in the MAP client

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

 



From: Christian Fetzer <christian.fetzer@xxxxxxxxxxxx>

---
 obexd/client/map.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/obexd/client/map.c b/obexd/client/map.c
index 0285286..3d8acc4 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -36,6 +36,7 @@
 #include "dbus.h"
 #include "log.h"
 #include "map_ap.h"
+#include "map-event.h"
 
 #include "map.h"
 #include "transfer.h"
@@ -1694,12 +1695,36 @@ static void map_msg_remove(void *data)
 	g_free(path);
 }
 
+static void map_handle_notification(struct map_event *event, void *user_data)
+{
+	struct map_data *map = user_data;
+
+	DBG("Event report for %s:%d", obc_session_get_destination(map->session),
+							map->mas_instance_id);
+	DBG("type=%x, handle=%s, folder=%s, old_folder=%s, msg_type=%s",
+				event->type, event->handle, event->folder,
+					event->old_folder, event->msg_type);
+}
+
 static bool set_notification_registration(struct map_data *map, bool status)
 {
 	struct obc_transfer *transfer;
 	GError *err = NULL;
 	GObexApparam *apparam;
 	char contents[2];
+	const char *address;
+
+	address = obc_session_get_destination(map->session);
+	if (!address || map->mas_instance_id < 0)
+		return FALSE;
+
+	if (status) {
+		map_register_event_handler(map->session, map->mas_instance_id,
+						&map_handle_notification, map);
+	} else {
+		map_unregister_event_handler(map->session,
+							map->mas_instance_id);
+	}
 
 	contents[0] = FILLER_BYTE;
 	contents[1] = '\0';
-- 
1.8.2.3

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