(ACR) device info / platform info handle
authoryoungman <yman.jung@samsung.com>
Wed, 14 Oct 2015 01:48:20 +0000 (10:48 +0900)
committeryoungman <yman.jung@samsung.com>
Tue, 3 Nov 2015 11:08:20 +0000 (20:08 +0900)
Change-Id: I8241e96afe6e119c3705c4936d67abfc079c59fd
Signed-off-by: youngman <yman.jung@samsung.com>
daemon/icd-payload.c
lib/icl-dbus-type.c
lib/icl-dbus-type.h
lib/icl-device.c
lib/icl-device.h [new file with mode: 0644]
lib/include/iotcon-constant.h
lib/include/iotcon-struct.h
lib/include/iotcon.h
test/device-test-client.c
test/device-test-server.c

index 471baac..dbe7e9f 100644 (file)
@@ -51,9 +51,9 @@ GVariant** icd_payload_res_to_gvariant(OCPayload *payload, OCDevAddr *dev_addr)
        GVariantBuilder types;
        OCRandomUuidResult random_res;
        OCDiscoveryPayload *discovered;
-       char sid[UUID_STRING_SIZE] = {0};
        struct OCResourcePayload *resource;
        int i, is_observable, ret, res_count;
+       char device_id[UUID_STRING_SIZE] = {0};
 
        discovered = (OCDiscoveryPayload*)payload;
        resource = discovered->resources;
@@ -72,8 +72,8 @@ GVariant** icd_payload_res_to_gvariant(OCPayload *payload, OCDevAddr *dev_addr)
                        resource = resource->next;
                }
 
-               /* sid */
-               random_res = OCConvertUuidToString(resource->sid, sid);
+               /* device id */
+               random_res = OCConvertUuidToString(resource->sid, device_id);
                if (RAND_UUID_OK != random_res) {
                        ERR("OCConvertUuidToString() Fail(%d)", random_res);
                        resource = resource->next;
@@ -114,7 +114,7 @@ GVariant** icd_payload_res_to_gvariant(OCPayload *payload, OCDevAddr *dev_addr)
                /* port */
                port = (resource->port)? resource->port:dev_addr->port;
 
-               value[i] = g_variant_new("(ssiasibsi)", resource->uri, sid, ifaces, &types,
+               value[i] = g_variant_new("(ssiasibsi)", resource->uri, device_id, ifaces, &types,
                                is_observable, resource->secure, dev_addr->addr, port);
                DBG("found resource[%d] : %s", i, g_variant_print(value[i], FALSE));
 
@@ -325,16 +325,16 @@ static GVariant* _icd_payload_device_to_gvariant(OCDevicePayload *repr)
 {
        GVariant *value;
        OCRandomUuidResult random_res;
-       char sid[UUID_STRING_SIZE] = {0};
+       char device_id[UUID_STRING_SIZE] = {0};
 
-       random_res = OCConvertUuidToString(repr->sid, sid);
+       random_res = OCConvertUuidToString(repr->sid, device_id);
        if (RAND_UUID_OK != random_res) {
                ERR("OCConvertUuidToString() Fail(%d)", random_res);
                return NULL;
        }
 
-       value = g_variant_new("(ssss)", repr->deviceName, sid, repr->specVersion,
-                       repr->dataModelVersion);
+       value = g_variant_new("(sssss)", repr->uri, repr->deviceName, repr->specVersion,
+                       device_id, repr->dataModelVersion);
 
        return value;
 }
index 6bebd8b..0b771b4 100644 (file)
@@ -29,6 +29,7 @@
 #include "icl-response.h"
 #include "icl-remote-resource.h"
 #include "icl-repr.h"
+#include "icl-device.h"
 #include "icl-payload.h"
 #include "icl-observation.h"
 #include "icl-dbus-type.h"
@@ -138,17 +139,17 @@ GVariant* icl_dbus_remote_resource_to_gvariant(struct icl_remote_resource *resou
 }
 
 
-GVariant* icl_dbus_device_info_to_gvariant(const char *device_name)
+GVariant* icl_dbus_device_info_to_gvariant(iotcon_device_info_h device_info)
 {
        GVariant *value;
 
-       value = g_variant_new("(s)", device_name);
+       value = g_variant_new("(s)", device_info->device_name);
 
        return value;
 }
 
 
-GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_s *platform_info)
+GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_platform_info)
 {
        GVariant *value;
 
@@ -157,7 +158,7 @@ GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_s *platform_in
                        platform_info->manuf_name,
                        platform_info->manuf_url,
                        platform_info->model_number,
-                       platform_info->date_of_manufacture,
+                       platform_info->date_of_manuf,
                        platform_info->platform_ver,
                        platform_info->os_ver,
                        platform_info->hardware_ver,
index 3275ded..0f3a427 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_UTILITY_H__
-#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_UTILITY_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_DBUS_TYPE_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_DBUS_TYPE_H__
 
 #include <glib.h>
 
+#include "icl-device.h"
 #include "icl-resource-types.h"
 
 const char** icl_dbus_resource_types_to_array(iotcon_resource_types_h types);
 GVariant* icl_dbus_notimsg_to_gvariant(struct icl_notify_msg *msg);
 GVariant* icl_dbus_response_to_gvariant(struct icl_resource_response *response);
 GVariant* icl_dbus_remote_resource_to_gvariant(struct icl_remote_resource *resource);
-GVariant* icl_dbus_device_info_to_gvariant(const char *device_name);
-GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_s *platform_info);
+GVariant* icl_dbus_device_info_to_gvariant(struct icl_device_info *device_info);
+GVariant* icl_dbus_platform_info_to_gvariant(struct icl_platform_info *platform_info);
 GVariant* icl_dbus_query_to_gvariant(iotcon_query_h query);
 GVariant* icl_dbus_options_to_gvariant(iotcon_options_h options);
 GVariant* icl_dbus_observers_to_gvariant(iotcon_observers_h observers);
 
-#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_UTILITY_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_DBUS_TYPE_H__ */
index e43cf7f..670b896 100644 (file)
@@ -54,16 +54,123 @@ typedef struct {
 } icl_platform_info_s;
 
 
-API int iotcon_register_device_info(const char *device_name)
+API int iotcon_device_info_create(iotcon_device_info_h *device_info)
+{
+       iotcon_device_info_h info = NULL;
+
+       RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
+
+       info = calloc(1, sizeof(struct icl_device_info));
+       if (NULL == info) {
+               ERR("calloc() Fail(%d)", errno);
+               return IOTCON_ERROR_OUT_OF_MEMORY;
+       }
+
+       *device_info = info;
+
+       return IOTCON_ERROR_NONE;
+}
+
+
+API void iotcon_device_info_destroy(iotcon_device_info_h device_info)
+{
+       RET_IF(NULL == device_info);
+
+       free(device_info->device_name);
+       free(device_info->spec_ver);
+       free(device_info->device_id);
+       free(device_info->data_model_ver);
+       free(device_info);
+}
+
+
+API int iotcon_device_info_set_property(iotcon_device_info_h device_info,
+               iotcon_device_info_e property, const char *value)
+{
+       char *dup_value;
+
+       RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
+
+       if (value) {
+               dup_value = strdup(value);
+               if (NULL == dup_value) {
+                       ERR("strdup() Fail(%d)", errno);
+                       return IOTCON_ERROR_OUT_OF_MEMORY;
+               }
+       } else {
+               dup_value = NULL;
+       }
+
+       switch (property) {
+       case IOTCON_DEVICE_INFO_NAME:
+               if (device_info->device_name)
+                       free(device_info->device_name);
+               device_info->device_name = dup_value;
+               break;
+       case IOTCON_DEVICE_INFO_SPEC_VER:
+               if (device_info->spec_ver)
+                       free(device_info->spec_ver);
+               device_info->spec_ver = dup_value;
+               break;
+       case IOTCON_DEVICE_INFO_ID:
+               if (device_info->device_id)
+                       free(device_info->device_id);
+               device_info->device_id = dup_value;
+               break;
+       case IOTCON_DEVICE_INFO_DATA_MODEL_VER:
+               if (device_info->data_model_ver)
+                       free(device_info->data_model_ver);
+               device_info->data_model_ver = dup_value;
+               break;
+       default:
+               ERR("Invalid property(%d)", property);
+               free(dup_value);
+               return IOTCON_ERROR_INVALID_PARAMETER;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
+
+
+API int iotcon_device_info_get_property(iotcon_device_info_h device_info,
+               iotcon_device_info_e property, char **value)
+{
+       RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, IOTCON_ERROR_INVALID_PARAMETER);
+
+       switch (property) {
+       case IOTCON_DEVICE_INFO_NAME:
+               *value = device_info->device_name;
+               break;
+       case IOTCON_DEVICE_INFO_SPEC_VER:
+               *value = device_info->spec_ver;
+               break;
+       case IOTCON_DEVICE_INFO_ID:
+               *value = device_info->device_id;
+               break;
+       case IOTCON_DEVICE_INFO_DATA_MODEL_VER:
+               *value = device_info->data_model_ver;
+               break;
+       default:
+               ERR("Invalid property(%d)", property);
+               return IOTCON_ERROR_INVALID_PARAMETER;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
+
+
+API int iotcon_set_device_info(iotcon_device_info_h device_info)
 {
        int ret;
        GError *error = NULL;
        GVariant *arg_info;
 
        RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
-       RETV_IF(NULL == device_name, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == device_info->device_name, IOTCON_ERROR_INVALID_PARAMETER);
 
-       arg_info = icl_dbus_device_info_to_gvariant(device_name);
+       arg_info = icl_dbus_device_info_to_gvariant(device_info);
        ic_dbus_call_register_device_info_sync(icl_dbus_get_object(), arg_info, &ret,
                        NULL, &error);
        if (error) {
@@ -91,15 +198,18 @@ static void _icl_device_info_cb(GDBusConnection *connection,
                GVariant *parameters,
                gpointer user_data)
 {
+       char *uri_path;
+       struct icl_device_info info = {0};
        icl_device_info_s *cb_container = user_data;
        iotcon_device_info_cb cb = cb_container->cb;
-       char *device_name, *sid, *spec_version, *data_model_version;
 
-       g_variant_get(parameters, "(&s&s&s&s)", &device_name, &sid, &spec_version,
-                       &data_model_version);
+       g_variant_get(parameters, "(&s&s&s&s&s)", &uri_path, &info.device_name,
+                       &info.spec_ver, &info.device_id, &info.data_model_ver);
+
+       /* From iotivity, we can get uri_path. But, the value is always "/oic/d". */
 
        if (cb)
-               cb(device_name, sid, spec_version, data_model_version, cb_container->user_data);
+               cb(&info, cb_container->user_data);
 }
 
 
@@ -158,21 +268,191 @@ API int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb c
 }
 
 
+API int iotcon_platform_info_create(iotcon_platform_info_h *platform_info)
+{
+       iotcon_platform_info_h info = NULL;
+
+       RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
+
+       info = calloc(1, sizeof(struct icl_platform_info));
+       if (NULL == info) {
+               ERR("calloc() Fail(%d)", errno);
+               return IOTCON_ERROR_OUT_OF_MEMORY;
+       }
+
+       *platform_info = info;
+
+       return IOTCON_ERROR_NONE;
+}
+
+
+API void iotcon_platform_info_destroy(iotcon_platform_info_h platform_info)
+{
+       RET_IF(NULL == platform_info);
+
+       free(platform_info->platform_id);
+       free(platform_info->manuf_name);
+       free(platform_info->manuf_url);
+       free(platform_info->model_number);
+       free(platform_info->date_of_manuf);
+       free(platform_info->platform_ver);
+       free(platform_info->os_ver);
+       free(platform_info->hardware_ver);
+       free(platform_info->firmware_ver);
+       free(platform_info->support_url);
+       free(platform_info->system_time);
+       free(platform_info);
+}
+
+
+API int iotcon_platform_info_set_property(iotcon_platform_info_h platform_info,
+               iotcon_platform_info_e property, const char *value)
+{
+       char *dup_value;
+
+       RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
+
+       if (value) {
+               dup_value = strdup(value);
+               if (NULL == dup_value) {
+                       ERR("strdup() Fail(%d)", errno);
+                       return IOTCON_ERROR_OUT_OF_MEMORY;
+               }
+       } else {
+               dup_value = NULL;
+       }
+
+       switch (property) {
+       case IOTCON_PLATFORM_INFO_ID:
+               if (platform_info->platform_id)
+                       free(platform_info->platform_id);
+               platform_info->platform_id = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_MANUF_NAME:
+               if (platform_info->manuf_name)
+                       free(platform_info->manuf_name);
+               platform_info->manuf_name = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_MANUF_URL:
+               if (platform_info->manuf_url)
+                       free(platform_info->manuf_url);
+               platform_info->manuf_url = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_MODEL_NUMBER:
+               if (platform_info->model_number)
+                       free(platform_info->model_number);
+               platform_info->model_number = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_DATE_OF_MANUF:
+               if (platform_info->date_of_manuf)
+                       free(platform_info->date_of_manuf);
+               platform_info->date_of_manuf = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_PLATFORM_VER:
+               if (platform_info->platform_ver)
+                       free(platform_info->platform_ver);
+               platform_info->platform_ver = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_OS_VER:
+               if (platform_info->os_ver)
+                       free(platform_info->os_ver);
+               platform_info->os_ver = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_HARDWARE_VER:
+               if (platform_info->hardware_ver)
+                       free(platform_info->hardware_ver);
+               platform_info->hardware_ver = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_FIRMWARE_VER:
+               if (platform_info->firmware_ver)
+                       free(platform_info->firmware_ver);
+               platform_info->firmware_ver = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_SUPPORT_URL:
+               if (platform_info->support_url)
+                       free(platform_info->support_url);
+               platform_info->support_url = dup_value;
+               break;
+       case IOTCON_PLATFORM_INFO_SYSTEM_TIME:
+               if (platform_info->system_time)
+                       free(platform_info->system_time);
+               platform_info->system_time = dup_value;
+               break;
+       default:
+               ERR("Invalid property(%d)", property);
+               free(dup_value);
+               return IOTCON_ERROR_INVALID_PARAMETER;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
+
+
+API int iotcon_platform_info_get_property(iotcon_platform_info_h platform_info,
+               iotcon_platform_info_e property, char **value)
+{
+       RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, IOTCON_ERROR_INVALID_PARAMETER);
+
+       switch (property) {
+       case IOTCON_PLATFORM_INFO_ID:
+               *value = platform_info->platform_id;
+               break;
+       case IOTCON_PLATFORM_INFO_MANUF_NAME:
+               *value = platform_info->manuf_name;
+               break;
+       case IOTCON_PLATFORM_INFO_MANUF_URL:
+               *value = platform_info->manuf_url;
+               break;
+       case IOTCON_PLATFORM_INFO_MODEL_NUMBER:
+               *value = platform_info->model_number;
+               break;
+       case IOTCON_PLATFORM_INFO_DATE_OF_MANUF:
+               *value = platform_info->date_of_manuf;
+               break;
+       case IOTCON_PLATFORM_INFO_PLATFORM_VER:
+               *value = platform_info->platform_ver;
+               break;
+       case IOTCON_PLATFORM_INFO_OS_VER:
+               *value = platform_info->os_ver;
+               break;
+       case IOTCON_PLATFORM_INFO_HARDWARE_VER:
+               *value = platform_info->hardware_ver;
+               break;
+       case IOTCON_PLATFORM_INFO_FIRMWARE_VER:
+               *value = platform_info->firmware_ver;
+               break;
+       case IOTCON_PLATFORM_INFO_SUPPORT_URL:
+               *value = platform_info->support_url;
+               break;
+       case IOTCON_PLATFORM_INFO_SYSTEM_TIME:
+               *value = platform_info->system_time;
+               break;
+       default:
+               ERR("Invalid property(%d)", property);
+               return IOTCON_ERROR_INVALID_PARAMETER;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
+
+
 /* The length of manufacturer_name should be less than and equal to 16.
  * The length of manufacturer_url should be less than and equal to 32. */
-API int iotcon_register_platform_info(iotcon_platform_info_s *platform_info)
+API int iotcon_set_platform_info(iotcon_platform_info_h platform_info)
 {
        int ret;
        GError *error = NULL;
        GVariant *arg_info;
 
        RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
+       RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
 
        if (NULL == platform_info->platform_id
                        || NULL == platform_info->manuf_name
                        || NULL == platform_info->manuf_url
                        || NULL == platform_info->model_number
-                       || NULL == platform_info->date_of_manufacture
+                       || NULL == platform_info->date_of_manuf
                        || NULL == platform_info->platform_ver
                        || NULL == platform_info->os_ver
                        || NULL == platform_info->hardware_ver
@@ -224,36 +504,28 @@ static void _icl_platform_info_cb(GDBusConnection *connection,
                gpointer user_data)
 {
        char *uri_path;
-       iotcon_platform_info_s *info;
+       struct icl_platform_info info = {0};
        icl_platform_info_s *cb_container = user_data;
        iotcon_platform_info_cb cb = cb_container->cb;
 
-       info = calloc(1, sizeof(iotcon_platform_info_s));
-       if (NULL == info) {
-               ERR("calloc(info) Fail(%d)", errno);
-               return;
-       }
-
        g_variant_get(parameters, "(&s&s&s&s&s&s&s&s&s&s&s&s)",
                        &uri_path,
-                       &info->platform_id,
-                       &info->manuf_name,
-                       &info->manuf_url,
-                       &info->model_number,
-                       &info->date_of_manufacture,
-                       &info->platform_ver,
-                       &info->os_ver,
-                       &info->hardware_ver,
-                       &info->firmware_ver,
-                       &info->support_url,
-                       &info->system_time);
+                       &info.platform_id,
+                       &info.manuf_name,
+                       &info.manuf_url,
+                       &info.model_number,
+                       &info.date_of_manuf,
+                       &info.platform_ver,
+                       &info.os_ver,
+                       &info.hardware_ver,
+                       &info.firmware_ver,
+                       &info.support_url,
+                       &info.system_time);
 
        /* From iotivity, we can get uri_path. But, the value is always "/oic/p". */
 
        if (cb)
-               cb(info, cb_container->user_data);
-
-       free(info);
+               cb(&info, cb_container->user_data);
 }
 
 
@@ -310,4 +582,3 @@ API int iotcon_get_platform_info(const char *host_address, iotcon_platform_info_
 
        return ret;
 }
-
diff --git a/lib/icl-device.h b/lib/icl-device.h
new file mode 100644 (file)
index 0000000..968aabf
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_DEVICE_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_DEVICE_H__
+
+struct icl_device_info {
+       char *device_name;
+       char *spec_ver;
+       char *device_id;
+       char *data_model_ver;
+};
+
+struct icl_platform_info {
+       char *platform_id;
+       char *manuf_name;
+       char *manuf_url;
+       char *model_number;
+       char *date_of_manuf;
+       char *platform_ver;
+       char *os_ver;
+       char *hardware_ver;
+       char *firmware_ver;
+       char *support_url;
+       char *system_time;
+};
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_DEVICE_H__ */
index 173e57d..336f075 100644 (file)
@@ -173,6 +173,37 @@ typedef enum {
 } iotcon_types_e;
 
 /**
+ * @brief Enumeration for properties of device information.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       IOTCON_DEVICE_INFO_NAME = 0, /**< Indicates human friendly name for device */
+       IOTCON_DEVICE_INFO_SPEC_VER, /**< Indicates spec version of the core specification */
+       IOTCON_DEVICE_INFO_ID, /**< Indicates unique identifier for OIC device */
+       IOTCON_DEVICE_INFO_DATA_MODEL_VER, /**< Indicates version of the specs this device data model is implemented to */
+} iotcon_device_info_e;
+
+/**
+ * @brief Enumeration for properties of platform information.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       IOTCON_PLATFORM_INFO_ID = 0, /**< Indicates platform identifier */
+       IOTCON_PLATFORM_INFO_MANUF_NAME, /**< Indicates name of manufacturer */
+       IOTCON_PLATFORM_INFO_MANUF_URL, /**< Indicates URL to manufacturer */
+       IOTCON_PLATFORM_INFO_MODEL_NUMBER, /**< Indicates model number as designated by manufacturer */
+       IOTCON_PLATFORM_INFO_DATE_OF_MANUF, /**< Indicates manufacturing date of device */
+       IOTCON_PLATFORM_INFO_PLATFORM_VER, /**< Indicates version of platform defined by manufacturer */
+       IOTCON_PLATFORM_INFO_OS_VER, /**< Indicates version of platform resident OS */
+       IOTCON_PLATFORM_INFO_HARDWARE_VER, /**< Indicates version of platform hardware */
+       IOTCON_PLATFORM_INFO_FIRMWARE_VER, /**< Indicates version of device firmware */
+       IOTCON_PLATFORM_INFO_SUPPORT_URL, /**< Indicates URL that points to support information from manufacturer */
+       IOTCON_PLATFORM_INFO_SYSTEM_TIME, /**< Indicates reference time for the device */
+} iotcon_platform_info_e;
+
+/**
  * @}
  */
 
index 0b4050a..67a7985 100644 (file)
@@ -74,7 +74,7 @@ typedef struct icl_state_s* iotcon_state_h;
 typedef struct icl_notify_msg* iotcon_notimsg_h;
 
 /**
- * @brief The handle of presence handle
+ * @brief The handle of presence.
  * @details iotcon_presence_h is a handle of presence subscription.\n
  * It is used to cancel presence.
  *
@@ -83,32 +83,20 @@ typedef struct icl_notify_msg* iotcon_notimsg_h;
 typedef struct icl_presence* iotcon_presence_h;
 
 /**
- * @brief The structure of device information
+ * @brief The handle of device information.
+ * @details iotcon_device_info_h is a handle of device information.\n
  *
  * @since_tizen 3.0
  */
-typedef struct _device_info {
-       char *device_name; /**< Name of the device */
-} iotcon_device_info_s;
+typedef struct icl_device_info* iotcon_device_info_h;
 
 /**
- * @brief The structure of platform information
+ * @brief The handle of platform information.
+ * @details iotcon_platform_info_h is a handle of platform information.\n
  *
  * @since_tizen 3.0
  */
-typedef struct _platform_info {
-       char *platform_id; /**< ID of the platform */
-       char *manuf_name; /**< Manufacurer name of the platform */
-       char *manuf_url; /**< Manufacurer url of the platform */
-       char *model_number; /**< Model number of the platform */
-       char *date_of_manufacture; /**< Date of manufacture of the platform */
-       char *platform_ver; /**< Platform version of the platform */
-       char *os_ver; /**< OS version of the platform */
-       char *hardware_ver; /**< Hardware version of the platform */
-       char *firmware_ver; /**< Firmware version of the platform */
-       char *support_url; /**< Support url of the platform */
-       char *system_time; /**< System time of the platform */
-} iotcon_platform_info_s;
+typedef struct icl_platform_info* iotcon_platform_info_h;
 
 /**
  * @brief The handle of options
@@ -1240,6 +1228,85 @@ int iotcon_response_set_header_options(iotcon_response_h resp, iotcon_options_h
 int iotcon_response_set_interface(iotcon_response_h resp, int iface);
 
 /**
+ * @brief Sets device properties into the device information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_info The handle of the device information
+ * @param[in] property The properties of the device information
+ * @param[in] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_device_info_create()
+ * @see iotcon_device_info_destroy()
+ * @see iotcon_set_device_info()
+ */
+int iotcon_device_info_set_property(iotcon_device_info_h device_info,
+               iotcon_device_info_e property, const char *value);
+
+/**
+ * @brief Get device properties from the device information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_info The handle of the device information
+ * @param[in] property The properties of the device information
+ * @param[in] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_device_info_cb()
+ * @see iotcon_get_device_info()
+ */
+int iotcon_device_info_get_property(iotcon_device_info_h device_info,
+               iotcon_device_info_e property, char **value);
+
+/**
+ * @brief Sets platform properties into the platform information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] platform_info The handle of the platform information
+ * @param[in] property The properties of the platform information
+ * @param[out] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_platform_info_create()
+ * @see iotcon_platform_info_destroy()
+ * @see iotcon_set_platform_info()
+ */
+int iotcon_platform_info_set_property(iotcon_platform_info_h platform_info,
+               iotcon_platform_info_e property, const char *value);
+
+/**
+ * @brief Get platform properties from the platform information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] platform_info The handle of the platform information
+ * @param[in] property The properties of the platform information
+ * @param[out] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_platform_info_cb()
+ * @see iotcon_get_platform_info()
+ */
+int iotcon_platform_info_get_property(iotcon_platform_info_h platform_info,
+               iotcon_platform_info_e property, char **value);
+/**
  * @}
  */
 
index 673b55d..e305fc2 100644 (file)
@@ -373,34 +373,71 @@ int iotcon_resource_unbind_child_resource(iotcon_resource_h parent,
                iotcon_resource_h child);
 
 /**
- * @brief Register device information in a server.
+ * @brief Creates a new device information handle.
  *
  * @since_tizen 3.0
  *
- * @param[in] device_name The device information to register
+ * @param[out] device_info The handle of the device information
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_device_info_destroy()
+ * @see iotcon_set_device_info()
+ * @see iotcon_device_info_set_property()
+ */
+int iotcon_device_info_create(iotcon_device_info_h *device_info);
+
+/**
+ * @brief Releases a device information handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_info The handle of the device information
+ *
+ * @return void
+ *
+ * @see iotcon_device_info_create()
+ * @see iotcon_set_device_info()
+ * @see iotcon_device_info_set_property()
+ */
+void iotcon_device_info_destroy(iotcon_device_info_h device_info);
+
+/**
+ * @brief Set the device information in a server.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_info The device information to set
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #IOTCON_ERROR_NONE  Successful
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_DBUS  Dbus error
  * @retval #IOTCON_ERROR_SYSTEM System error
+ *
+ * @see iotcon_device_info_create()
+ * @see iotcon_device_info_destroy()
+ * @see iotcon_device_info_set_property()
  */
-int iotcon_register_device_info(const char *device_name);
+int iotcon_set_device_info(iotcon_device_info_h device_info);
 
 /**
  * @brief Specifies the type of function passed to iotcon_get_device_info().
  *
  * @since_tizen 3.0
  *
- * @param[in] info The information of device from remote server.
+ * @param[in] device_info the device information from remote server.
  * @param[in] user_data The user data to pass to the function
  *
  * @pre iotcon_get_device_info() will invoke this callback function.
  *
  * @see iotcon_get_device_info()
+ * @see iotcon_device_info_get_property()
  */
-typedef void (*iotcon_device_info_cb)(const char *device_name, const char *sid,
-               const char *spec_version, const char *data_model_version, void *user_data);
+typedef void (*iotcon_device_info_cb)(iotcon_device_info_h device_info, void *user_data);
 
 /**
  * @brief Calls a function for device information of remote server.
@@ -426,37 +463,78 @@ typedef void (*iotcon_device_info_cb)(const char *device_name, const char *sid,
  * @post iotcon_device_info_cb() will be called when success on getting device information.
  *
  * @see iotcon_device_info_cb()
+ * @see iotcon_device_info_get_property()
  */
 int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb cb,
                void *user_data);
 
 /**
- * @brief Register platform information in a server.
+ * @brief Creates a new platform information handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] platform_info The handle of the platform information
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_platform_info_destroy()
+ * @see iotcon_set_platform_info()
+ * @see iotcon_platform_info_set_property()
+ */
+int iotcon_platform_info_create(iotcon_platform_info_h *platform_info);
+
+/**
+ * @brief Releases a platform information handle.
  *
  * @since_tizen 3.0
  *
- * @param[in] platform_info The platform information to register
+ * @param[in] platform_info The handle of the platform information
+ *
+ * @return void
+ *
+ * @see iotcon_platform_info_create()
+ * @see iotcon_set_platform_info()
+ * @see iotcon_platform_info_set_property()
+ */
+void iotcon_platform_info_destroy(iotcon_platform_info_h platform_info);
+
+/**
+ * @brief Set platform information in a server.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] platform_info The platform information to set
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #IOTCON_ERROR_NONE Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_DBUS  Dbus error
  * @retval #IOTCON_ERROR_SYSTEM System error
+ *
+ * @see iotcon_platform_info_create()
+ * @see iotcon_platform_info_destroy()
+ * @see iotcon_platform_info_set_property()
  */
-int iotcon_register_platform_info(iotcon_platform_info_s *platform_info);
+int iotcon_set_platform_info(iotcon_platform_info_h platform_info);
 
 /**
  * @brief Specifies the type of function passed to iotcon_get_platform_info().
  *
  * @since_tizen 3.0
  *
- * @param[in] info The information of platform from remote server.
+ * @param[in] platform_info The platform information from remote server.
  * @param[in] user_data The user data to pass to the function
  *
  * @pre iotcon_get_platform_info() will invoke this callback function.
  *
  * @see iotcon_get_platform_info()
+ * @see iotcon_platform_info_get_property()
  */
-typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_s *info, void *user_data);
+typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_h platform_info,
+               void *user_data);
 
 /**
  * @brief Calls a function for platform information of remote server.
@@ -484,6 +562,7 @@ typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_s *info, void *user
  * @post iotcon_platform_info_cb() will be called when success on getting device information.
  *
  * @see iotcon_platform_info_cb()
+ * @see iotcon_platform_info_get_property()
  */
 int iotcon_get_platform_info(const char *host_address, iotcon_platform_info_cb cb,
                void *user_data);
index b27216c..2a358ca 100644 (file)
 #include <iotcon.h>
 #include "test.h"
 
-static void _get_platform_info(iotcon_platform_info_s *info, void *user_data)
+static void _get_device_info(iotcon_device_info_h info, void *user_data)
 {
-       INFO("platform_id : %s", info->platform_id);
-       INFO("manuf_name : %s", info->manuf_name);
-       INFO("manuf_url : %s", info->manuf_url);
-       INFO("model_number : %s", info->model_number);
-       INFO("date_of_manufacture : %s", info->date_of_manufacture);
-       INFO("platform_ver : %s", info->platform_ver);
-       INFO("os_ver : %s", info->os_ver);
-       INFO("hardware_ver : %s", info->hardware_ver);
-       INFO("firmware_ver : %s", info->firmware_ver);
-       INFO("support_url : %s", info->support_url);
-       INFO("system_time : %s", info->system_time);
-}
+       int ret;
+       char *device_name = NULL;
+       char *spec_ver = NULL;
+       char *device_id = NULL;
+       char *data_model_ver = NULL;
+
+       ret = iotcon_device_info_get_property(info, IOTCON_DEVICE_INFO_NAME, &device_name);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_device_info_get_property() Fail(%d)", ret);
+               return;
+       }
 
+       ret = iotcon_device_info_get_property(info, IOTCON_DEVICE_INFO_SPEC_VER, &spec_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_device_info_get_property() Fail(%d)", ret);
+               return;
+       }
 
-static void _get_device_info(const char *device_name, const char *sid,
-               const char *spec_version, const char *data_model_version, void *user_data)
-{
+       ret = iotcon_device_info_get_property(info, IOTCON_DEVICE_INFO_ID, &device_id);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_device_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_device_info_get_property(info, IOTCON_DEVICE_INFO_DATA_MODEL_VER,
+                       &data_model_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_device_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       INFO("Get Device Info");
        INFO("device_name : %s", device_name);
-       INFO("sid : %s", sid);
-       INFO("spec_version : %s", spec_version);
-       INFO("data_model_version : %s", data_model_version);
+       INFO("spec_version : %s", spec_ver);
+       INFO("device_id : %s", device_id);
+       INFO("data_model_version : %s", data_model_ver);
 }
 
+static void _get_platform_info(iotcon_platform_info_h info, void *user_data)
+{
+       int ret;
+       char *platform_id = NULL;
+       char *manuf_name = NULL;
+       char *manuf_url = NULL;
+       char *model_number = NULL;
+       char *date_of_manuf = NULL;
+       char *platform_ver = NULL;
+       char *os_ver = NULL;
+       char *hardware_ver = NULL;
+       char *firmware_ver = NULL;
+       char *support_url = NULL;
+       char *system_time = NULL;
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_ID, &platform_id);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_MANUF_NAME,
+                       &manuf_name);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_MANUF_URL,
+                       &manuf_url);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_MODEL_NUMBER,
+                       &model_number);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_DATE_OF_MANUF,
+                       &date_of_manuf);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_PLATFORM_VER,
+                       &platform_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_OS_VER, &os_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_HARDWARE_VER,
+                       &hardware_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_FIRMWARE_VER,
+                       &firmware_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_SUPPORT_URL,
+                       &support_url);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       ret = iotcon_platform_info_get_property(info, IOTCON_PLATFORM_INFO_SYSTEM_TIME,
+                       &system_time);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_get_property() Fail(%d)", ret);
+               return;
+       }
+
+       INFO("Get Platform Info");
+       INFO("platform_id : %s", platform_id);
+       INFO("manuf_name : %s", manuf_name);
+       INFO("manuf_url : %s", manuf_url);
+       INFO("model_number : %s", model_number);
+       INFO("date_of_manufacture : %s", date_of_manuf);
+       INFO("platform_ver : %s", platform_ver);
+       INFO("os_ver : %s", os_ver);
+       INFO("hardware_ver : %s", hardware_ver);
+       INFO("firmware_ver : %s", firmware_ver);
+       INFO("support_url : %s", support_url);
+       INFO("system_time : %s", system_time);
+}
 
 int main()
 {
@@ -58,16 +176,16 @@ int main()
                return -1;
        }
 
-       ret = iotcon_get_platform_info(IOTCON_MULTICAST_ADDRESS, _get_platform_info, NULL);
+       ret = iotcon_get_device_info(IOTCON_MULTICAST_ADDRESS, _get_device_info, NULL);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_get_platform_info() Fail(%d)", ret);
+               ERR("iotcon_get_device_info() Fail(%d)", ret);
                iotcon_close();
                return -1;
        }
 
-       ret = iotcon_get_device_info(IOTCON_MULTICAST_ADDRESS, _get_device_info, NULL);
+       ret = iotcon_get_platform_info(IOTCON_MULTICAST_ADDRESS, _get_platform_info, NULL);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_get_device_info() Fail(%d)", ret);
+               ERR("iotcon_get_platform_info() Fail(%d)", ret);
                iotcon_close();
                return -1;
        }
index 3ff9c73..b24aa2b 100644 (file)
 #include <iotcon.h>
 #include "test.h"
 
-int main()
+static int _set_device_info()
 {
-       FN_CALL;
        int ret;
-       GMainLoop *loop;
-       char *device_name;
+       char *device_name = "device name";
+       iotcon_device_info_h device_info;
+
+       ret = iotcon_device_info_create(&device_info);
+       if (NULL == device_info) {
+               ERR("iotcon_device_info_create() Fail(%d)", ret);
+               return -1;
+       }
 
-       iotcon_platform_info_s *platform_info = calloc(1, sizeof(iotcon_platform_info_s));
-       if (NULL == platform_info) {
-               ERR("calloc(platform_info) Fail(%d)", errno);
+       ret = iotcon_device_info_set_property(device_info, IOTCON_DEVICE_INFO_NAME,
+                       device_name);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_device_info_set_property() Fail(%d)", ret);
+               iotcon_device_info_destroy(device_info);
                return -1;
        }
 
-       platform_info->platform_id = "platform_id";
-       platform_info->manuf_name = "manuf_name";
-       platform_info->manuf_url = "manuf_url";
-       platform_info->model_number = "model_number";
-       platform_info->date_of_manufacture = "date_of_manufacture";
-       platform_info->platform_ver = "platform_ver";
-       platform_info->os_ver = "os_ver";
-       platform_info->hardware_ver = "hardware_ver";
-       platform_info->firmware_ver = "firmware_ver";
-       platform_info->support_url = "support_url";
-       platform_info->system_time = "system_time";
+       ret = iotcon_set_device_info(device_info);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_set_device_info() Fail(%d)", ret);
+               iotcon_device_info_destroy(device_info);
+               return -1;
+       }
 
-       device_name = "device_name";
+       iotcon_device_info_destroy(device_info);
+
+       return 0;
+}
+
+static int _set_platform_info()
+{
+       int ret;
+       char *platform_id = "platform_id";
+       char *manuf_name = "manuf_name";
+       char *manuf_url = "manuf_url";
+       char *model_number = "model_number";
+       char *date_of_manuf = "date_of_manuf";
+       char *platform_ver = "platform_ver";
+       char *os_ver = "os_ver";
+       char *hardware_ver = "hardware_ver";
+       char *firmware_ver = "firmware_ver";
+       char *support_url = "support_url";
+       char *system_time = "system_time";
+       iotcon_platform_info_h platform_info;
+
+       ret = iotcon_platform_info_create(&platform_info);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_create() Fail(%d)", ret);
+               return -1;
+       }
+
+       ret = iotcon_platform_info_set_property(platform_info, IOTCON_PLATFORM_INFO_ID,
+                       platform_id);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_MANUF_NAME, manuf_name);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info, IOTCON_PLATFORM_INFO_MANUF_URL,
+                       manuf_url);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_MODEL_NUMBER, model_number);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_DATE_OF_MANUF, date_of_manuf);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_PLATFORM_VER, platform_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info, IOTCON_PLATFORM_INFO_OS_VER,
+                       os_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_HARDWARE_VER, hardware_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_FIRMWARE_VER, firmware_ver);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_SUPPORT_URL, support_url);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+       ret = iotcon_platform_info_set_property(platform_info,
+                       IOTCON_PLATFORM_INFO_SYSTEM_TIME, system_time);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_platform_info_set_property() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+
+       ret = iotcon_set_platform_info(platform_info);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_set_platform_info() Fail(%d)", ret);
+               iotcon_platform_info_destroy(platform_info);
+               return -1;
+       }
+
+       return 0;
+}
+
+int main()
+{
+       FN_CALL;
+       int ret;
+       GMainLoop *loop;
 
        loop = g_main_loop_new(NULL, FALSE);
 
@@ -53,23 +174,18 @@ int main()
        ret = iotcon_open();
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_open() Fail(%d)", ret);
-               free(platform_info);
                return -1;
        }
 
-       ret = iotcon_register_platform_info(platform_info);
-       if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_register_platform_info() Fail(%d)", ret);
+       ret = _set_device_info();
+       if (0 != ret) {
+               ERR("_set_device_info() Fail");
                iotcon_close();
-               free(platform_info);
                return -1;
        }
-
-       free(platform_info);
-
-       ret = iotcon_register_device_info(device_name);
-       if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_register_platform_info() Fail(%d)", ret);
+       ret = _set_platform_info();
+       if (0 != ret) {
+               ERR("_set_platform_info() Fail");
                iotcon_close();
                return -1;
        }
@@ -84,6 +200,3 @@ int main()
        return 0;
 }
 
-
-
-