aboutsummaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorMatt Porter <mporter@konsulko.com>2018-07-11 07:03:32 -0400
committerMatt Porter <mporter@konsulko.com>2018-07-11 07:03:32 -0400
commit91f8941a5d3571ee107635a945cdd00dcb267b6f (patch)
tree8e3203849259233d1da9f641d71cc59acfe2b7ac /binding
parentfa4219714606a9d45bba59c1f84c3ee77dbdbdc7 (diff)
Return service change event arrays in a nested object
When generating a services event, nest the array of service changes in another object under the "values" key. Bug-AGL: SPEC-1540 Change-Id: Id71bc1863ab564a7f6e4753a7fc082ccbe5a9596 Signed-off-by: Matt Porter <mporter@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/network-api.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/binding/network-api.c b/binding/network-api.c
index f6b08d0..f2c3c7a 100644
--- a/binding/network-api.c
+++ b/binding/network-api.c
@@ -266,7 +266,7 @@ static void network_manager_signal_callback(
const gchar *path = NULL;
const gchar *key = NULL;
const gchar *basename;
- json_object *jresp = NULL, *jobj, *jprop;
+ json_object *jarray = NULL, *jresp = NULL, *jobj, *jprop;
struct afb_event *event = NULL;
GVariantIter *array;
gboolean is_config, ret;
@@ -326,7 +326,9 @@ static void network_manager_signal_callback(
} else if (!g_strcmp0(signal_name, "ServicesChanged")) {
- jresp = json_object_new_array();
+ jresp = json_object_new_object();
+ jarray = json_object_new_array();
+ json_object_object_add(jresp, "values", jarray);
g_variant_get(parameters, "(a(oa{sv})ao)", &array1, &array2);
@@ -363,7 +365,7 @@ static void network_manager_signal_callback(
json_object_object_add(jobj, "properties",
jprop);
- json_object_array_add(jresp, jobj);
+ json_object_array_add(jarray, jobj);
}
while (g_variant_iter_loop(array2, "o", &path)) {
@@ -379,7 +381,7 @@ static void network_manager_signal_callback(
json_object_object_add(jobj, "action",
json_object_new_string("removed"));
- json_object_array_add(jresp, jobj);
+ json_object_array_add(jarray, jobj);
}
g_variant_iter_free(array2);