From 0a2a02ad3abdb6e77ecf0a1fdd5bacfa542c1ed9 Mon Sep 17 00:00:00 2001 From: Jin Yoon Date: Tue, 29 Aug 2017 08:12:24 +0900 Subject: [PATCH] Modify comments&logs on template Change-Id: I29dfc10995ff6a14db3ea11fbafd90001e40ca6b --- src/connectivity.c | 36 +++++++++++++++++++++++++++++++++--- src/controller.c | 2 +- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/connectivity.c b/src/connectivity.c index 0856966..2485850 100644 --- a/src/connectivity.c +++ b/src/connectivity.c @@ -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); diff --git a/src/controller.c b/src/controller.c index 4f9416c..b994f48 100644 --- a/src/controller.c +++ b/src/controller.c @@ -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"); */ -- 2.7.4