fix bug : can't parse the representation having state-state-list structure
authorMinchul Lee <slotus.lee@samsung.com>
Tue, 24 Nov 2015 07:21:43 +0000 (16:21 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 30 Nov 2015 23:51:26 +0000 (08:51 +0900)
Change-Id: I120136b9b9b6020210f6f7e2a591ee6c4a0edaea
Signed-off-by: Minchul Lee <slotus.lee@samsung.com>
daemon/icd-payload.c

index 0dd2c0f..3937b3f 100644 (file)
@@ -594,14 +594,20 @@ static void _icd_state_value_from_gvariant(OCRepPayload *repr, GVariantIter *ite
                        else
                                OCRepPayloadSetPropString(repr, key, str_value);
 
+               } else if (g_variant_is_of_type(var, G_VARIANT_TYPE ("a{sv}"))) {
+                       GVariantIter state_iter;
+                       repr_value = OCRepPayloadCreate();
+                       g_variant_iter_init(&state_iter, var);
+                       _icd_state_value_from_gvariant(repr_value, &state_iter);
+                       OCRepPayloadSetPropObjectAsOwner(repr, key, repr_value);
+
                } else if (g_variant_is_of_type(var, G_VARIANT_TYPE_ARRAY)) {
                        memset(&value_list, 0, sizeof(struct icd_state_list_s));
                        _icd_state_list_from_gvariant(var, &value_list, 0);
                        _icd_state_array_from_list(repr, &value_list, key);
 
-               } else if (g_variant_is_of_type(var, G_VARIANT_TYPE("(siasa{sv}av)"))) {
-                       repr_value = icd_payload_representation_from_gvariant(var);
-                       OCRepPayloadSetPropObjectAsOwner(repr, key, repr_value);
+               } else {
+                       ERR("Invalid type(%s)", g_variant_get_type_string(var));
                }
        }