}
gboolean group_device_eject(Group *group, GDBusMethodInvocation *invocation,
- gchar *uuid, gpointer user_data)
+ gchar *uuid_dev1, gchar *uuid_dev2, gpointer user_data)
{
gint result = 0;
LOG_DEBUG("group device eject called using dbus successful");
- result = comp_group_dismiss(uuid);
+ result = comp_group_dismiss(uuid_dev1, uuid_dev2);
group_complete_device_eject(group, invocation, result);
};
struct agent_s agent;
static bool mot_dev2 = false;
+static char *device_uuid1 = NULL;
+static char *device_uuid2 = NULL;
int agent_get_ownerid(char* deviceid)
{
return COMP_ERROR_IO_ERROR;
}
+ if (result == COMP_ERROR_NONE) {
+ device_uuid1 = g_strdup(uuid_str1);
+ device_uuid2 = g_strdup(uuid_str2);
+ }
+
return result;
}
return FALSE;
}
+static gboolean __perform_remove_mot_dev2(gpointer data)
+{
+ int ret;
+
+ ret = agent_remove_mo_at_device(device_uuid2);
+ if (ret != COMP_ERROR_NONE) {
+ comp_group_notify_group_dismiss(ret);
+ g_free(device_uuid1);
+ device_uuid1 = NULL;
+ g_free(device_uuid2);
+ device_uuid1 = NULL;
+ }
+
+ return FALSE;
+}
+
+static gboolean __perform_remove_cred_at_local(gpointer data)
+{
+ int ret;
+
+ ret = agent_remove_cred_at_local(device_uuid1);
+ if (ret != COMP_ERROR_NONE) {
+ comp_group_notify_group_dismiss(ret);
+ g_free(device_uuid1);
+ device_uuid1 = NULL;
+ g_free(device_uuid2);
+ device_uuid1 = NULL;
+ }
+
+ return FALSE;
+}
+
+
static void _agent_signal_handler(GDBusConnection *connection,
const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
const gchar *signal_name, GVariant *parameters, gpointer userdata)
} else if (0 == g_strcmp0(signal_name, "remove_mo_done")) {
g_variant_get(parameters, "(i)", &result);
LOG_DEBUG("Result : %d", result);
+
+ if (result != 0) {
+ comp_group_notify_group_dismiss(result);
+ g_free(device_uuid1);
+ device_uuid1 = NULL;
+ g_free(device_uuid2);
+ device_uuid1 = NULL;
+ } else
+ g_timeout_add(1000, __perform_remove_cred_at_local, NULL);
} else if (0 == g_strcmp0(signal_name, "remove_cred_local_done")) {
g_variant_get(parameters, "(i)", &result);
LOG_DEBUG("Result : %d", result);
comp_group_notify_group_dismiss(result);
+ g_free(device_uuid1);
+ device_uuid1 = NULL;
+ g_free(device_uuid2);
+ device_uuid1 = NULL;
} else if (0 == g_strcmp0(signal_name, "pairwise_done")) {
g_variant_get(parameters, "(i)", &result);
LOG_DEBUG("Result : %d", result);
} else if (0 == g_strcmp0(signal_name, "unpair_done")) {
g_variant_get(parameters, "(i)", &result);
LOG_DEBUG("Result : %d", result);
+
+ if (result != 0) {
+ comp_group_notify_group_dismiss(result);
+ g_free(device_uuid1);
+ device_uuid1 = NULL;
+ g_free(device_uuid2);
+ device_uuid1 = NULL;
+ } else
+ g_timeout_add(1000, __perform_remove_mot_dev2, NULL);
}
}
static int _subscribe_event()