clean log. 76/80476/2
authorSang gun Lee <sanggun7.lee@samsung.com>
Mon, 18 Jul 2016 08:10:57 +0000 (17:10 +0900)
committerSang gun Lee <sanggun7.lee@samsung.com>
Mon, 25 Jul 2016 02:01:54 +0000 (11:01 +0900)
from now, will use MSF_API only.

Change-Id: Iae7c987eabb132c1e3049155f5fa8c9e95eb826e
Signed-off-by: Sang gun Lee <sanggun7.lee@samsung.com>
msf_tizen_client/src/Application.cpp
msf_tizen_client/src/Channel.cpp
msf_tizen_client/src/Client.cpp
msf_tizen_client/src/Clients.cpp
msf_tizen_client/src/MSFDSearchProvider.cpp
msf_tizen_client/src/Message.cpp
msf_tizen_client/src/Search.cpp
msf_tizen_client/src/SearchProvider.cpp
msf_tizen_client/src/Service.cpp

index 9a47c06..61dd6f1 100755 (executable)
@@ -32,18 +32,14 @@ string Application::curl_data = "";
 class start_result_callback : public Result_Base
 {
 public:
-       Client client;
        OnStartAppListener** in_result_cb  = NULL;
 
        void onSuccess(bool result)
        {
-               dlog_print(DLOG_INFO, "MSF", "start_result_callback");
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               MSF_DBG("start result callback onSuccess()");
 
                if (in_result_cb != NULL) {
-//                     if (((*in_result_cb) != NULL) && (!strncmp(client.getId(), "", 1) == 0)) {
                        if (((*in_result_cb) != NULL)) {
-                               dlog_print(DLOG_INFO, "MSF", "start success result");
                                (*in_result_cb)->onStart(result);
                        } else {
                        }
@@ -54,16 +50,13 @@ public:
 
        void onError(Error)
        {
-               dlog_print(DLOG_ERROR, "MSF", "start error result");
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               MSF_DBG("start result callback onError()");
                if (in_result_cb != NULL) {
                        if (((*in_result_cb) != NULL)) {
                                (*in_result_cb)->onStart(false);
                        } else {
                        }
                }
-               dlog_print(DLOG_ERROR, "MSF", "start result.");
-               //app_pointer->handleSocketClosed();
                delete this;
        }
 };
@@ -71,18 +64,13 @@ public:
 class stop_result_callback : public Result_Base
 {
 public:
-       Client client;
        OnStopAppListener** in_result_cb  = NULL;
 
        void onSuccess(bool result)
        {
-               dlog_print(DLOG_INFO, "MSF", "stop_result_callback");
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-
+               MSF_DBG("stop result callback onSuccess()");
                if (in_result_cb != NULL) {
-//                     if (((*in_result_cb) != NULL) && (!strncmp(client.getId(), "", 1) == 0)) {
                        if (((*in_result_cb) != NULL)) {
-                               dlog_print(DLOG_INFO, "MSF", "stop success result");
                                (*in_result_cb)->onStop(result);
                        } else {
                        }
@@ -93,22 +81,20 @@ public:
 
        void onError(Error)
        {
-               dlog_print(DLOG_ERROR, "MSF", "stop error result");
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               MSF_DBG("stop result callback onError()");
                if (in_result_cb != NULL) {
                        if (((*in_result_cb) != NULL)) {
                                (*in_result_cb)->onStop(false);
                        } else {
                        }
                }
-               //app_pointer->handleSocketClosed();
                delete this;
        }
 };
 
 Application::Application()
 {
-       dlog_print(DLOG_INFO, "MSF", "Application()");
+       MSF_DBG("Application()");
        waitForOnReady = false;
        webapp = false;
        install_listener = NULL;
@@ -117,8 +103,7 @@ Application::Application()
 
 Application::Application(Service *se, string Uri, string Id)
 {
-       dlog_print(DLOG_INFO, "MSF", "Application(service, uri, id, startargs)");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Application()");
        map<string, string> startargs = std::map<std::string, std::string>();
        service = se;
        m_uri = Uri;
@@ -126,7 +111,7 @@ Application::Application(Service *se, string Uri, string Id)
        bool webApp = false;
        uri_parser::URIParse uri2(m_uri);
        if (!(uri2.getURIScheme() == "")) {
-               dlog_print(DLOG_INFO, "MSF", "webapp set as true");
+               MSF_DBG("webapp set as true");
                webApp = true;
        }
 
@@ -139,15 +124,14 @@ Application::Application(Service *se, string Uri, string Id)
 
 Application::Application(Service *se, string Uri, string Id, map<string, string> startargs)
 {
-       dlog_print(DLOG_INFO, "MSF", "Application(service, uri, id, startargs)");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Application()");
        service = se;
        m_uri = Uri;
        ChannelID = Id;
        bool webApp = false;
        uri_parser::URIParse uri2(m_uri);
        if (!(uri2.getURIScheme() == "")) {
-               dlog_print(DLOG_INFO, "MSF", "webapp set as true");
+               MSF_DBG("webapp set as true");
                webApp = true;
        }
 
@@ -160,14 +144,11 @@ Application::Application(Service *se, string Uri, string Id, map<string, string>
 
 Application::~Application()
 {
-       dlog_print(DLOG_INFO, "MSF", "~Application()");
+       MSF_DBG("~Application()");
 }
 
 bool Application::isConnected()
 {
-       dlog_print(DLOG_INFO, "MSF", "Channel::isConnected() = %s", Channel::isConnected() ? "true" : "false");
-       dlog_print(DLOG_INFO, "MSF", "connected = %s", connected ? "true" : "false");
-       //return (Channel::isConnected() && connected);
        return (Channel::isConnected());
 }
 
@@ -221,7 +202,6 @@ void Application::install()
        int ret;
        if (webapp) {
                string randID = Channel::getUID();
-               dlog_print(DLOG_INFO, "MSF", "install call registercallback");
                if (install_listener) {
                        install_listener->onError(Error::create("Unsupported Method"));
                }
@@ -229,7 +209,6 @@ void Application::install()
                 *  handleError(randID,Error::create("Unsupported Method"));   */
        } else {
                string Uri = service->getUri().append(ROUTE_APPLICATION).append(m_uri);
-               dlog_print(DLOG_INFO, "MSF", "install uri = %s", Uri.c_str());
                ret = Application::curl_install(Uri);
                if (ret == -1) {
                        if (install_listener) {
@@ -255,7 +234,6 @@ map<string, string> Application::getparams()
 
 void Application::connect()
 {
-       //Channel::connect();
        connect(NULL);
 }
 
@@ -266,69 +244,14 @@ void Application::connect(Result_Base *res)
 
 void Application::connect(map<string, string> attributes, Result_Base *res)
 {
-       dlog_print(DLOG_INFO, "MSF", "Application::connect(at, res)");
-
-       //connectCallback* r = new connectCallback();
-       //r->in_connect_cb = &onDisconnectListener;
-       //r->app_pointer = this;
-
        Channel::connect(attributes, res);
 }
 
 void Application::disconnect()
 {
-       dlog_print(DLOG_INFO, "MSF", "application disconnect()");
-
        realDisconnect(NULL);
 }
 
-/*
-void Application::disconnect(Result_Base *r)
-{
-       dlog_print(DLOG_INFO, "MSF", "application disconnect(result)");
-       disconnect(true);
-}
-
-void Application::disconnect(bool stopOnDisconnect)
-{
-       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 1");
-
-       if (stopOnDisconnect) {
-       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 2");
-               int numClients = 0;
-               numClients = clients->size();
-               static Client me ;
-               me =  clients->me();
-
-               fprintf(stderr, "\n MYCLIENT ID IS[%s] and Number of clients is [%d]\n", me.getId(), numClients);
-
-               dlog_print(DLOG_INFO, "MSF", "numClients = %d", numClients);
-               dlog_print(DLOG_INFO, "MSF", "clients->getHost : %s", clients->getHost() ? "true" : "false");
-               dlog_print(DLOG_INFO, "MSF", "strncmp(me.getId(),"",1) : %d", strncmp(me.getId(), "", 1));
-               if (((numClients == 2) && (clients->getHost() != NULL) && strncmp(me.getId(), "", 1)) ||
-                               ((numClients == 1) && (strncmp(me.getId(), "", 1))) ||
-                                (numClients == 0)) {
-                       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 3");
-                       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-
-                       //Result_Base *rbool = NULL;;
-
-                       //DisconnectboolCallback *r = new DisconnectboolCallback();
-                       //r->in_disconnect_cb = &disconnect_cb;
-                       //r->app_p = this;
-
-                       //rbool= r1bool;
-                       //MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-                       //stop();
-                       realDisconnect();
-                       return;
-               }
-       }
-
-       realDisconnect(disconnect_cb);
-}
-       */
-
 void Application:: realDisconnect(Result_Base *result)
 {
        Channel::disconnect(result);
@@ -336,28 +259,22 @@ void Application:: realDisconnect(Result_Base *result)
 
 void Application::invokeMethod(string method, map<string, string> params, string messageID, Result_Base *callback)
 {
-       dlog_print(DLOG_INFO, "MSF", "invokeMethod ()");
        if (!Channel::isConnected()) {
-               dlog_print(DLOG_ERROR, "MSF", "invokeMethod() 1");
                Channel::handleError(messageID, Error::create("Not Connected"));
                return;
        }
 
-       dlog_print(DLOG_INFO, "MSF", "invokeMethod() 2");
        int l = 0;
        string id = webapp?"url":"id";
        char buffer[2000];
        l += snprintf((char *)&buffer, sizeof(buffer), " {\n \"method\": \"%s\",\n \"id\": %s, \n \"params\" : { \n \"%s\": \"%s\" \n } \n }", method.c_str(), messageID.c_str(), id.c_str(), params[id].c_str());
        buffer[l] ='\0';
-       dlog_print(DLOG_INFO, "MSF", "invokeMethod() 3");
-       dlog_print(DLOG_INFO, "MSF", "invokeMethod() buf = %s", buffer);
        Channel::start_app(buffer, l, messageID);
 }
 
 void Application::invokeMethod(string method, map<string, string> params, Result_Base *callback)
 {
        string messageID = Channel::getUID();
-       dlog_print(DLOG_INFO, "MSF", "invokeMethod call registercallback");
        Channel::registerCallback(messageID, (void*)callback, Result_bool);
        invokeMethod(method, params,  messageID, callback);
 }
@@ -365,16 +282,13 @@ void Application::invokeMethod(string method, map<string, string> params, Result
 
 Application Application::create(Service *service, string uri)
 {
-       dlog_print(DLOG_INFO, "MSF", "Application::create(service, uri)");
-       fprintf(stderr, "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Application::create(service, uri)");
        if (!((service == NULL) || (uri == ""))) {
                string id = uri;
                uri_parser::URIParse uri2(uri);
                if (!(uri2.getURIScheme() == "")) {
                        id  = uri2.getURIHost();
                }
-               //Application *application=new Application(service, uri, id , std::map<std::string, std::string>());
                Application app(service, uri, id , std::map<std::string, std::string>());
                return app;
        } else {
@@ -385,11 +299,8 @@ Application Application::create(Service *service, string uri)
 
 Application Application::create(Service *service, string uri, string id, map<string, string> startargs)
 {
-       dlog_print(DLOG_INFO, "MSF", "Application::create(service, uri, id, startargs)");
-
+       MSF_DBG("Application::create(service, uri)");
        if (!((service == NULL) || (uri == "") || (id == ""))) {
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-               /*Application *application= new Application(service, uri, id , startargs);        */
                Application app(service, uri, id , startargs);
                return app;
        } else {
@@ -400,7 +311,6 @@ Application Application::create(Service *service, string uri, string id, map<str
 
 void Application::createdata_process(string data)
 {
-       printf("ApplicationInfo curl data : %s", data.c_str());
        ApplicationInfo InfoObj;
        InfoObj.create(data);
        result->onSuccess(InfoObj);
@@ -408,11 +318,10 @@ void Application::createdata_process(string data)
 
 size_t Application::createdata(char* buf, size_t size, size_t nmemb, void* up)
 {
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
        if (buf != NULL) {
                curl_data.append(buf, size*nmemb);
        } else {
-               dlog_print(DLOG_ERROR, "MSF", "createdata() buf is null");
+               MSF_DBG("Application::createdata() buf is null");
        }
 
        return size*nmemb;
@@ -420,8 +329,6 @@ size_t Application::createdata(char* buf, size_t size, size_t nmemb, void* up)
 
 size_t Application::read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 {
-       //((char*)ptr)[size*nmemb-1] = 0;
-       dlog_print(DLOG_ERROR, "MSF", "read_callback = %s", (char*)ptr);
        if (ptr != NULL)
                static_cast<Application*>(stream)->curl_install_data.append(static_cast<const char*>(ptr), size*nmemb);
 
@@ -449,7 +356,6 @@ int Application::curl_application_calling(string uri)
                res = curl_easy_perform(curl);
 
                if (res != CURLE_OK) {
-                       dlog_print(DLOG_ERROR, "MSF", "####Application curl ERROR = %d ####", res);
                        MSF_DBG("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
                } else {
                        createdata_process(curl_data);
@@ -512,14 +418,11 @@ int Application::curl_install(string uri)
                curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
                curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
 
-               dlog_print(DLOG_ERROR, "MSF", "install curl put send");
                res = curl_easy_perform(curl);
 
                if (res != CURLE_OK) {
-                       dlog_print(DLOG_ERROR, "MSF", "####Application curl ERROR = %d ####", res);
                        MSF_DBG("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
                } else {
-                       dlog_print(DLOG_ERROR, "MSF", "####Application curl success ####");
                        json_parse(curl_install_data.c_str());
 
                        if (install_listener != NULL) {
index 39fc97c..9c3fddd 100755 (executable)
@@ -67,9 +67,7 @@ ChannelConnectionHandler::ChannelConnectionHandler() {
 }
 
 Channel::Channel() {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Channel()");
        clientisHost = false;
        isWrite = false;
        buflen = 0;
@@ -89,7 +87,7 @@ Channel::Channel() {
 }
 
 Channel::Channel(Service *service1, string uri1) {
-       dlog_print(DLOG_INFO, "MSF", "Channel()");
+       MSF_DBG("Channel()");
        clientisHost = false;
        isWrite = false;
        buflen = 0;
@@ -111,11 +109,7 @@ Channel::Channel(Service *service1, string uri1) {
 }
 
 Channel *Channel::create(Service *service, string uri) {
-       dlog_print(DLOG_INFO, "MSF", "Channel()");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-       fprintf(stderr, "\n********************************\n");
+       MSF_DBG("Channel::create()");
        if ((service == NULL) || uri.length() <= 0)
                return NULL;
        Channel *channel = new Channel(service, uri);
@@ -123,9 +117,7 @@ Channel *Channel::create(Service *service, string uri) {
 }
 
 Channel::~Channel() {
-       dlog_print(DLOG_INFO, "MSF", "~Channel()");
-       //connect_cb = NULL;
-       //disconnect_cb = NULL;
+       MSF_DBG("~Channel()");
        onConnectListener = NULL;
        onDisconnectListener = NULL;
        onClientConnectListener = NULL;
@@ -169,10 +161,7 @@ void Channel::init_json_key_map() {
 
 void Channel::foreach_json_object(JsonObject *object, const gchar *name,
                                                                JsonNode *node, gpointer user_data) {
-       dlog_print(DLOG_INFO, "MSF", "foreach_json_object name : %s", name);
        if (json_keys.find(name) == json_keys.end()) {
-               dlog_print(DLOG_INFO, "MSF",
-                                       "foreach_json_object : there is no %s in map", name);
                return;
        }
 
@@ -195,7 +184,7 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
                        !strncmp(p->eventType.c_str(), CONNECT_EVENT.c_str(), 25)) {
                        p->client.create(p, p->clientid, p->clientconnectTime,
                                                         p->clientisHost, map<string, string>());
-                       dlog_print(DLOG_INFO, "MSF", "add clientList");
+                       MSF_DBG("add clientList");
                        p->clientList.push_back(p->client);
                }
        } break;
@@ -203,7 +192,7 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
        // key : connectTime
        case JSON_KEY_CONNECT_TIME: {
                p->clientconnectTime = json_node_get_int(node);
-               dlog_print(DLOG_INFO, "MSF", "clientconnectTime set as %lld",
+               MSF_DBG("clientconnectTime set as %lld",
                                        p->clientconnectTime);
        } break;
 
@@ -213,7 +202,7 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
        case JSON_KEY_STATUS: {
                if (iferror) {
                        p->errstatus = json_node_get_int(node);
-                       dlog_print(DLOG_INFO, "MSF", "p->errstatus set");
+                       MSF_DBG("p->errstatus set");
                }
        } break;
 
@@ -222,10 +211,9 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
                if (iferror) {
                        p->errcode = json_node_get_int(node);
                        string eid = std::to_string(p->msg_id);
-                       dlog_print(DLOG_INFO, "MSF", "p->errcode set");
+                       MSF_DBG("p->errcode set");
 
                        if (p->callbacks.find(eid) != p->callbacks.end()) {
-                               dlog_print(DLOG_INFO, "MSF", "test 1");
                                pair<void *, int> temp = p->getcallback(eid);
                                if (temp.first != NULL) {
                                        Result_Base *temp1 = (Result_Base *)(temp.first);
@@ -236,7 +224,6 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
                                        err.append(p->errMsg);
                                        err.append(" code:");
                                        err.append(to_string(p->errcode));
-                                       dlog_print(DLOG_INFO, "MSF", "test 2");
                                        if (temp1)
                                                temp1->onError(Error::create(err));
                                        if (p->onErrorListener)
@@ -255,13 +242,13 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
                if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
                        p->resultresp = json_node_get_boolean(node);
                        if (p->resultresp) {
-                               dlog_print(DLOG_INFO, "MSF", "set resultresp as true");
+                               MSF_DBG("set resultresp as true");
                        } else {
-                               dlog_print(DLOG_INFO, "MSF", "set resultresp as false");
+                               MSF_DBG("set resultresp as false");
                        }
                        p->msg_subject = Message::PROPERTY_RESULT;
                } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
-                       dlog_print(DLOG_INFO, "MSF", "set resultobj");
+                       MSF_DBG("set resultobj");
                        g_free(p->resultobj);
                        p->resultobj = json_node_dup_object(node);
                }
@@ -273,7 +260,7 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
                        if (json_node_get_value_type(node) == G_TYPE_INT ||
                                json_node_get_value_type(node) == G_TYPE_INT64) {
                                p->msg_id = json_node_get_int(node);
-                               dlog_print(DLOG_INFO, "MSF", "msg-id set as %d", p->msg_id);
+                               MSF_DBG("msg-id set as %d", p->msg_id);
                        } else if (json_node_get_value_type(node) == G_TYPE_STRING) {
 
                                if (json_object_has_member(root_json_object, Message::PROPERTY_EVENT.c_str())) {
@@ -283,11 +270,11 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
 
                                if ((p->eventType == CLIENT_CONNECT_EVENT) || arrayofclients) {
                                        p->clientid = json_node_get_string(node);
-                                       dlog_print(DLOG_INFO, "MSF", "clientid set as = %s",
+                                       MSF_DBG("clientid set as = %s",
                                                                p->clientid.c_str());
                                } else {
                                        p->from = json_node_get_string(node);
-                                       dlog_print(DLOG_INFO, "MSF", "from set as = %s",
+                                       MSF_DBG("from set as = %s",
                                                                p->from.c_str());
                                }
                        }
@@ -298,10 +285,10 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
        case JSON_KEY_ERROR: {
                if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
                        iferror = 1;
-                       dlog_print(DLOG_INFO, "MSF", "iferror set as 1");
+                       MSF_DBG("iferror set as 1");
                } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
                        iferror = 1;
-                       dlog_print(DLOG_INFO, "MSF", "iferror set as 1");
+                       MSF_DBG("iferror set as 1");
                        // g_free(p->errobj);
                        p->errobj = true;
                        json_object_foreach_member(json_node_get_object(node),
@@ -312,33 +299,33 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
        // key : MESSAGE::PROPERTY_EVENT
        case JSON_KEY_EVENT: {
                p->eventType = json_node_get_string(node);
-               dlog_print(DLOG_INFO, "MSF", "eventType set as = %s",
+               MSF_DBG("eventType set as = %s",
                                        p->eventType.c_str());
        } break;
 
        // key : MESSAGE::PROPERTY_FROM
        case JSON_KEY_FROM: {
                p->from = json_node_get_string(node);
-               dlog_print(DLOG_INFO, "MSF", "from set as = %s", p->from.c_str());
+               MSF_DBG("from set as = %s", p->from.c_str());
        } break;
 
        // key : MESSAGE::PROPERTY_MESSAGE
        case JSON_KEY_MESSAGE: {
                p->errMsg = json_node_get_string(node);
-               dlog_print(DLOG_INFO, "MSF", "errMsg set as = %s", p->errMsg.c_str());
+               MSF_DBG("errMsg set as = %s", p->errMsg.c_str());
        } break;
 
        // key : MESSAGE::PROPERTY_METHOD
        case JSON_KEY_METHOD: {
                p->method = json_node_get_string(node);
-               dlog_print(DLOG_INFO, "MSF", "method set as = %s", p->method.c_str());
+               MSF_DBG("method set as = %s", p->method.c_str());
        } break;
        // key : MESSAGE:PROPERTY_DATA
        case JSON_KEY_DATA: {
                if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
                        if (json_node_get_value_type(node) == G_TYPE_STRING) {
                                p->data = json_node_get_string(node);
-                               dlog_print(DLOG_INFO, "MSF", "data set as = %s",
+                               MSF_DBG("data set as = %s",
                                                        p->data.c_str());
                        }
                } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
@@ -350,10 +337,10 @@ void Channel::foreach_json_object(JsonObject *object, const gchar *name,
        // key : MESSAGE:PROPERTY_CLIENTS
        case JSON_KEY_CLIENTS: {
                arrayofclients = true;
-               dlog_print(DLOG_INFO, "MSF", "array start");
+               MSF_DBG("array start");
                json_array_foreach_element(json_node_get_array(node),
                                                                        foreach_json_array, user_data);
-               dlog_print(DLOG_INFO, "MSF", "array end");
+               MSF_DBG("array end");
                arrayofclients = false;
        } break;
 
@@ -369,7 +356,7 @@ void Channel::foreach_json_array(JsonArray *array, guint index, JsonNode *node,
 }
 
 void Channel::json_parse(const char *in) {
-       dlog_print(DLOG_INFO, "MSF", "Channel::json_parse : %s", in);
+       MSF_DBG("Channel::json_parse : %s", in);
 
        JsonParser *parser = json_parser_new();
 
@@ -383,7 +370,7 @@ void Channel::json_parse(const char *in) {
                                                                                foreach_json_object, this);
                }
        } else {
-               dlog_print(DLOG_ERROR, "MSF", "json_parsing error");
+               MSF_DBG("json_parsing error");
        }
 }
 
@@ -408,18 +395,13 @@ void Channel::setConnectionTimeout(long timeout) {
 }
 
 void Channel::handleConnectMessage(string UID) {
-       dlog_print(DLOG_INFO, "MSF", "handleConnectMessage(uid)");
 
        clients->reset();
        clients->add(clientList);
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
 
        clients->setMyClientId(from);
 
        handleConnect(UID);
-       dlog_print(DLOG_INFO, "MSF", "handleConnectMessage(uid) 1");
 }
 
 void Channel::handleMessage(string UID) { handleMessage(UID, NULL); }
@@ -433,65 +415,35 @@ void Channel::handleMessage(string UID, unsigned char payload[]) {
 
                handleApplicationMessage(UID);
        } else if (eventType == CLIENT_CONNECT_EVENT) {
-               dlog_print(DLOG_INFO, "MSF", "call handleClientConnectMessage");
                handleClientConnectMessage();
        } else if (eventType == CLIENT_DISCONNECT_EVENT) {
-               dlog_print(DLOG_INFO, "MSF", "call handleclientdisconnect");
                handleClientDisconnectMessage();
        } else if (eventType == ERROR_EVENT) {
-               dlog_print(DLOG_INFO, "MSF", "call handleErrorMessage");
                handleErrorMessage(UID);
        } else if (eventType == READY_EVENT) {
-               dlog_print(DLOG_INFO, "MSF", "call handleReadyMessage");
                handleReadyMessage();
        } else {
-               dlog_print(DLOG_INFO, "MSF", "call handleClientMessage 2");
                handleClientMessage(data.c_str(), payload);
        }
 }
 
 void Channel::handleApplicationMessage(string uid) {
-       dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 1");
-       MSF_DBG(
-               "[MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",
-               __FUNCTION__, __LINE__, __FILE__);
        string messageId = uid;
        bool errorMap = errobj;
-       dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 2");
        pair<void *, int> temp = getcallback(messageId);
 
-       dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 3");
 
        if (temp.first != NULL) {
-               dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 4");
                if ((waitForOnReady) && (errorMap == false)) {
-                       dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 5");
-                       MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in "
-                                       "file [%s] \n",
-                                       __FUNCTION__, __LINE__, __FILE__);
                        onReadyCallbacks.insert(temp);
                        if (!isLaunched) {
-                               dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 6");
-                               MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] "
-                                               "in file [%s] \n",
-                                               __FUNCTION__, __LINE__, __FILE__);
                                isLaunched = true;
                        } else {
-                               dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 7");
-                               MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] "
-                                               "in file [%s] \n",
-                                               __FUNCTION__, __LINE__, __FILE__);
-                               // handleClientDisconnectMessage();
                                isLaunched = false;
                        }
                }
 
                if (temp.second == Result_bool) {
-                       dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 8");
-                       MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in "
-                                       "file [%s] \n",
-                                       __FUNCTION__, __LINE__, __FILE__);
-                       //doApplicationCallback((Result_Base *)(temp.first));
                        ((Result_Base*)temp.first)->onSuccess(resultresp);
                }
        } else {
@@ -500,24 +452,12 @@ void Channel::handleApplicationMessage(string uid) {
 }
 
 void Channel::doApplicationCallback(Result_Base *result1) {
-       dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 1");
-       MSF_DBG(
-               "[MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",
-               __FUNCTION__, __LINE__, __FILE__);
        if (resultobj != NULL) {
-               dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 2");
-               MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
-                               "[%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
        }
 
        bool errorMap = errobj;
 
        if (errorMap != false) {
-               dlog_print(DLOG_ERROR, "MSF", "doApplicationCallback 3");
-               MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
-                               "[%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
                int code = errcode;
                stringstream ss;
                ss << code;
@@ -525,26 +465,16 @@ void Channel::doApplicationCallback(Result_Base *result1) {
                if (result1 != NULL)
                        result1->onError(Error::create(str));
        } else {
-               dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 4");
-
-               MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
-                               "[%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
-               //      ApplicationInfo *InfoObj=new ApplicationInfo();
                if (resultobj != NULL) {
-                       dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 5");
                        //      string json=json_object_to_json_string(resultobj);
                        //      InfoObj->create(json);
                        if (result1 != NULL) {
-                               dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 6");
                                result1->onSuccess(true);
                        }
                }
 
                if (msg_subject == Message::PROPERTY_RESULT) {
-                       dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 7");
                        if (result1 != NULL) {
-                               dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 8");
                                result1->onSuccess(true);
                        }
                }
@@ -559,9 +489,6 @@ void Channel::handleErrorMessage(string UID) {
 void Channel::handleError(string UID, Error err) {
        if (UID.length() != 0) {
                pair<void *, int> temp = Channel::getcallback(UID);
-               MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
-                               "[%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
                if (temp.first != NULL) {
                        if (temp.second == Result_Client) {
                                Result_Base *temp1 = (Result_Base *)(temp.first);
@@ -580,19 +507,13 @@ void Channel::handleError(string UID, Error err) {
 }
 
 void Channel::handleClientMessage(const char *msg, unsigned char payload[]) {
-       dlog_print(DLOG_INFO, "MSF", "handleClientMessage 0");
-
        emit(eventType, msg, from, cl_payload, cl_payload_size);
 }
 
 void Channel::emit(string event, const char *msg, string from,
                                        unsigned char *payld, int payld_size) {
-       dlog_print(DLOG_INFO, "MSF", "emit");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        if (msg == NULL) {
-               dlog_print(DLOG_INFO, "MSF", "emit msg = NULL");
+               MSF_DBG("emit msg = NULL");
                return;
        }
 
@@ -607,19 +528,15 @@ void Channel::emit(string event, const char *msg, string from,
        }
 
        if (messageListeners.size() != 0) {
-               dlog_print(DLOG_INFO, "MSF", "emit 1");
 
                if (messageListeners.find(event) == messageListeners.end()) {
-                       dlog_print(DLOG_INFO, "MSF", "map not found");
                        return;
                }
 
                list<OnMessageListener *> &onMessageListeners =
                        (messageListeners.find(event))->second;
-               dlog_print(DLOG_INFO, "MSF", "emit 2");
 
                if (onMessageListeners.size() != 0) {
-                       dlog_print(DLOG_INFO, "MSF", "emit 3");
                        std::list<OnMessageListener *>::const_iterator iterator;
                        for (iterator = onMessageListeners.begin();
                                 iterator != onMessageListeners.end(); ++iterator) {
@@ -627,7 +544,6 @@ void Channel::emit(string event, const char *msg, string from,
                                (*iterator)->onMessage(mesg);
                        }
                } else {
-                       dlog_print(DLOG_INFO, "MSF", "empty listeners");
                }
        }
 }
@@ -640,11 +556,9 @@ bool Channel::connect(Result_Base *result1) {
 }
 
 bool Channel::connect(map<string, string> attributes, Result_Base *result1) {
-       dlog_print(DLOG_INFO, "MSF", "Channel::connect(at, res)");
 
        string uid = getUID();
 
-       dlog_print(DLOG_INFO, "MSF", "connect call registercallback");
        registerCallback(uid, (void *)result1, Result_Client);
 
        UID = uid;
@@ -668,18 +582,13 @@ bool Channel::connect(map<string, string> attributes, Result_Base *result1) {
 }
 
 void Channel::disconnect() {
-       dlog_print(DLOG_INFO, "MSF", "channel disconnect()");
+       MSF_DBG("channel disconnect()");
        disconnect(NULL);
 }
 
 void Channel::disconnect(Result_Base *result1) {
-       dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 1");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        string randID = getUID();
        UID = randID;
-       dlog_print(DLOG_INFO, "MSF", "disconnect call registercallback");
        registerCallback(randID, (void *)result1, Result_Client);
        string message = "";
 
@@ -692,22 +601,15 @@ void Channel::disconnect(Result_Base *result1) {
        if (message != "") {
                handleError(UID, Error::create(message));
        } else {
-               dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 2");
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
-                               "file [%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
                disconnecting = true;
                // consume the callback
                getcallback(randID);
 
-               dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 3");
-
                while (1) {
                        if (mirror_lifetime > 0)
                                mirror_lifetime--;
 
                        if (!mirror_lifetime) {
-                               dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 4");
                                break;
                        }
                }
@@ -716,8 +618,6 @@ void Channel::disconnect(Result_Base *result1) {
 
                was_closed = 1;
 
-               dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 5");
-
                disconnecting = false;
        }
 }
@@ -739,55 +639,37 @@ void Channel::handleReadyMessage() {
 }
 
 void Channel::handleClientConnectMessage() {
-       dlog_print(DLOG_INFO, "MSF", "handleClientConnectMessage");
+       MSF_DBG("handleClientConnectMessage");
 
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        if (client.isHost())
                connected = true;
 
        clients->add(client);
 
-       dlog_print(DLOG_INFO, "MSF", "handleClientConnectMessage client = %s",
-                               client.getId());
-       MSF_DBG("\n Debug Log: CLIENTLIST SIZE IS [%d], %s %d in %s \n",
-                       clients->size(), __FUNCTION__, __LINE__, __FILE__);
        if (onClientConnectListener != NULL)
                onClientConnectListener->onClientConnect(client);
 }
 
 void Channel::handleClientDisconnectMessage() {
-       dlog_print(DLOG_INFO, "MSF", "handle client disconnect Message event = %s",
-                               eventType.c_str());
-
+       MSF_DBG("handleClientDisConnectMessage");
        if (resultresp && isLaunched) {
-               dlog_print(DLOG_INFO, "MSF", "handleclientdisconnectMessage 1");
                handleSocketClosed();
                return;
        }
 
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        Client client = clients->get(clientid);
        if (client.isHost()) {
-               dlog_print(DLOG_INFO, "MSF", "handleclientdisconnectMessage 2");
                connected = false;
        }
        clients->remove(client);
 
        if (onClientDisconnectListener != NULL) {
-               dlog_print(DLOG_INFO, "MSF", "handleclientdisconnectMessage 3");
                onClientDisconnectListener->onClientDisconnect(client);
        }
 }
 
 void Channel::handleConnect(string UID) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-       dlog_print(DLOG_INFO, "MSF", "handleConnect");
+       MSF_DBG("handleConnect");
        Client clienttemp = clients->me();
 
        pair<void *, int> temp;
@@ -811,25 +693,20 @@ void Channel::handleConnect(string UID) {
        if (isWebSocketOpen()) {
                // connectionHandler->startPing(this);
        }
-
-       dlog_print(DLOG_INFO, "MSF", "handleConnect 1");
 }
 
 void Channel::handleSocketClosedAndNotify() {
+       MSF_DBG("handleSocketClosedAndNotify");
        Client client = clients->me();
        handleSocketClosed();
 
        if (Channel::onDisconnectListener != NULL) {
-               dlog_print(DLOG_INFO, "MSF", "handleSocketClosedAndNotify");
                Channel::onDisconnectListener->onDisconnect(client);
        }
 }
 
 void Channel::handleSocketClosed() {
-       dlog_print(DLOG_INFO, "MSF", "handleSocketClosed");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("handleSocketClosed");
        connectionHandler->stopPing();
        wsi_mirror = NULL;
        connected = false;
@@ -849,40 +726,24 @@ void Channel::write_socket(Channel* ch_p)
                if (&(ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING]) == NULL ||
                                ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING] == 0 ||
                                ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING] == '\0') {
-                       printf("\ntry write NULL data");
-                       fflush(stdout);
                } else {
-                       // printf("\ntry write data = %s",
-                       // &(this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING]));
-                       // printf("\ndata size = %d", this_ptr->buflen);
-                       fflush(stdout);
                }
 
                if (ch_p->buflen <= 0) {
-                       printf("\ntry write 0 size data");
-                       fflush(stdout);
                }
 
-               // printf("\nwrite socket");
-               // fflush(stdout);
                if (ch_p->binary_message) {
                        n = lws_write(ch_p->wsi_mirror,
                                        &(ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING]),
                                        ch_p->buflen, LWS_WRITE_BINARY);
-                       dlog_print(DLOG_INFO, "MSF", "write binary message\n%s", &(ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING+2]));
                } else {
                        n = lws_write(ch_p->wsi_mirror,
                                        &(ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING]),
                                        ch_p->buflen, LWS_WRITE_TEXT);
-                       dlog_print(DLOG_INFO, "MSF", "write text message\n%s", &(ch_p->buf[LWS_SEND_BUFFER_PRE_PADDING]));
                }
 
                if (n < 0) {
                        MSF_DBG("Writing failed\n");
-                       dlog_print(DLOG_ERROR, "MSF", "socket write failed");
-                       printf("\nwrite socket failed");
-                       printf("\ncallback isWrite=false");
-                       fflush(stdout);
                }
        }
 }
@@ -912,29 +773,23 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                break;
 
        case LWS_CALLBACK_CLOSED:
-               dlog_print(DLOG_INFO, "MSF_SOCKET", "call handleSocketClosedAndNotify");
                this_ptr->handleSocketClosedAndNotify();
                break;
 
        case LWS_CALLBACK_CLIENT_ESTABLISHED:
-               MSF_DBG("[MSF LOG]: LWS_CALLBACK_CLIENT_ESTABLISHED [%s]\n",
-                               __FUNCTION__);
-               //lws_callback_on_writable(wsi);
                break;
 
        case LWS_CALLBACK_CLIENT_RECEIVE:
                if (this_ptr == NULL) {
-                       dlog_print(DLOG_INFO, "MSF", "user ptr is NULL. return.");
                        // it means Channel object was deleted
                        return -1;
                } else {
-                       dlog_print(DLOG_INFO, "MSF", "user ptr is not NULL.");
                }
 
                this_ptr->eventType = "";
 
                if (lws_frame_is_binary(wsi)) {
-                       dlog_print(DLOG_INFO, "MSF", "BINARY MESSAGE ARRIVED");
+                       MSF_DBG("BINARY MESSAGE ARRIVED");
 
                        int header_size = 0;
 
@@ -942,14 +797,14 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                        header_size = header_size << 8;
                        header_size = header_size & 0xff00;
                        header_size = header_size | (int)((unsigned char *)in)[1];
-                       dlog_print(DLOG_INFO, "MSF", "header_size = %d", header_size);
+                       MSF_DBG("header_size = %d", header_size);
 
                        char header_json[header_size + 1] = {0};
 
                        memcpy(&header_json[0], &(((unsigned char *)in)[2]), header_size);
                        header_json[header_size + 1] = 0;
 
-                       dlog_print(DLOG_INFO, "MSF", "in = %s", &header_json[0]);
+                       MSF_DBG("in = %s", &header_json[0]);
 
                        this_ptr->json_parse(header_json);
                        memcpy(&(this_ptr->cl_payload),
@@ -959,7 +814,7 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                        this_ptr->cl_payload[len - 2 - header_size] = 0;
                        this_ptr->cl_payload_size = len - 2 - header_size;
 
-                       dlog_print(DLOG_INFO, "MSF", "payload = %s",
+                       MSF_DBG("payload = %s",
                                                &(this_ptr->cl_payload[0]));
 
                        this_ptr->connectionHandler->resetLastPingReceived();
@@ -971,23 +826,10 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                                this_ptr->handleMessage(this_ptr->UID, this_ptr->cl_payload);
                        }
                } else {
-                       dlog_print(DLOG_INFO, "MSF", "TEXT MESSAGE ARRIVED");
-                       MSF_DBG("[MSF LOG]LWS_CALLBACK_RECEIVE_ESTABLISHED:\t");
-                       MSF_DBG("\n%s\n", (char *)in);
-                       fprintf(stderr, "\n %s \n", (char *)in);
-                       dlog_print(DLOG_INFO, "MSF", "socket in = %s", (char *)in);
+                       MSF_DBG("TEXT MESSAGE ARRIVED");
                        this_ptr->json_parse((char *)in);
                        this_ptr->connectionHandler->resetLastPingReceived();
 
-                       // dead code.
-                       // server do not send METHOD_EMIT now
-                       /*
-                               if (!((this_ptr->method).compare(Message::METHOD_EMIT))) {
-                               this_ptr->emit(this_ptr->eventType, (this_ptr->data).c_str(),
-                               this_ptr->from, this_ptr->Payload);
-                               break;
-                               }
-                        */
                        if (this_ptr->eventType == CONNECT_EVENT) {
                                this_ptr->handleConnectMessage(this_ptr->UID);
                        } else {
@@ -996,7 +838,6 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                        }
                }
 
-               dlog_print(DLOG_INFO, "MSF", "Socket receive end ");
                break;
 
        case LWS_CALLBACK_CLIENT_WRITEABLE:
@@ -1004,13 +845,9 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                break;
 
        case LWS_CALLBACK_RECEIVE:
-               dlog_print(DLOG_INFO, "MSF_SOCKET", "socket LWS_CALLBACK_RECEIVE %d",
-                                       reason);
                break;
 
        case LWS_CALLBACK_PROTOCOL_DESTROY:
-               dlog_print(DLOG_INFO, "MSF_SOCKET",
-                                       "socket LWS_CALLBACK_PROTOCOL_DESTROY %d", reason);
                break;
 
        case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED:
@@ -1048,9 +885,6 @@ string Channel::getChannelUri(map<string, string> *attributes) {
 }
 
 void Channel::publish(string event, const char *data) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        string to = "\"";
        to.append(Message::TARGET_ALL.c_str());
        to.append("\"");
@@ -1060,11 +894,6 @@ void Channel::publish(string event, const char *data) {
 
 void Channel::publish(string event, const char *data, unsigned char payload[],
                                        int payload_size) {
-       dlog_print(DLOG_INFO, "MSF", "publishMessage");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        string to = "\"";
        to.append(Message::TARGET_ALL.c_str());
        to.append("\"");
@@ -1072,10 +901,6 @@ void Channel::publish(string event, const char *data, unsigned char payload[],
 }
 
 void Channel::publish(string event, const char *data, const char *target) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        string to = "\"";
        to.append(target);
        to.append("\"");
@@ -1084,10 +909,6 @@ void Channel::publish(string event, const char *data, const char *target) {
 
 void Channel::publish(string event, const char *data, const char *target,
                                        unsigned char payload[], int payload_size) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        string to = "\"";
        to.append(target);
        to.append("\"");
@@ -1095,10 +916,6 @@ void Channel::publish(string event, const char *data, const char *target,
 }
 
 void Channel::publish(string event, const char *data, Client client) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        string to = "\"";
        to.append(client.getId());
        to.append("\"");
@@ -1107,10 +924,6 @@ void Channel::publish(string event, const char *data, Client client) {
 
 void Channel::publish(string event, const char *data, Client client,
                                        unsigned char payload[], int payload_size) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        string to = "\"";
        to.append(client.getId());
        to.append("\"");
@@ -1144,10 +957,6 @@ void Channel::publish(string event, const char *data, list<Client> clients,
 
 void Channel::publishMessage(string event, const char *data, const char *to,
                                                         unsigned char payload[], int payload_size) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        publishMessage(Message::METHOD_EMIT, event, data, to, payload,
                                        payload_size);
 }
@@ -1155,24 +964,10 @@ void Channel::publishMessage(string event, const char *data, const char *to,
 void Channel::publishMessage(string method, string event, const char *data,
                                                         const char *to, unsigned char payload[],
                                                         int payload_size) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        if (!isWebSocketOpen()) {
                handleError(string(), Error::create("Not Connected"));
                return;
        } else {
-               // int l=0;
-               // l += sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING]," {\n
-               // \"method\": \"%s\",\n \"params\": {\n \"event\": \"%s\",\n \"data\":
-               // \"%s\",\n \"to\": \"%s\"\n }\n}",method.c_str(),event.c_str(),
-               // (unsigned char*)data, (unsigned char*)to);
-
-               // unsigned char *bufer=new char[LWS_SEND_BUFFER_PRE_PADDING + 4096
-               // +LWS_SEND_BUFFER_POST_PADDING];
-               // bufer=prepareMessageMap(method,event,data,to);
-
                long prepare_buf_len = 0;
                unsigned char *prepare_buf = prepareMessageMap(
                        method, event, data, to, &prepare_buf_len, payload, payload_size);
@@ -1183,32 +978,19 @@ void Channel::publishMessage(string method, string event, const char *data,
                buf[LWS_SEND_BUFFER_PRE_PADDING + prepare_buf_len] = 0;
 
                buflen = prepare_buf_len;
-               // buf code
-               // for(int i=0; i<buflen;i++)
-               //      buf[i]=prepare_buf[i];
-
-               // buf[buflen] = 0;
 
                delete[](prepare_buf);
 
-               MSF_DBG("buf is = %s %d \n", &buf[LWS_SEND_BUFFER_PRE_PADDING], buflen);
-               // buflen=l;
-               // messagedata=((char*)data);
-
                if (binary_message) {
-                       dlog_print(DLOG_INFO, "MSF", "publish buffer = %s",
+                       MSF_DBG("publish buffer = %s",
                                                &buf[LWS_SEND_BUFFER_PRE_PADDING + 2]);
                } else {
-                       dlog_print(DLOG_INFO, "MSF", "publish buffer = %s",
+                       MSF_DBG("publish buffer = %s",
                                                &buf[LWS_SEND_BUFFER_PRE_PADDING]);
                }
 
-               // if (bufer)
-               //      free(bufer);
-
                isWrite = true;
                lws_callback_on_writable(wsi_mirror);
-               // printf("\npublish isWrite=true\n");
        }
 }
 
@@ -1226,8 +1008,8 @@ unsigned char *Channel::prepareMessageMap(string method, string event,
        if (payload) {
                l += snprintf((char *)&prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + 2],
                                prepare_buf_size - (LWS_SEND_BUFFER_PRE_PADDING + 2),
-                                        "{\n \"method\": \"%s\",\n \"params\": {\n \"event\": "
-                                        "\"%s\",\n \"data\": \"%s\",\n \"to\": %s\n }\n}",
+                                        "{\"method\": \"%s\",\"params\": {\"event\": "
+                                        "\"%s\",\"data\": \"%s\",\"to\": %s}}",
                                         method.c_str(), event.c_str(), (unsigned char *)data,
                                         (unsigned char *)to);
 
@@ -1238,12 +1020,6 @@ unsigned char *Channel::prepareMessageMap(string method, string event,
                prepare_buf[LWS_SEND_BUFFER_PRE_PADDING] =
                        (unsigned char)((header_size) >> 8);
 
-               dlog_print(DLOG_INFO, "MSF", "publish header size = %d", header_size);
-               dlog_print(DLOG_INFO, "MSF", "buf[1] = %d",
-                                       (char)prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + 1]);
-               dlog_print(DLOG_INFO, "MSF", "buf[0] = %d",
-                                       (char)prepare_buf[LWS_SEND_BUFFER_PRE_PADDING]);
-
                l += 2;
 
                memcpy(&prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + l], payload,
@@ -1255,13 +1031,12 @@ unsigned char *Channel::prepareMessageMap(string method, string event,
        } else {
                l += snprintf((char *)&prepare_buf[LWS_SEND_BUFFER_PRE_PADDING],
                                        prepare_buf_size - LWS_SEND_BUFFER_PRE_PADDING,
-                                       "{\n \"method\": \"%s\",\n \"params\": {\n \"event\": "
-                                       "\"%s\",\n \"data\": \"%s\",\n \"to\": %s\n }\n}",
+                                       "{\"method\": \"%s\",\"params\": {\"event\": "
+                                       "\"%s\",\"data\": \"%s\",\"to\": %s}}",
                                        method.c_str(), event.c_str(), (unsigned char *)data,
                                        (unsigned char *)to);
                binary_message = false;
        }
-       MSF_DBG("buf is = %s %d \n", &buf[LWS_SEND_BUFFER_PRE_PADDING], l);
 
        *prepare_buf_len = l;
        return prepare_buf;
@@ -1275,26 +1050,16 @@ void Channel::start_app(char *data, int buflength, string msgID) {
 
        l += snprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING],
                        sizeof(buf) - LWS_SEND_BUFFER_PRE_PADDING, "%s", data);
-       MSF_DBG("buf is = %s %d \n", &buf[LWS_SEND_BUFFER_PRE_PADDING], l);
        buflen = l;
        buf[LWS_SEND_BUFFER_PRE_PADDING + l] = 0;
 
-       dlog_print(DLOG_INFO, "MSF", "start_app() buf = %s",
-                               &buf[LWS_SEND_BUFFER_PRE_PADDING]);
        binary_message = false;
 
        isWrite = true;
        lws_callback_on_writable(wsi_mirror);
-       printf("start_app isWrite=true");
-
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
 }
 
 void Channel::registerCallback(string uid, void *callback, int value_type) {
-       dlog_print(DLOG_INFO, "MSF", "registerCallback uid = %s value_type = %d",
-                               uid.c_str(), value_type);
        callbacks[uid] = make_pair(callback, value_type);
 }
 
@@ -1304,8 +1069,7 @@ pair<void *, int> Channel::getcallback(string uid) {
        map<string, pair<void *, int>>::iterator check_it = callbacks.find(uid);
 
        if (check_it == callbacks.end()) {
-               dlog_print(DLOG_ERROR, "MSF",
-                                       "callbacks map not found. critical error");
+               MSF_DBG("callbacks map not found. critical error");
                return pair<void *, int>();
        }
 
@@ -1314,12 +1078,12 @@ pair<void *, int> Channel::getcallback(string uid) {
 
                callbacks.erase(uid);
 
-               dlog_print(DLOG_INFO, "MSF", "getcallback success uid = %s",
+               MSF_DBG("getcallback success uid = %s",
                                        uid.c_str());
                return r1;
        }
 
-       dlog_print(DLOG_INFO, "MSF", "getcallback failed", uid.c_str());
+       MSF_DBG("getcallback failed", uid.c_str());
        return pair<void *, int>();
 }
 
@@ -1355,7 +1119,6 @@ void Channel::create_websocket(void *att) {
 
        int use_ssl = 0;
        int n = 0;
-       // int ret = 0;
        map<string, string> *attributes = (map<string, string> *)(att);
        string uri = getChannelUri(attributes);
 
@@ -1382,26 +1145,20 @@ void Channel::create_websocket(void *att) {
 // info.extensions = lws_get_internal_extensions();
 #endif
        if (isWebSocketOpen()) {
-               MSF_DBG("\nAlready Connected");
-               dlog_print(DLOG_INFO, "MSF", "create_websocket already Connected");
-               // return 0;
+               MSF_DBG("create_websocket already Connected");
+               return;
        }
        context = lws_create_context(&info);
        Context = context;
        if (context == NULL) {
                MSF_DBG("Creating libwebsocket context failed\n");
-               dlog_print(DLOG_ERROR, "MSF", "create_websocket context failed");
-               // return 1;
+               return;
        }
        n = 0;
        get_ip_port_from_uri(uri, &server_ip_address, &server_port);
        string api = getapifromUri(uri);
        api.append("channels/").append(ChannelID);
 
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
-
        struct lws_client_connect_info connect_info;
        connect_info.context = context;
        connect_info.address = server_ip_address.c_str();
@@ -1423,9 +1180,7 @@ void Channel::create_websocket(void *att) {
                if (wsi_mirror == NULL) {
                        wsi_mirror = lws_client_connect_via_info(&connect_info);
                        if (wsi_mirror == NULL) {
-                               MSF_DBG("Fail to create was_mirror[%s] [%d]\n", __FUNCTION__,
-                                               __LINE__);
-                               dlog_print(DLOG_ERROR, "MSF", "create_websocket create wsi failed");
+                               MSF_DBG("Fail to create was_mirror");
                                handleError(UID, Error::create("ConnectFailed"));
                                break;
                        }
@@ -1437,23 +1192,20 @@ void Channel::create_websocket(void *att) {
                        break;
        }
 
-       dlog_print(DLOG_INFO, "MSF", "create_websocket destroy context");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("create_websocket destroy context");
        if (context)
                lws_context_destroy(context);
+
        context = NULL;
        wsi_mirror = NULL;
 }
 
 void Channel::get_ip_port_from_uri(string uri, string* dest_ip, int* dest_port) {
-       MSF_DBG("parsing uri : %s", uri.c_str());
        unsigned int http_index = uri.find("http");
        unsigned int ip_index = 0;
        bool is_https = false;
 
-       if (http_index == -1) {
+       if (http_index == std::string::npos) {
                //there is no http string
        } else {
        }
@@ -1531,21 +1283,6 @@ void Channel::setonClientConnectListener(OnClientConnectListener *obj) {
 
 void Channel::unsetonClientConnectListener() { onClientConnectListener = NULL; }
 
-/*
-       void Channel::setmessageListeners(list<OnMessageListener>
-       onMessageListenerlist){
-       std::list<OnMessageListener>::const_iterator iterator;
-       std::list<OnMessageListener>::const_iterator it;
-       for (iterator = onMessageListenerlist.begin(),it =onMessageListeners.begin();
-       iterator != onMessageListenerlist.end(); ++iterator,++it)
-       {
-       it=iterator;
-       }
-
-       }
-       }
- */
-
 void Channel::addOnMessageListener(string event,
                                                                        OnMessageListener *onMessageListener) {
        if (event.length() == 0 || onMessageListener == NULL)
@@ -1648,47 +1385,23 @@ void ChannelConnectionHandler::calculateAverageRT() {
 }
 
 void ChannelConnectionHandler::stopPing() {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        if (ping_thread != 0) {
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
-                               "file [%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
                pthread_cancel(ping_thread);
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
-                               "file [%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
                pthread_join(ping_thread, NULL);
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
-                               "file [%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
                running = false;
                ping_thread = 0;
-               printf("ping thread close");
-               fflush(stdout);
        }
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
 }
 
 void ChannelConnectionHandler::startPing(Channel *ptr) {
-       dlog_print(DLOG_INFO, "MSF", "## startPing ###");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("## startPing ###");
        if (running) {
-               dlog_print(DLOG_INFO, "MSF",
-                                       "## startPing already running. return ###");
+               MSF_DBG("startPing already running. return ###");
                return;
        }
        stopPing();
        if (pingTimeout <= 0) {
-               dlog_print(DLOG_INFO, "MSF", "## startPing ping timeout. return ###");
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
-                               "file [%s] \n",
-                               __FUNCTION__, __LINE__, __FILE__);
+               MSF_DBG("## startPing ping timeout. return ###");
                return;
        }
        running = true;
@@ -1701,20 +1414,20 @@ void ChannelConnectionHandler::startPing(Channel *ptr) {
 
        int err = pthread_create(&ping_thread, NULL, Pinging, ptr);
        if (err) {
-               dlog_print(DLOG_INFO, "MSF", "pthread_create failed err = %d", err);
+               MSF_DBG("pthread_create failed err = %d", err);
        }
        // Need to check this
        // Pinging(ptr);
 }
 
 void ChannelConnectionHandler::ping_again(void *arg) {
-       dlog_print(DLOG_INFO, "MSF", "## ping again ###");
+       MSF_DBG("## ping again ###");
        Channel *ptr = static_cast<Channel *>(arg);
        long now = time(0);
 
        if (now > ptr->connectionHandler->lastPingReceived +
                                ptr->connectionHandler->pingTimeout) {
-               dlog_print(DLOG_INFO, "MSF", "## Pinging timeout. disconnect ###");
+               MSF_DBG("## Pinging timeout. disconnect ###");
                ptr->disconnect();
        } else {
                ptr->publish("msfVersion2", "msfVersion2", ptr->clients->me());
@@ -1725,29 +1438,17 @@ void ChannelConnectionHandler::ping_again(void *arg) {
 }
 
 void *ChannelConnectionHandler::Pinging(void *arg) {
-       dlog_print(DLOG_INFO, "MSF", "## Pinging ###");
+       MSF_DBG("## Pinging ###");
 
        Channel *ptr = static_cast<Channel *>(arg);
 
        while (1) {
                ping_again(ptr);
-               dlog_print(DLOG_INFO, "MSF", "## pinging 1 ###");
                // usleep(ptr->connectionHandler->pingTimeout);
                sleep(5);
        }
 }
 
 void ChannelConnectionHandler::setPingTimeout(long t) {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
-                       "[%s] \n",
-                       __FUNCTION__, __LINE__, __FILE__);
        pingTimeout = t;
 }
-
-//void Channel::set_connect_result(Result_Base *r) { connect_cb = r; }
-
-//void Channel::unset_connect_result() { connect_cb = NULL; }
-
-//void Channel::set_disconnect_result(Result_Base *r) { disconnect_cb = r; }
-
-//void Channel::unset_disconnect_result() { disconnect_cb = NULL; }
index 535d3e0..ed7d277 100644 (file)
@@ -43,7 +43,6 @@ void Client::create(Channel *channel, string Id, long long ConnectTime,  /*map<s
        connectTime = ConnectTime;
        attributes = attr;
        m_channel = channel;
-       //return client;
 }
 
 bool Client::isHost()
index f6d2729..10bb482 100755 (executable)
@@ -64,11 +64,6 @@ bool Clients::isMe(Client client)
        return (client.getId()== myClientId);
 }
 
-/*int Clients::ssize()
-  {
-  return sizeof(clients);
-  }*/
-
 list<Client> Clients::lists()
 {
        list<Client> client_list;
index 5736abf..e2c7edf 100755 (executable)
@@ -56,27 +56,25 @@ class ResultMSFDServiceCallback : public Result_Base
 
                void onSuccess(Service abc)
                {
-                       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                       MSF_DBG("MSFD Service Callback onSucces()");
                        MSFDSearchProvider_pointer->push_in_alivemap(ttl, ip_id, provider_type);
                        MSFDSearchProvider_pointer->addService(abc);
                }
 
                void onError(Error)
                {
-                       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                       MSF_DBG("MSFD Service Callback onError()");
                }
 };
 
 
 MSFDSearchProvider::MSFDSearchProvider()
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
        SearchProvider();
 }
 
 MSFDSearchProvider::MSFDSearchProvider(Search *sListener):SearchProvider(sListener)
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 }
 
 MSFDSearchProvider::~MSFDSearchProvider()
@@ -94,17 +92,15 @@ SearchProvider MSFDSearchProvider::create()
 
 SearchProvider MSFDSearchProvider::create(Search *searchListener)
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
        return (SearchProvider)MSFDSearchProvider(searchListener);
 }
 
 void MSFDSearchProvider::start()
 {
-       dlog_print(DLOG_INFO, "MSF", "MSFD start()");
+       MSF_DBG("MSFD start()");
        if (searching) {
                stop();
        }
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
        clearServices();
 
        createMSFD();
@@ -124,7 +120,7 @@ void MSFDSearchProvider::createMSFD()
        /* create what looks like an ordinary UDP socket */
        if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
                perror("socket");
-               dlog_print(DLOG_ERROR, "MSF", "MSFD socket faile");
+               MSF_DBG("MSFD socket faile");
                return;
        }
 
@@ -132,7 +128,7 @@ void MSFDSearchProvider::createMSFD()
        /* allow multiple sockets to use the same PORT number */
        if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
                perror("Reusing ADDR failed");
-               dlog_print(DLOG_ERROR, "MSF", "MSFD reusing ADDR failed");
+               MSF_DBG("MSFD reusing ADDR failed");
        }
        /*** END OF MODIFICATION TO ORIGINAL */
 
@@ -146,7 +142,7 @@ void MSFDSearchProvider::createMSFD()
        /* bind to receive address */
        if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
                perror("bind");
-               dlog_print(DLOG_ERROR, "MSF", "MSFD bind failed");
+               MSF_DBG("MSFD bind failed");
        }
        //dlog_print(DLOG_INFO, "MSF", "MSFD try bind socket success");
 
@@ -155,14 +151,14 @@ void MSFDSearchProvider::createMSFD()
        mreq.imr_interface.s_addr = htonl(INADDR_ANY);
        if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
                perror("setsockopt");
-               dlog_print(DLOG_ERROR, "MSF", "MSFD setsockopt failed");
+               MSF_DBG("MSFD setsockopt failed");
        }
 
        struct timeval tv = {2, 0};
 
        if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
                perror("setsockopt");
-               dlog_print(DLOG_ERROR, "MSF", "MSFD setsockopt(SOL_SOCKET) failed");
+               MSF_DBG("MSFD setsockopt(SOL_SOCKET) failed");
        }
 
        while (1) {
@@ -182,8 +178,6 @@ void MSFDSearchProvider::processReceivedMsg(char *buf, int buflen)
        if (buf == NULL)
                return;
 
-       dlog_print(DLOG_INFO, "MSF", "msfd = %s", buf);
-
        json_parse(buf);
 
        string ip;
@@ -193,7 +187,6 @@ void MSFDSearchProvider::processReceivedMsg(char *buf, int buflen)
        map<string,ttl_info>::iterator itr = aliveMap.find(ip);
 
        if (state == TYPE_DISCOVER) {
-               dlog_print(DLOG_INFO, "MSF", "discover packet.");
                return;
        } else if (state == STATE_ALIVE || state == STATE_UP) {
 
@@ -203,10 +196,8 @@ void MSFDSearchProvider::processReceivedMsg(char *buf, int buflen)
                        rService->ttl = ttl;
                        rService->provider_type = MSFD;
                        rService->ip_id = ip;
-                       dlog_print(DLOG_INFO, "MSF", "there is no ip %s in aliveMap. call getByURI", ip.c_str());
                        Service::getByURI(url, SERVICE_CHECK_TIMEOUT, rService);
                } else {
-                       dlog_print(DLOG_INFO, "MSF", "already exist. call updateAlive");
                        updateAlive(ttl, ip, MSFD);
                }
        } else if (state == STATE_DOWN) {
@@ -229,17 +220,13 @@ void MSFDSearchProvider::foreach_json_object(JsonObject *object, const gchar *ke
        if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
                if (!strncmp(key , MSFDSearchProvider::KEY_TTL.c_str(), 2)) {
                        p->ttl = json_node_get_int(node);
-                       //dlog_print(DLOG_INFO, "MSF", "MSFD ttl = %d", p->ttl);
                } else if (!strncmp(key , MSFDSearchProvider::KEY_TYPE_STATE.c_str(), 2)) {
                        p->state = json_node_get_string(node);
-                       //dlog_print(DLOG_INFO, "MSF", "MSFD state = %s", p->state.c_str());
                } else if (!strncmp(key, MSFDSearchProvider::KEY_SID.c_str(), 4)) {
                        p->id = json_node_get_string(node);
-                       //dlog_print(DLOG_INFO, "MSF", "MSFD id = %s", p->id.c_str());
                } else if (!strncmp(key, MSFDSearchProvider::KEY_URI.c_str(), 7)) {
                        if (flag == 1) {
                                p->url = json_node_get_string(node);
-                               //dlog_print(DLOG_INFO, "MSF", "MSFD url = %s", p->url.c_str());
                                flag = 0;
                        }
                }
@@ -264,17 +251,13 @@ void MSFDSearchProvider::json_parse(const char *in)
                }
 
        } else {
-               dlog_print(DLOG_ERROR, "MSF", "json_parsing error");
+               MSF_DBG("json_parsing error");
        }
 }
 
 bool MSFDSearchProvider::stop()
 {
-       dlog_print(DLOG_INFO, "MSF", "MSFD stop()");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-       //if (!searching) {
-       //      return false;
-       //}
+       MSF_DBG("MSFD stop()");
        shutdown(fd, SHUT_RDWR);
        close(fd);
        fd = 0;
index 02310be..be8531a 100755 (executable)
@@ -60,8 +60,6 @@ Message::Message(Channel *ch, string event, string data, string from, unsigned c
        }
 
        m_payload[payload_size] = 0;
-
-       dlog_print(DLOG_INFO, "MSF", "Message Test 1");
 }
 
 Message::Message()
index 3d885de..74120f9 100755 (executable)
@@ -38,13 +38,6 @@ bool Search::pt_update_start = false;
 
 int Search::numRunning;
 
-/*
-   if (--onStartNotified==0)
-   {
-   if (onStartListener!=NULL)
-   onStartListener->onStart();
-   }*/
-
 void Search::onStart()
 {
        st_onStart();
@@ -67,8 +60,7 @@ void Search::onLost(Service service)
 
 void  Search :: st_onStart()
 {
-       dlog_print(DLOG_INFO, "MSF", "Search::onStart()");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Search::st_onStart()");
 
        // ....... ==0 ??
        if (onStartNotified > 0) {
@@ -77,7 +69,6 @@ void  Search :: st_onStart()
                list<Search*>::iterator itr;
                for (itr = search_list.begin(); itr != search_list.end(); itr++) {
                        if ((*itr)->searchListener != NULL &&  (*itr)->searching_now) {
-                               dlog_print(DLOG_INFO, "MSF", "call onStart");
                                (*itr)->searchListener->onStart();
                        }
                }
@@ -86,7 +77,7 @@ void  Search :: st_onStart()
 
 void  Search::st_onStop()
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Search::st_onStop()");
        list<Search*>::iterator itr;
        for (itr = search_list.begin(); itr != search_list.end(); itr++) {
                if ((*itr)->searchListener != NULL && (*itr)->searching_now) {
@@ -97,14 +88,13 @@ void  Search::st_onStop()
 
 void  Search::st_onFound(Service service)
 {
-       dlog_print(DLOG_INFO, "MSF", "Search::st_onFound()");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       MSF_DBG("Search::st_onFound()");
 
        addService(service);
 
        list<Search*>::iterator itr;
 
-       dlog_print(DLOG_INFO, "MSF", "Search::st_onFound() list size = %d", search_list.size());
+       MSF_DBG("Search::st_onFound() list size = %d", search_list.size());
 
        for (itr = search_list.begin(); itr != search_list.end(); itr++) {
                if ((*itr)->searchListener != NULL && (*itr)->searching_now) {
@@ -115,8 +105,7 @@ void  Search::st_onFound(Service service)
 
 void  Search::st_onLost(Service service)
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-       //validateService(service);
+       MSF_DBG("Search::st_onLost()");
 
        removeService(service);
 
@@ -131,23 +120,18 @@ void  Search::st_onLost(Service service)
 
 void  SearchListener :: onStart()
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 }
 
 void  SearchListener :: onStop()
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 }
 
 void  SearchListener :: onFound(Service service)
 {
-       //addService(service);
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 }
 
 void SearchListener :: onLost(Service service)
 {
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 }
 
 Search::Search()
@@ -156,20 +140,15 @@ Search::Search()
        searchListener = NULL;
 
        search_list.push_back(this);
-       printf("Search::Search()\n");
-       fflush(stdout);
 }
 
 Search::~Search()
 {
        search_list.remove(this);
-       printf("Search::~Search()\n");
-       fflush(stdout);
 }
 
 void Search::setSearchListener(SearchListener *obj)
 {
-       dlog_print(DLOG_INFO, "MSF", "setSearchListener");
        searchListener = obj;
 }
 
@@ -193,17 +172,13 @@ Service Search::getServiceById(string id)
 
 bool Search::start()
 {
+       MSF_DBG("Search::start()");
        if (searching_now == false) {
                if (search_ref_count == 0) {
                        search_ref_count++;
 
                        searching_now = true;
 
-                       dlog_print(DLOG_INFO, "MSF", "Search::start()");
-
-                       //if (isSearching()) {
-                       //      return false;
-                       //}
 
                        startDiscovery();
                } else {
@@ -212,7 +187,6 @@ bool Search::start()
                        searching_now = true;
 
                        if (searchListener != NULL) {
-                               dlog_print(DLOG_INFO, "MSF", "call onStart");
                                searchListener->onStart();
                        }
                }
@@ -223,12 +197,12 @@ bool Search::start()
 
 bool Search::stop()
 {
+       MSF_DBG("search stop");
        if (searching_now == true) {
                search_ref_count--;
                searching_now = false;
 
                if (search_ref_count == 0) {
-                       dlog_print(DLOG_INFO, "MSF", "search stop 1");
                        stopDiscovery();
                } else {
                        if (searchListener != NULL)
@@ -295,7 +269,6 @@ bool Search::remove(list<SearchProvider> *providers, SearchProvider provider)
 
 void *Search::pt_startMDNS(void *arg)
 {
-       //provider1.start();
        return NULL;
 }
 
@@ -311,18 +284,16 @@ void *Search::pt_update_alivemap(void *arg)
 
        while (pt_update_start) {
                sleep(5);
-               dlog_print(DLOG_INFO, "MSF", "call reap");
                SearchProvider::reapServices();
        }
 }
 
 void Search::startDiscovery()
 {
-       dlog_print(DLOG_INFO, "MSF", "Search::startDiscovery()");
+       MSF_DBG("Search::startDiscovery()");
        starting = true;
        // If there are no search providers, then default to using MDNS.
        if (providers.empty()) {
-               //providers.push_back(MDNSSearchProvider::create(this)); //CODE NEED TO REMOVE
                providers.push_back(MSFDSearchProvider::create(this));
        }
 
@@ -333,23 +304,21 @@ void Search::startDiscovery()
        int ret = -1;
 
        provider1.start();
-       dlog_print(DLOG_INFO, "MSF", "try MDNS started");
 
        ret = pthread_create(&threads[MSFD_THREAD_NUMBER], NULL, pt_startMSFD, NULL);
-       dlog_print(DLOG_INFO, "MSF", "MSFD thread created");
        if (ret == -1)
-               cout << "Fail to create MSFD search provider\n";
+               MSF_DBG("MSFD thread create failed");
 
        ret = pthread_create(&threads[UPDATE_THREAD_NUMBER], NULL, pt_update_alivemap, NULL);
        if (ret == -1)
-               cout << "Fail to create pthread_update_alivemap\n";
+               MSF_DBG("update thread create failed");
 
        onStart();
 }
 
 void Search::stopDiscovery()
 {
-       MSF_DBG("\n[MSF API:]Function Name[%s] got called\n", __FUNCTION__);
+       MSF_DBG("Search::stopDiscovery()");
        stopping = true;
        bool stop = false;
        stop = provider1.stop();
@@ -359,22 +328,19 @@ void Search::stopDiscovery()
        if (stop)
                onStop();
 
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-
        pthread_cancel(threads[MSFD_THREAD_NUMBER]);
        pthread_join(threads[MSFD_THREAD_NUMBER], NULL);
 
        pthread_cancel(threads[UPDATE_THREAD_NUMBER]);
        pthread_join(threads[UPDATE_THREAD_NUMBER], NULL);
 
-       dlog_print(DLOG_INFO, "MSF", "MSFD thread joined");
-       dlog_print(DLOG_INFO, "MSF", "update alivemap thread joined");
-       dlog_print(DLOG_INFO, "MSF", "Search::stop discovery end");
+       MSF_DBG("MSFD thread joined");
+       MSF_DBG("update alivemap thread joined");
 }
 
 bool Search::addService(Service service)
 {
-       dlog_print(DLOG_INFO, "MSF", "Search::addService()");
+       MSF_DBG("Search::addService()");
        bool match = false;
        for (std::list<Service>::iterator it = services.begin(); it != services.end(); it++) {
                if ((*it).getId() == service.getId()) {
@@ -401,57 +367,10 @@ bool Search::removeService(Service service)
 void Search::removeAndNotify(Service service)
 {
        if (removeService(service)) {
-               //              if (onServiceLostListener != NULL) {
-               //              searchListener->onLost(service);
-               //              }
        }
 }
 
 void Search::validateService(Service service)
 {
-       /*
-       class ResultSearchServiceCallback : public Result_Base
-       {
-               public:
-                       void onSuccess(Service abc)
-                       {
-                               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-                       }
-
-                       void onError(Error)
-                       {
-                               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-                       }
-       };
-
-       Result_Base *rService;
-
-       ResultSearchServiceCallback *r1Service = new ResultSearchServiceCallback();
-
-       rService = r1Service;
-
-       Service::getByURI(service.getUri(), SERVICE_CHECK_TIMEOUT, rService);
-       delete r1Service;
-       rService = r1Service = NULL;
-       */
-       /*
-       @Override
-       public void onSuccess(Service result) {
-       // We can contact the service, so keep it in the master
-       // list.
-       }
-
-       @Override
-       public void onError(Error error) {
-
-       // If we cannot validate the existence of the service,
-       // then we will remove it from the master list.
-       removeAndNotify(service);
-
-       for (SearchProvider provider:providers) {
-       provider.removeService(service);
-       }
-       }
-       });*/
 }
 
index 6a57c93..ab464c6 100644 (file)
@@ -52,20 +52,15 @@ int ttl_info::update_ttl(long ttl, int service_type)
 {
        if (service_type == MSFD) {
                msfd_ttl = ttl;
-               MSF_DBG("MSFD ttl update : %d", ttl);
        } else if (service_type == MDNS) {
                mdns_ttl = ttl;
-               MSF_DBG("mDNS ttl update : %d", ttl);
        }
 }
 
-
 bool ttl_info::is_expired()
 {
        long now = time(0);
 
-       MSF_DBG("Expired => msfd : %d, mdns : %d", msfd_ttl < now, mdns_ttl < now);
-       dlog_print(DLOG_INFO, "MSF", "Expired => msfd : %d, mdns : %d", msfd_ttl < now, mdns_ttl < now);
        if (msfd_ttl < now && mdns_ttl < now)
                return true;
        else
@@ -102,13 +97,10 @@ void SearchProvider::setServices(list<Service> listofservices)
 void SearchProvider::setSearchListener(Search *obj)
 {
        searchListener = obj;
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 }
 
 void SearchProvider::addService(Service service)
 {
-       dlog_print(DLOG_INFO, "MSF", "SearchProvider::addService()");
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
        bool found = false;
 
        std::list<Service>::iterator iterator;
@@ -125,7 +117,6 @@ void SearchProvider::addService(Service service)
        if (!match) {
                services.push_back(service);
                found = true;
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
 
                if (found) {
                        Search::st_onFound(service);
@@ -153,7 +144,6 @@ void SearchProvider::removeService(Service service)
 void SearchProvider::removeServiceAndNotify(Service service)
 {
        removeService(service);
-       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
        Search::st_onLost(service);
 }
 
@@ -164,7 +154,6 @@ void SearchProvider::clearServices()
 
 Service SearchProvider::getServiceById(string id)
 {
-       //      MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",__FUNCTION__ ,__LINE__,__FILE__);
        std::list<Service>::iterator iterator;
        for (iterator = services.begin(); iterator != services.end(); ++iterator) {
                if (((*iterator).getId()) == id) {
@@ -176,7 +165,6 @@ Service SearchProvider::getServiceById(string id)
 
 Service SearchProvider::getServiceByIp(string ip)
 {
-       //      MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",__FUNCTION__ ,__LINE__,__FILE__);
        std::list<Service>::iterator iterator;
        for (iterator = services.begin(); iterator != services.end(); ++iterator) {
 
@@ -199,7 +187,7 @@ bool SearchProvider::isSearching()
 
 void SearchProvider::push_in_alivemap(long ttl, string id, int service_type)
 {
-       MSF_DBG("updateAlive : ttl = %d, id = %s, service_type = %d", ttl, id.c_str(), service_type);
+       MSF_DBG("push_in_alivemap : ttl = %d, id = %s, service_type = %d", ttl, id.c_str(), service_type);
 
        if (id.empty()) {
                return;
@@ -228,7 +216,6 @@ void SearchProvider::updateAlive(long ttl, string id, int service_type)
 
                ttl_info info = aliveMap[id];
 
-               MSF_DBG("mdns ttl : %d , msfd ttl : %d", info.get_ttl(MDNS), info.get_ttl(MSFD));
                info.update_ttl(_ttl, service_type);
                aliveMap[id]=info;
        }
@@ -236,14 +223,12 @@ void SearchProvider::updateAlive(long ttl, string id, int service_type)
 
 void SearchProvider::reapServices()
 {
-       dlog_print(DLOG_ERROR, "MSF", "reapServices");
        map<string,ttl_info>::iterator it;
        for(it=aliveMap.begin();it!=aliveMap.end();++it) {
                ttl_info info=it->second;
-               dlog_print(DLOG_INFO, "MSF_API", "reapService - Service id: %s", it->first.c_str());
                if ( info.is_expired()) {
                        Service service=getServiceByIp(it->first);
-                       dlog_print(DLOG_ERROR, "MSF", "reapServices - Remove service : [%s]", it->first.c_str());
+                       MSF_DBG("reapServices - Remove service : [%s]", service.getId().c_str());
                        aliveMap.erase(it->first);
                        removeServiceAndNotify(service);
                }
index 65f8709..ad06e67 100755 (executable)
@@ -48,15 +48,6 @@ Service::Service()
        //devicedata = NULL;
 }
 
-/*Service::Service(string Id,string Version,string Name,string Type,string Uri)
-{
-       id=Id;
-       version=Version;
-       name=Name;
-       type=Type;
-       uri=Uri;
-}*/
-
 Service::Service(string id1, string version1, string name1, string type1, string endPoint1)
 {
        id = id1;
@@ -66,13 +57,6 @@ Service::Service(string id1, string version1, string name1, string type1, string
        uri = endPoint1;
 }
 
-/*
-Search *Service::search()
-{
-       return Search::getInstance();
-}
-*/
-
 void Service:: getById(string id, Result_Base *result)
 {
        Search search;
@@ -82,7 +66,6 @@ void Service:: getById(string id, Result_Base *result)
        if (!status)    {
                service = search.getServiceById(id);
        } else {
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
                sleep(3);
                service = search.getServiceById(id);
                search.stop();
@@ -141,25 +124,17 @@ void Service::create(char *service_txt)
 
        posvalues = findServiceValue(ENDPOINT_PROPERTY, service_txt);
        uri = txt.substr((posvalues.start)-1, ((posvalues.end)-(posvalues.start)+1));
-
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH MDNS WITH URI [%s] [%s] [%d] in %s \n", uri.c_str(), __FUNCTION__, __LINE__, __FILE__);
 }
 
 Service Service::create(ServiceInfo servicevalue)
 {
        //if (
        string id = servicevalue.infoId;
-//     this->id=id;
        string version = servicevalue.infoVersion;
-//     this->version=version;
        string name = servicevalue.infoName;
-//     this->name=name;
        string type = servicevalue.infotype;
-//     this->type=type;
        string endPoint = servicevalue.infoURI;//TODO
-//     this->uri=endPoint;
        Service service = Service(id, version, name, type, endPoint);
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH MSFD WITH URI [%s] [%s] [%d] in %s \n", endPoint.c_str(), __FUNCTION__, __LINE__, __FILE__);
        return service;
 }
 
@@ -172,7 +147,6 @@ Service Service::create(map<string, string> serviceMap)
        string endPoint = serviceMap.find("uri")->second;//TODO
        Service service = Service(id, version, name, type, endPoint);
        return service;
-       //return Service;*/
 }
 
 position Service::findServiceValue(string substrng, char *strng)
@@ -190,7 +164,6 @@ position Service::findServiceValue(string substrng, char *strng)
 
 void Service::getDeviceInfo(Result_Base *dev_result)
 {
-       dlog_print(DLOG_INFO, "MSF", "getDeviceInfo");
        curl_service_calling(uri, 5000, dev_result);
 }
 
@@ -237,13 +210,13 @@ Service Service::getLocal(void)
                public:
                        void onSuccess(Service service)
                        {
-                               dlog_print(DLOG_INFO, "MSF", "service name : %s\n", service.getName().c_str() ? service.getName().c_str() : "name is NULL");
+                               MSF_DBG("service name : %s\n", service.getName().c_str() ? service.getName().c_str() : "name is NULL");
                                local_service = service;
                        }
 
                        void onError(Error)
                        {
-                               dlog_print(DLOG_ERROR, "MSF", "getLocal() : Fail to get local service info");
+                               MSF_DBG("getLocal() : Fail to get local service info");
                        }
        };
 
@@ -261,7 +234,7 @@ void Service::getByURI(string uri, Result_Base *result)
 
 void Service::getByURI(string uri, long timeout, Result_Base *result)
 {
-       dlog_print(DLOG_INFO, "MSF", "getByURI() uri = %s", uri.c_str());
+       MSF_DBG("getByURI() uri = %s", uri.c_str());
 
        Resulturi = result;
        //Resultdevice = NULL;
@@ -271,7 +244,6 @@ void Service::getByURI(string uri, long timeout, Result_Base *result)
 
 int Service::curl_service_calling(string uri, long timeout, void *dev_result_ptr)
 {
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
        CURL *curl;
        CURLcode res;
        struct curl_slist *headers = NULL;
@@ -283,20 +255,14 @@ int Service::curl_service_calling(string uri, long timeout, void *dev_result_ptr
                const char *c = uri.c_str();
                curl_easy_setopt(curl, CURLOPT_URL, c);
                curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
-               //curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
-               //if (timeout != 0)
                curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, timeout);
 
                curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Service::createdata);
-               //curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 5000);
                curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
-               //curl_easy_setopt(curl, CURLOPT_PORT, 8001);
-               //curl_easy_setopt(curl, CURLOPT_LOCALPORT, 8888);
 
                res = curl_easy_perform(curl);
 
                if (res != CURLE_OK) {
-                       dlog_print(DLOG_ERROR, "MSF", "####Service curl ERROR = %d ####", res);
                        MSF_DBG("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
                        createdata_process("", dev_result_ptr);
                } else {
@@ -312,18 +278,10 @@ int Service::curl_service_calling(string uri, long timeout, void *dev_result_ptr
 
 size_t Service::createdata(char *buf, size_t size, size_t nmemb, void *up)
 {
-       dlog_print(DLOG_INFO, "MSF", "createdata() 1");
-
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
        if (buf != NULL) {
-               //string data;
-
                curl_data.append(buf, size*nmemb);
-
-               //createdata_process(data, ptr);
        } else {
-               dlog_print(DLOG_ERROR, "MSF", "createdata() buf is null");
-               //createdata_process(string(), ptr);
+               MSF_DBG("createdata() buf is null");
        }
 
        return size*nmemb;
@@ -331,16 +289,11 @@ size_t Service::createdata(char *buf, size_t size, size_t nmemb, void *up)
 
 void Service::createdata_process(string data, void *dev_result_ptr)
 {
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
        if (data.length() != 0) {
                json_parse_service(data.c_str(), dev_result_ptr);
        } else {
                if (Resulturi != NULL) {
                        Resulturi->onError(Error::create("Timeout"));
-
-                       //delete (Resulturi);
-
-                       //Resulturi = NULL;
                }
                if (dev_result_ptr != NULL) {
                        (static_cast<Result_Base*> (dev_result_ptr))->onError(Error::create("Not Found"));
@@ -350,41 +303,33 @@ void Service::createdata_process(string data, void *dev_result_ptr)
 
 int Service::json_parse_service(const char *in, void *ptr)
 {
-       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
-       dlog_print(DLOG_ERROR, "MSF", "Service::json_parse_service : %s", in);
-
        JsonParser *parser = json_parser_new();
 
        if (json_parser_load_from_data(parser, in, -1, NULL)) {
        } else {
-               dlog_print(DLOG_ERROR, "MSF", "json_parsing error");
+               MSF_DBG("json_parsing error");
        }
 
        JsonObject *root = json_node_get_object(json_parser_get_root(parser));
 
        if (json_object_has_member(root, "id")) {
                serviceval.infoId = json_object_get_string_member(root, "id");
-               dlog_print(DLOG_ERROR, "MSF", "infoId set as %s", serviceval.infoId.c_str());
        }
 
        if (json_object_has_member(root, "version")) {
                serviceval.infoVersion = json_object_get_string_member(root, "version");
-               dlog_print(DLOG_ERROR, "MSF", "infoVersion set as %s", serviceval.infoVersion.c_str());
        }
 
        if (json_object_has_member(root, "name")) {
                serviceval.infoName = json_object_get_string_member(root, "name");
-               dlog_print(DLOG_ERROR, "MSF", "infoName set as %s", serviceval.infoName.c_str());
        }
 
        if (json_object_has_member(root, "type")) {
                serviceval.infotype = json_object_get_string_member(root, "type");
-               dlog_print(DLOG_ERROR, "MSF", "infotype set as %s", serviceval.infotype.c_str());
        }
 
        if (json_object_has_member(root, "uri")) {
                serviceval.infoURI = json_object_get_string_member(root, "uri");
-               dlog_print(DLOG_ERROR, "MSF", "infoURI set as %s", serviceval.infoURI.c_str());
        }
 
        if (json_object_has_member(root, "device")) {
@@ -395,10 +340,7 @@ int Service::json_parse_service(const char *in, void *ptr)
        }
 
        if ((Resulturi!= NULL)) {
-               dlog_print(DLOG_INFO, "MSF", "json_parse_service() call onSuccess()");
                Resulturi->onSuccess(create(serviceval));
-               //delete (Resulturi);
-               //Resulturi=NULL;
        }
 
        return 0;
@@ -407,8 +349,6 @@ int Service::json_parse_service(const char *in, void *ptr)
 Application  Service::createApplication(string uri)
 {
        if (!(uri == "")) {//check length and return error
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-               //Application *application = Application::create(this,uri);
                Application application = Application::create(this, uri);
                return application;
        } else {
@@ -420,8 +360,6 @@ Application  Service::createApplication(string uri)
 Application Service::createApplication(string uri, string channelId)
 {
        if (!((uri == "") || (channelId == ""))) {
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-               //Application *application=Application::create(this, uri, channelId, map_type());
                Application application = Application::create(this, uri, channelId, map_type());
                return application;
        } else {
@@ -433,8 +371,6 @@ Application Service::createApplication(string uri, string channelId)
 Application Service::createApplication(string uri, string channelId, map<string, string> startArgs)
 {
        if (!((uri == "") || (channelId == ""))) {
-               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
-               //Application *application =Application::create(this, uri, channelId, startArgs);
                Application application = Application::create(this, uri, channelId, startArgs);
                return application;
        } else {