From: Jihoon Jung Date: Wed, 24 Jan 2018 07:16:47 +0000 (+0900) Subject: change method of get device id X-Git-Tag: submit/tizen/20190131.065036~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16fb646a157fff758d75fdda895a8628015949ea;p=platform%2Fcore%2Fapi%2Fmulti-device-group.git change method of get device id Signed-off-by: Jihoon Jung --- diff --git a/src/companion-manager/src/comp_iot.c b/src/companion-manager/src/comp_iot.c index 7b1bb4e..c9efc18 100755 --- a/src/companion-manager/src/comp_iot.c +++ b/src/companion-manager/src/comp_iot.c @@ -10,39 +10,9 @@ 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();