change method of get device id
authorJihoon Jung <jh8801.jung@samsung.com>
Wed, 24 Jan 2018 07:16:47 +0000 (16:16 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:47 +0000 (19:38 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
src/companion-manager/src/comp_iot.c

index 7b1bb4e8061cc872e6b0f410e22163837a16cadf..c9efc18b902a4efd4efdddb41d79467c58eb9ea6 100755 (executable)
 
 int last_get_result;
 
-static bool _request_device_info(iotcon_device_info_h info, iotcon_error_e result,
-                void *user_data)
-{
-       int ret;
-       char *device_id = NULL;
-
-       LOG_DEBUG("device info found");
-
-       ret = iotcon_device_info_get_property(info, IOTCON_DEVICE_INFO_ID, &device_id);
-       if (IOTCON_ERROR_NONE != ret) {
-               return false;
-       }
-
-       LOG_DEBUG("device_id : %s", device_id);
-
-       comp_context_t *comp_ctx = comp_context_get_context();
-       comp_ctx->device_uuid = g_strdup(device_id);
-
-       /*
-               "Group device" resource
-               The Group device resource is only one per device.
-          resource type is core.comp.group.device
-               This resource has device information as an attribute.
-               The resource uri is /comp/group/device + certain uuid.
-               ex) /comp/group/device123123
-       */
-       //comp_iot_add_resource(FN_RESOURCE_TYPE_GROUP_DEVICE, comp_ctx->device_uuid);
-
-       return false;
-}
-
 int comp_iot_initialize()
 {
+       char *device_id = NULL;
        char data_dir[MAX_FILE_PATH_LEN] = {0,};
 
        snprintf(data_dir, MAX_FILE_PATH_LEN, "%s/network/%s",
@@ -55,13 +25,20 @@ int comp_iot_initialize()
        }
 
        LOG_DEBUG("iotcon_initialize : %s", get_error_message(ret));
-       ret = iotcon_find_device_info(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_ALL,
-                               NULL, _request_device_info, NULL);
 
-       if (IOTCON_ERROR_NONE != ret) {
-               LOG_ERR("iotcon_find_device_info: Failed %s", get_error_message(ret));
-               return false;
-       }
+       OicUuid_t uuid;
+       ret = GetDoxmDeviceID(&uuid);
+       if      (OC_STACK_OK != ret)
+               LOG_DEBUG("GetDoxmDevOwnerId failed = [%d][%s]", ret, get_error_message(ret));
+
+       ret = ConvertUuidToStr(&uuid, &device_id);
+       if (OC_STACK_OK != ret)
+               LOG_DEBUG("ConvertUuidToStr failed = [%d][%s]", ret, get_error_message(ret));
+
+       LOG_DEBUG("device_id : %s", device_id);
+
+       comp_context_t *comp_ctx = comp_context_get_context();
+       comp_ctx->device_uuid = g_strdup(device_id);
 
        /* Do Self-Ownership Transfer */
        ret = OCConfigSelfOwnership();