summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fetzer <christian.fetzer@bmw-carit.de>2013-06-17 10:35:29 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-06-25 16:12:47 +0300
commitcc68717c106e1f564262de187b66f8d6ecbf01c6 (patch)
treeef662526bd91d49e0c4105bb6e60755aad107dd5
parent24e5a587e472cb5f2d71e74c3699f3247d053adf (diff)
downloadbluez-cc68717c106e1f564262de187b66f8d6ecbf01c6.tar.gz
obexd: Register notification handler in the MAP client
-rw-r--r--obexd/client/map.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 0285286b0..3d8acc415 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';