diff options
author | youngman <yman.jung@samsung.com> | 2015-11-12 17:24:47 +0900 |
---|---|---|
committer | Youngjae Shin <yj99.shin@samsung.com> | 2015-11-19 14:54:46 +0900 |
commit | 5561bf52e9bf32c5762c3fc5557fb7c594431aca (patch) | |
tree | 91fac2f892989b2b6884d2a399541a8a59114c14 /lib | |
parent | b0748a1a3e5655fda6de84065142c5467cfc10a0 (diff) | |
download | iotcon-5561bf52e9bf32c5762c3fc5557fb7c594431aca.tar.gz iotcon-5561bf52e9bf32c5762c3fc5557fb7c594431aca.tar.bz2 iotcon-5561bf52e9bf32c5762c3fc5557fb7c594431aca.zip |
send empty representation
Change-Id: I3eab47bb318009a5722dfe0f3a58a8d6a21a6318
Signed-off-by: youngman <yman.jung@samsung.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/icl-payload.c | 18 | ||||
-rw-r--r-- | lib/icl-response.c | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/icl-payload.c b/lib/icl-payload.c index 769e958..4e50ada 100644 --- a/lib/icl-payload.c +++ b/lib/icl-payload.c @@ -158,6 +158,21 @@ static GVariant* _icl_state_value_to_gvariant(GHashTable *hash) } +static GVariant* _icl_representation_empty_gvariant(void) +{ + GVariant *value; + GVariantBuilder types, repr, children; + + g_variant_builder_init(&types, G_VARIANT_TYPE("as")); + g_variant_builder_init(&repr, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&children, G_VARIANT_TYPE("av")); + + value = g_variant_new("(siasa{sv}av)", IC_STR_NULL, 0, &types, &repr, &children); + + return value; +} + + GVariant* icl_representation_to_gvariant(iotcon_representation_h repr) { GList *node; @@ -168,7 +183,8 @@ GVariant* icl_representation_to_gvariant(iotcon_representation_h repr) GVariantBuilder *repr_gvar = NULL; GVariantBuilder children, resource_types; - RETV_IF(NULL == repr, NULL); + if (NULL == repr) + return _icl_representation_empty_gvariant(); /* uri path */ uri_path = ic_utils_dbus_encode_str(repr->uri_path); diff --git a/lib/icl-response.c b/lib/icl-response.c index 67b3066..4c54da0 100644 --- a/lib/icl-response.c +++ b/lib/icl-response.c @@ -175,7 +175,8 @@ static int _icl_response_check_representation_visibility(iotcon_response_h resp) int ret; RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == resp->repr, IOTCON_ERROR_INVALID_PARAMETER); + if (NULL == resp->repr) + return IOTCON_ERROR_NONE; iotcon_representation_h first = resp->repr; @@ -217,7 +218,6 @@ API int iotcon_response_send(iotcon_response_h resp) RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS); RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == resp->repr, IOTCON_ERROR_INVALID_PARAMETER); ret = _icl_response_check_representation_visibility(resp); if (IOTCON_ERROR_NONE != ret) { |