gboolean group_find(Group *group, GDBusMethodInvocation *invocation,
gpointer user_data);
+gboolean group_get_found_groups(Group *group, GDBusMethodInvocation *invocation,
+ gpointer user_data);
+
gboolean group_join(Group *group, GDBusMethodInvocation *invocation,
gpointer user_data);
<method name="Find">
<arg type="i" name="result" direction="out" />
</method>
+ <method name="GetFoundGroups">
+ <arg type="i" name="result" direction="out" />
+ <arg type="aa{sv}" name="groups" direction="out" />
+ </method>
<method name="Join">
<arg type="i" name="group_count" direction="out" />
<arg type="aa{sv}" name="groups" direction="out" />
fn_group_find();
- group_complete_create(group, invocation, result);
+ group_complete_find(group, invocation, result);
return TRUE;
- }
+}
+
+gboolean group_get_found_groups(Group *group, GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ gint result = 0;
+ GVariant *group_data;
+
+ LOG_DEBUG("get found groups called using dbus successful");
+
+ group_data = fn_group_get_found_groups();
+
+ group_complete_get_found_groups(group, invocation, result, group_data);
+ return TRUE;
+}
gboolean group_join(Group *group, GDBusMethodInvocation *invocation,
gpointer user_data)
return FN_ERROR_NONE;
}
+GVariant *fn_group_get_found_groups()
+{
+ GVariantBuilder builder;
+ GVariant *group_data;
+ GList *iter = NULL;
+
+ g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
+
+ iter = found_group_list;
+ while(iter != NULL) {
+ fn_group_t *group = (fn_group_t *)iter->data;
+
+ g_variant_builder_open(&builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_add(&builder, "{sv}", "URI",
+ g_variant_new_string(group->uri_path));
+ g_variant_builder_add(&builder, "{sv}", "DeviceID",
+ g_variant_new_string(group->device_id));
+ g_variant_builder_add(&builder, "{sv}", "GroupName",
+ g_variant_new_string(group->group_name));
+ g_variant_builder_add(&builder, "{sv}", "HostAddress",
+ g_variant_new_string(group->host_addr));
+ g_variant_builder_add(&builder, "{sv}", "GroupDeviceType",
+ g_variant_new_string(group->resource_type));
+ g_variant_builder_close(&builder);
+
+ iter = g_list_next(iter);
+ }
+
+ group_data = g_variant_builder_end(&builder);
+
+ return group_data;
+}
+
int fn_group_add_new(char *uri_path, char *device_id, char *device_name,
char *host_addr, char *resource_type)
{