From d935b195a2246fa24d35df7c6fc354ae628a6777 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 10 Jan 2013 15:51:33 +0100 Subject: Added attributes to nodes as well as messages for manipulating and transporting them. Switched debug interface to hugin. --- src/munia_proto.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/munia_proto.cc') diff --git a/src/munia_proto.cc b/src/munia_proto.cc index 6a165db..977bf60 100644 --- a/src/munia_proto.cc +++ b/src/munia_proto.cc @@ -33,7 +33,7 @@ #include #include -#include "debug.h" +#include "hugin.hpp" #include "task.h" #include "messageparser.h" @@ -94,7 +94,7 @@ int callback_lws_task(struct libwebsocket_context * context, { task_manager.tree.toStdOut(); - printf("Callback on %p\n", wsi); + DEBUG(proto, "Callback on %p\n", wsi); switch (reason) { case LWS_CALLBACK_ESTABLISHED: @@ -187,7 +187,7 @@ int callback_lws_task(struct libwebsocket_context * context, current_client = wsi; - printf("%s\n", (char*)in); + DEBUG(proto, "%s\n", (char*)in); std::string data; data.append((char*)in, len); @@ -215,11 +215,16 @@ int callback_lws_task(struct libwebsocket_context * context, message_t createmsg = create_msg_create(task); createmsg.tid = omi->observe.id; - message_t updatemsg = create_msg_update(task); - updatemsg.tid = omi->observe.id; - msgqueue[wsi].push_back(createmsg); - msgqueue[wsi].push_back(updatemsg); + + std::map::iterator ai = + task.attributes.begin(); + while(ai != task.attributes.end()) { + message_t updatemsg = create_msg_update(task, ai->first); + updatemsg.tid = omi->observe.id; + msgqueue[wsi].push_back(updatemsg); + ai++; + } id++; } -- cgit v1.2.3