comp-manager: fixed build warnings
authorsaerome.kim <saerome.kim@samsung.com>
Tue, 16 Jan 2018 06:48:09 +0000 (15:48 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:40 +0000 (19:38 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
capi/demo/comp-manager.c
capi/demo/main.c
capi/include/companion_debug.h
capi/src/companion.c
capi/unittest/companion_unit_test.cpp
src/companion-manager/include/comp_mot_agent.h
src/companion-manager/src/comp_gdbus_group.c
src/companion-manager/src/comp_group.c
src/companion-manager/src/comp_iot.c

index b26f0ec69c9b8b1952ecea1b94e552697fb24ea6..016e1a84564fd3f6bf0ddb453b2ec7cb200f9db1 100644 (file)
@@ -31,9 +31,61 @@ GList *found_group_list;
 GList *found_device_list;
 
 static char groupid[MENU_DATA_SIZE + 1] = "mygroup";
-static char timeout[MENU_DATA_SIZE + 1] = "1";
+static char timeout[MENU_DATA_SIZE + 1] = "5";
 static char group_idx[MENU_DATA_SIZE + 1] = "1";
 
+void _device_finish_cb(int result, void *user_data)
+{
+       msgb("Find Devices Finished");
+}
+
+bool _device_found_cb(companion_device_h device, void *user_data)
+{
+       char *device_id;
+       char *friendly_name;
+       char *device_type;
+
+       companion_device_information_get_device_id(device, &device_id);
+       companion_device_information_get_friendly_name(device, &friendly_name);
+       companion_device_information_get_device_type(device, &device_type);
+
+       msgb("device_id : %s, name : %s, type : %s", device_id, friendly_name, device_type);
+
+       if (device_id)
+               free(device_id);
+       if (friendly_name)
+               free(friendly_name);
+       if (device_type)
+               free(device_type);
+
+       found_device_list = g_list_prepend(found_device_list, device);
+
+       return TRUE;
+}
+static int run_devices_find(MManager *mm, struct menu_data *menu)
+{
+       int ret;
+       int duration;
+       msg("Find Devices");
+
+       if (strlen(timeout))
+               duration = (unsigned short)strtol(timeout, NULL, 10);
+
+       ret = companion_device_find(duration, _device_found_cb, _device_finish_cb, NULL);
+       if (COMP_ERROR_NONE != ret) {
+               msgr("Failed to Find Devices: [%s(0x%X)]", comp_error_to_string(ret), ret);
+               return RET_FAILURE;
+       }
+       msg(" - companion_device_find() ret: [0x%X] [%s]", ret, comp_error_to_string(ret));
+
+       if (found_device_list)
+               g_list_free(found_device_list);
+
+       msg("");
+
+       return RET_SUCCESS;
+}
+
 static void _group_leave_finish_cb(int result, void *user_data)
 {
     msgb("leave operation finished");
@@ -207,6 +259,9 @@ static int run_group_find(MManager *mm, struct menu_data *menu)
        }
        msg(" - companion_group_find() ret: [0x%X] [%s]", ret, comp_error_to_string(ret));
 
+       if (found_group_list)
+               g_list_free(found_group_list);
+
        return RET_SUCCESS;
 }
 
@@ -251,6 +306,12 @@ static struct menu_data menu_group_leave[] = {
        { NULL, NULL, },
 };
 
+static struct menu_data menu_devices_find[] = {
+       { "0", "Timeout", NULL, NULL, timeout },
+       { "2", "Run", NULL, run_devices_find, NULL },
+       { NULL, NULL, },
+};
+
 struct menu_data menu_comp_manager[] = {
        { "1", "Group Create", menu_group_create, NULL, NULL },
        { "2", "Find Groups", menu_group_find, NULL, NULL },
@@ -260,7 +321,7 @@ struct menu_data menu_comp_manager[] = {
        { "6", "Delete Group", NULL, NULL, NULL },
        { "7", "Merge Group", NULL, NULL, NULL },
        { "8", "Get Group Member Devices", NULL, NULL, NULL },
-       { "9", "Find Devices", NULL, NULL, NULL },
+       { "9", "Find Devices", menu_devices_find, NULL, NULL },
        { "10", "Invite Device", NULL, NULL, NULL },
        { "11", "Eject Device", NULL, NULL, NULL },
        { NULL, NULL, },
index 0dc773661d535cb16e74b3d9bace09d5f47d26de..adb90068858c4ce8ea77a59d6169f56c6b3541ba 100644 (file)
@@ -71,7 +71,7 @@ static int __init_func(MManager *mm, struct menu_data *menu)
 }
 
 static struct menu_data menu_main[] = {
-       { "1", "comp-manager", menu_comp_manager, NULL, NULL },
+       { "1", "Comp-Manager", menu_comp_manager, NULL, NULL },
        { NULL, NULL, },
 };
 
index 9b4f68d9e274633911f69e9c8a965ff9120f18bc..dd5635f0ecd71643fa91bed9cbb6d769e2f1cfdd 100755 (executable)
 #define COLOR_CYAN  "\033[0;36m"
 #define COLOR_GRAY  "\033[0;37m"
 #define COLOR_END   "\033[0;m"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
 #define LOG_TAG "COMP_MANAGER_CAPI"
 
 #define _ERR(fmt, ...) \
index 912ea6ba135358d95f8969c62538956658efe4a9..be2a72d07c55923a54444cf3010f03cc0c982b5d 100755 (executable)
@@ -450,6 +450,8 @@ int companion_device_invite(companion_group_h group,
        device_invite_result_cb.user_data = user_data;
 
        group_call_device_invite_sync(group_proxy, dev->device_id, PIN, &ret, NULL, &error);
+
+       return ret;
 }
 
 int companion_device_eject(companion_group_h group,
@@ -463,6 +465,8 @@ int companion_device_eject(companion_group_h group,
        device_eject_result_cb.user_data = user_data;
 
        group_call_device_eject_sync(group_proxy, dev->device_id, &ret, NULL, &error);
+
+       return ret;
 }
 
 int companion_group_information_get_type(companion_group_h group, companion_group_type_e *type)
index 513f9e9bb9eed3d75e35669313ec7e783833c060..ac9c4314b17e1f350fdba609a0ab0ed791eb1c39 100755 (executable)
@@ -39,7 +39,7 @@ TEST(companion, companion_group_create_p) {
        int ret;
 
        companion_initialize();
-       ret = companion_group_create("group1");
+       ret = companion_group_create((char *)"group1");
 
        cout << "TEST END :" <<  ret << endl;
 }
index 8288ba5fc19b1e5c54508b6f13f5da47adada04a..f4ac03139afee1de436f37fe974fe1bb62e9f37e 100755 (executable)
@@ -38,7 +38,7 @@ int agent_pairwise(char* target1, char *subject1, char *uri1,
        char *rt2, char *interface2, int permission2);
 int agent_remove_mo_at_device(char* uuid_str);
 int agent_remove_cred_at_local(char* uuid_str);
-int agent_remove_myowned_device(char* uuid_str);
+int agent_remove_myowned_device(char* uuid_str1, char *uuid_str2);
 
 #ifdef __cplusplus
 }
index e9e81de16f0675460f50db4dadc8d257d337b885..ffef284db4ca892cdc517479096d3004d7666717 100755 (executable)
@@ -168,7 +168,7 @@ gboolean group_send_data(Group *group, GDBusMethodInvocation *invocation,
 
        group_complete_send_data(group, invocation, 0);
 
-       return TRUE;
+       return ret;
 }
 
 void notify_group_found(GVariant *group_data)
index 37229354f8433501a5eabb94c463feb83d2d32c4..71ab12b74ef3a245fd3909afa4f5ae49f17ada87 100755 (executable)
@@ -1,5 +1,6 @@
 #include <comp_enum.h>
 #include <comp_group.h>
+#include <comp_mot_agent.h>
 #include <comp_gdbus_group.h>
 
 GList *found_group_list;
@@ -11,7 +12,7 @@ static char *group_invite_pin = NULL;
 int comp_group_initialize()
 {
        //Initialize memory of context
-
+       return COMP_ERROR_NONE;
 }
 
 /* create group and destroy */
@@ -47,7 +48,9 @@ int comp_group_create(char* name)
 
 int comp_group_destroy(comp_group_t *handle)
 {
-
+       int ret = COMP_ERROR_NONE;
+       NOTUSED(handle);
+       return ret;
 }
 
 void _free_func (gpointer data)
@@ -150,7 +153,6 @@ GVariant *comp_group_get_found_groups()
 int comp_group_add_new(char *uri_path, char *device_id, char *device_name,
                                         char *host_addr, char *resource_type, comp_group_type_e type)
 {
-       int ret;
        comp_group_t *group;
        GVariantBuilder builder;
        GVariant *group_data;
@@ -410,8 +412,17 @@ int comp_group_send_data(gchar *uuid_dev, gchar *data)
 
 /* Join to remote device group */
 
-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)
+int comp_group_join_to(/* callback */) //Join this device to in certain remote group (Async)
+{
+       int ret = COMP_ERROR_NONE;
+       return ret;
+}
+
+int comp_group_leave_from(/* callback */) //leave from certain remote group (Async)
+{
+       int ret = COMP_ERROR_NONE;
+       return ret;
+}
 
 /* Called when daemon is end. */
 int comp_group_deinitialize()
index 370cf387cdae82172af3ddb4b65ee6c97a721e3f..64876f8adac8424d8b6be7991c7d49cfc49b5493 100755 (executable)
@@ -3,6 +3,7 @@
 
 #include <comp_iot.h>
 #include <comp_group.h>
+#include <comp_gdbus_group.h>
 
 #define MAX_FILE_PATH_LEN 1024
 #define SVR_DB_FILE_NAME "oic_svr_db_comp_manager.dat"