Modify comments&logs on template
authorJin Yoon <jinny.yoon@samsung.com>
Mon, 28 Aug 2017 23:12:24 +0000 (08:12 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Mon, 28 Aug 2017 23:12:24 +0000 (08:12 +0900)
Change-Id: I29dfc10995ff6a14db3ea11fbafd90001e40ca6b

src/connectivity.c
src/controller.c

index 0856966..2485850 100644 (file)
@@ -186,6 +186,24 @@ error:
        return NULL;
 }
 
+static void _print_iotcon_error(int err_no)
+{
+       switch (err_no) {
+               case IOTCON_ERROR_NOT_SUPPORTED:
+                       _E("IOTCON_ERROR_NOT_SUPPORTED");
+                       break;
+               case IOTCON_ERROR_PERMISSION_DENIED:
+                       _E("IOTCON_ERROR_PERMISSION_DENIED");
+                       break;
+               case IOTCON_ERROR_INVALID_PARAMETER:
+                       _E("IOTCON_ERROR_INVALID_PARAMETER");
+                       break;
+               default:
+                       _E("Error : [%d]", err_no);
+                       break;
+       }
+}
+
 int connectivity_notify_bool(connectivity_resource_s *resource_info, const char *key, bool value)
 {
        iotcon_representation_h representation;
@@ -200,7 +218,11 @@ int connectivity_notify_bool(connectivity_resource_s *resource_info, const char
        retv_if(!representation, -1);
 
        ret = iotcon_resource_notify(resource_info->res, representation, resource_info->observers, IOTCON_QOS_HIGH);
-       retv_if(IOTCON_ERROR_NONE != ret, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               _I("There are some troubles for notifying value[%d]", ret);
+               _print_iotcon_error(ret);
+               return -1;
+       }
 
        _destroy_representation(representation);
 
@@ -221,7 +243,11 @@ int connectivity_notify_int(connectivity_resource_s *resource_info, const char *
        retv_if(!representation, -1);
 
        ret = iotcon_resource_notify(resource_info->res, representation, resource_info->observers, IOTCON_QOS_HIGH);
-       retv_if(IOTCON_ERROR_NONE != ret, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               _I("There are some troubles for notifying value[%d]", ret);
+               _print_iotcon_error(ret);
+               return -1;
+       }
 
        _destroy_representation(representation);
 
@@ -242,7 +268,11 @@ int connectivity_notify_double(connectivity_resource_s *resource_info, const cha
        retv_if(!representation, -1);
 
        ret = iotcon_resource_notify(resource_info->res, representation, resource_info->observers, IOTCON_QOS_HIGH);
-       retv_if(IOTCON_ERROR_NONE != ret, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               _I("There are some troubles for notifying value[%d]", ret);
+               _print_iotcon_error(ret);
+               return -1;
+       }
 
        _destroy_representation(representation);
 
index 4f9416c..b994f48 100644 (file)
@@ -54,7 +54,7 @@ static Eina_Bool control_sensors_cb(void *data)
         * Notifies specific clients that resource's attributes have changed.
         */
        /*
-       if (connectivity_notify_bool(ad->resource_info, CONNECTIVITY_KEY, value) == -1)
+       if (connectivity_notify_bool(ad->resource_info, KEY, VALUE) == -1)
                _E("Cannot notify message");
        */