comp-manager: Added GetRemoteDevice DBUS method to get mot enabled device
authorSaurav Babu <saurav.babu@samsung.com>
Fri, 12 Jan 2018 12:32:07 +0000 (18:02 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:40 +0000 (19:38 +0900)
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
src/companion-manager/include/comp_gdbus_group.h
src/companion-manager/include/comp_group.h
src/companion-manager/src/comp_gdbus.c
src/companion-manager/src/comp_gdbus_group.c
src/companion-manager/src/comp_group.c
src/companion-manager/src/companion_gdbus.xml

index d12dde6..b9d264e 100755 (executable)
@@ -32,6 +32,9 @@ gboolean group_device_invite(Group *group, GDBusMethodInvocation *invocation,
 gboolean group_device_eject(Group *group, GDBusMethodInvocation *invocation,
        gchar *uuid, gpointer user_data);
 
+gboolean group_get_remote_device(Group *group, GDBusMethodInvocation *invocation,
+       gpointer user_data);
+
 void notify_group_found(GVariant *group_data);
 void notify_group_finish(int ret);
 void notify_device_found(int device_count, GVariant *device_data);
index 54826be..241722d 100755 (executable)
@@ -58,8 +58,10 @@ void comp_group_notify_group_invite(int result);
 int comp_group_dismiss(gchar *uuid);
 void comp_group_notify_group_dismiss(int result);
 
+GVariant *comp_group_get_remote_mot_enabled_devices();
+int comp_group_get_mot_device_count();
+
 /* Join to remote device group */
-int comp_group_get_remote_groups(/* callback */); //Get all of group in network (Async)
 int comp_group_join_to(/* callback */); //Join this device to in certain remote group (Async)
 int comp_group_leave_from(/* callback */); //leave from certain remote group (Async)
 
index 9b6ced7..82e5215 100755 (executable)
@@ -64,6 +64,11 @@ static bool __group_init(GDBusConnection *connection)
                G_CALLBACK(group_device_eject),
                NULL);
 
+       g_signal_connect(group_skeleton,
+               "handle-get-remote-device",
+               G_CALLBACK(group_get_remote_device),
+               NULL);
+
        group = g_dbus_object_manager_server_new(COMP_DBUS_GROUP_PATH);
 
        // Set connection to 'manager'
index afa6039..89f851a 100755 (executable)
@@ -108,6 +108,22 @@ gboolean group_device_eject(Group *group, GDBusMethodInvocation *invocation,
        return TRUE;
 }
 
+gboolean group_get_remote_device(Group *group, GDBusMethodInvocation *invocation,
+       gpointer user_data)
+{
+       int dev_count = 0;
+       GVariant *device_data;
+
+       LOG_DEBUG("get remote device called using dbus successful");
+
+       dev_count = comp_group_get_mot_device_count();
+       device_data = comp_group_get_remote_mot_enabled_devices();
+
+       group_complete_get_remote_device(group, invocation, dev_count, device_data);
+
+       return TRUE;
+}
+
 void notify_group_found(GVariant *group_data)
 {
        group_emit_group_found(group_dbus_get_object(), group_data);
index bc1ce40..409be02 100755 (executable)
@@ -273,6 +273,14 @@ GVariant *comp_group_get_remote_mot_enabled_devices()
        return group_data;
 }
 
+int comp_group_get_mot_device_count()
+{
+       if (mot_enb_dev_list)
+               return g_list_length(mot_enb_dev_list);
+
+       return 0;
+}
+
 void comp_group_notify_mot_enable_device_done(int device_count)
 {
        GVariant *device_data;
@@ -348,7 +356,7 @@ int comp_group_dismiss(gchar *uuid)
 }
 
 /* Join to remote device group */
-int comp_group_get_remote_groups(/* callback */){} //Get all of group in network (Async)
+
 int comp_group_join_to(/* callback */){} //Join this device to in certain remote group (Async)
 int comp_group_leave_from(/* callback */){} //leave from certain remote group (Async)
 
index 96af362..c00926e 100755 (executable)
                        <arg type="s" name="uuid" direction="in" />
                        <arg type="i" name="result" direction="out" />
                </method>
+               <method name="GetRemoteDevice">
+                       <arg type="i" name="device_count" direction="out" />
+                       <arg type="aa{sv}" name="device_info" direction="out" />
+               </method>
 
                <!-- Signal (D-Bus) definitions -->
                <signal name="GroupFound">