Add Tizen Info Handling API
[platform/core/iot/iotcon.git] / lib / icl-device.c
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <errno.h>
20 #include <glib.h>
21
22 #include "iotcon.h"
23 #include "ic-utils.h"
24 #include "icl.h"
25 #include "icl-repr.h"
26 #include "icl-dbus.h"
27 #include "icl-dbus-type.h"
28 #include "icl-device.h"
29
30 /**
31  * @brief The maximum length which can be held in a manufacturer name.
32  *
33  * @since_tizen 3.0
34  */
35 #define ICL_MANUFACTURER_NAME_LENGTH_MAX 15
36
37 /**
38  * @brief The maximum length which can be held in a manufacturer url.
39  *
40  * @since_tizen 3.0
41  */
42 #define ICL_MANUFACTURER_URL_LENGTH_MAX 32
43
44
45 typedef struct {
46         iotcon_device_info_cb cb;
47         void *user_data;
48         unsigned int id;
49 } icl_device_info_s;
50
51 typedef struct {
52         iotcon_platform_info_cb cb;
53         void *user_data;
54         unsigned int id;
55 } icl_platform_info_s;
56
57 typedef struct {
58         iotcon_tizen_info_cb cb;
59         void *user_data;
60 } icl_tizen_info_s;
61
62
63 API int iotcon_device_info_create(iotcon_device_info_h *device_info)
64 {
65         iotcon_device_info_h info = NULL;
66
67         RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
68
69         info = calloc(1, sizeof(struct icl_device_info));
70         if (NULL == info) {
71                 ERR("calloc() Fail(%d)", errno);
72                 return IOTCON_ERROR_OUT_OF_MEMORY;
73         }
74
75         *device_info = info;
76
77         return IOTCON_ERROR_NONE;
78 }
79
80
81 API void iotcon_device_info_destroy(iotcon_device_info_h device_info)
82 {
83         RET_IF(NULL == device_info);
84
85         free(device_info->device_name);
86         free(device_info->spec_ver);
87         free(device_info->device_id);
88         free(device_info->data_model_ver);
89         free(device_info);
90 }
91
92
93 API int iotcon_device_info_set_property(iotcon_device_info_h device_info,
94                 iotcon_device_info_e property, const char *value)
95 {
96         char *dup_value;
97
98         RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
99
100         if (value) {
101                 dup_value = strdup(value);
102                 if (NULL == dup_value) {
103                         ERR("strdup() Fail(%d)", errno);
104                         return IOTCON_ERROR_OUT_OF_MEMORY;
105                 }
106         } else {
107                 dup_value = NULL;
108         }
109
110         switch (property) {
111         case IOTCON_DEVICE_INFO_NAME:
112                 if (device_info->device_name)
113                         free(device_info->device_name);
114                 device_info->device_name = dup_value;
115                 break;
116         case IOTCON_DEVICE_INFO_SPEC_VER:
117                 if (device_info->spec_ver)
118                         free(device_info->spec_ver);
119                 device_info->spec_ver = dup_value;
120                 break;
121         case IOTCON_DEVICE_INFO_ID:
122                 if (device_info->device_id)
123                         free(device_info->device_id);
124                 device_info->device_id = dup_value;
125                 break;
126         case IOTCON_DEVICE_INFO_DATA_MODEL_VER:
127                 if (device_info->data_model_ver)
128                         free(device_info->data_model_ver);
129                 device_info->data_model_ver = dup_value;
130                 break;
131         default:
132                 ERR("Invalid property(%d)", property);
133                 free(dup_value);
134                 return IOTCON_ERROR_INVALID_PARAMETER;
135         }
136
137         return IOTCON_ERROR_NONE;
138 }
139
140
141 API int iotcon_device_info_get_property(iotcon_device_info_h device_info,
142                 iotcon_device_info_e property, char **value)
143 {
144         RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
145         RETV_IF(NULL == value, IOTCON_ERROR_INVALID_PARAMETER);
146
147         switch (property) {
148         case IOTCON_DEVICE_INFO_NAME:
149                 *value = device_info->device_name;
150                 break;
151         case IOTCON_DEVICE_INFO_SPEC_VER:
152                 *value = device_info->spec_ver;
153                 break;
154         case IOTCON_DEVICE_INFO_ID:
155                 *value = device_info->device_id;
156                 break;
157         case IOTCON_DEVICE_INFO_DATA_MODEL_VER:
158                 *value = device_info->data_model_ver;
159                 break;
160         default:
161                 ERR("Invalid property(%d)", property);
162                 return IOTCON_ERROR_INVALID_PARAMETER;
163         }
164
165         return IOTCON_ERROR_NONE;
166 }
167
168
169 API int iotcon_set_device_info(iotcon_device_info_h device_info)
170 {
171         int ret;
172         GError *error = NULL;
173         GVariant *arg_info;
174
175         RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
176         RETV_IF(NULL == device_info, IOTCON_ERROR_INVALID_PARAMETER);
177         RETV_IF(NULL == device_info->device_name, IOTCON_ERROR_INVALID_PARAMETER);
178
179         arg_info = icl_dbus_device_info_to_gvariant(device_info);
180         ic_dbus_call_register_device_info_sync(icl_dbus_get_object(), arg_info, &ret,
181                         NULL, &error);
182         if (error) {
183                 ERR("ic_dbus_call_register_device_info_sync() Fail(%s)", error->message);
184                 ret = icl_dbus_convert_dbus_error(error->code);
185                 g_error_free(error);
186                 g_variant_unref(arg_info);
187                 return ret;
188         }
189
190         if (IOTCON_ERROR_NONE != ret) {
191                 ERR("iotcon-daemon Fail(%d)", ret);
192                 return icl_dbus_convert_daemon_error(ret);
193         }
194
195         return ret;
196 }
197
198
199 static void _icl_device_info_cb(GDBusConnection *connection,
200                 const gchar *sender_name,
201                 const gchar *object_path,
202                 const gchar *interface_name,
203                 const gchar *signal_name,
204                 GVariant *parameters,
205                 gpointer user_data)
206 {
207         char *uri_path;
208         struct icl_device_info info = {0};
209         icl_device_info_s *cb_container = user_data;
210         iotcon_device_info_cb cb = cb_container->cb;
211
212         g_variant_get(parameters, "(&s&s&s&s&s)", &uri_path, &info.device_name,
213                         &info.spec_ver, &info.device_id, &info.data_model_ver);
214
215         /* From iotivity, we can get uri_path. But, the value is always "/oic/d". */
216
217         if (cb)
218                 cb(&info, cb_container->user_data);
219 }
220
221
222 API int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb cb,
223                 void *user_data)
224 {
225         GError *error = NULL;
226         unsigned int sub_id;
227         int ret, signal_number;
228         char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0};
229         icl_device_info_s *cb_container;
230
231         RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
232         RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
233         RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
234
235         signal_number = icl_dbus_generate_signal_number();
236
237         ic_dbus_call_get_device_info_sync(icl_dbus_get_object(), host_address,
238                         signal_number, &ret, NULL, &error);
239         if (error) {
240                 ERR("ic_dbus_call_get_device_info_sync() Fail(%s)", error->message);
241                 ret = icl_dbus_convert_dbus_error(error->code);
242                 g_error_free(error);
243                 return ret;
244         }
245
246         if (IOTCON_ERROR_NONE != ret) {
247                 ERR("iotcon-daemon Fail(%d)", ret);
248                 return icl_dbus_convert_daemon_error(ret);
249         }
250
251         snprintf(signal_name, sizeof(signal_name), "%s_%u", IC_DBUS_SIGNAL_DEVICE,
252                         signal_number);
253
254         cb_container = calloc(1, sizeof(icl_device_info_s));
255         if (NULL == cb_container) {
256                 ERR("calloc() Fail(%d)", errno);
257                 return IOTCON_ERROR_OUT_OF_MEMORY;
258         }
259
260         cb_container->cb = cb;
261         cb_container->user_data = user_data;
262
263         sub_id = icl_dbus_subscribe_signal(signal_name, cb_container, free,
264                         _icl_device_info_cb);
265         if (0 == sub_id) {
266                 ERR("icl_dbus_subscribe_signal() Fail");
267                 free(cb_container);
268                 return IOTCON_ERROR_DBUS;
269         }
270
271         cb_container->id = sub_id;
272
273         return ret;
274 }
275
276
277 API int iotcon_platform_info_create(iotcon_platform_info_h *platform_info)
278 {
279         iotcon_platform_info_h info = NULL;
280
281         RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
282
283         info = calloc(1, sizeof(struct icl_platform_info));
284         if (NULL == info) {
285                 ERR("calloc() Fail(%d)", errno);
286                 return IOTCON_ERROR_OUT_OF_MEMORY;
287         }
288
289         *platform_info = info;
290
291         return IOTCON_ERROR_NONE;
292 }
293
294
295 API void iotcon_platform_info_destroy(iotcon_platform_info_h platform_info)
296 {
297         RET_IF(NULL == platform_info);
298
299         free(platform_info->platform_id);
300         free(platform_info->manuf_name);
301         free(platform_info->manuf_url);
302         free(platform_info->model_number);
303         free(platform_info->date_of_manuf);
304         free(platform_info->platform_ver);
305         free(platform_info->os_ver);
306         free(platform_info->hardware_ver);
307         free(platform_info->firmware_ver);
308         free(platform_info->support_url);
309         free(platform_info->system_time);
310         free(platform_info);
311 }
312
313
314 API int iotcon_platform_info_set_property(iotcon_platform_info_h platform_info,
315                 iotcon_platform_info_e property, const char *value)
316 {
317         char *dup_value;
318
319         RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
320
321         if (value) {
322                 dup_value = strdup(value);
323                 if (NULL == dup_value) {
324                         ERR("strdup() Fail(%d)", errno);
325                         return IOTCON_ERROR_OUT_OF_MEMORY;
326                 }
327         } else {
328                 dup_value = NULL;
329         }
330
331         switch (property) {
332         case IOTCON_PLATFORM_INFO_ID:
333                 if (platform_info->platform_id)
334                         free(platform_info->platform_id);
335                 platform_info->platform_id = dup_value;
336                 break;
337         case IOTCON_PLATFORM_INFO_MANUF_NAME:
338                 if (platform_info->manuf_name)
339                         free(platform_info->manuf_name);
340                 platform_info->manuf_name = dup_value;
341                 break;
342         case IOTCON_PLATFORM_INFO_MANUF_URL:
343                 if (platform_info->manuf_url)
344                         free(platform_info->manuf_url);
345                 platform_info->manuf_url = dup_value;
346                 break;
347         case IOTCON_PLATFORM_INFO_MODEL_NUMBER:
348                 if (platform_info->model_number)
349                         free(platform_info->model_number);
350                 platform_info->model_number = dup_value;
351                 break;
352         case IOTCON_PLATFORM_INFO_DATE_OF_MANUF:
353                 if (platform_info->date_of_manuf)
354                         free(platform_info->date_of_manuf);
355                 platform_info->date_of_manuf = dup_value;
356                 break;
357         case IOTCON_PLATFORM_INFO_PLATFORM_VER:
358                 if (platform_info->platform_ver)
359                         free(platform_info->platform_ver);
360                 platform_info->platform_ver = dup_value;
361                 break;
362         case IOTCON_PLATFORM_INFO_OS_VER:
363                 if (platform_info->os_ver)
364                         free(platform_info->os_ver);
365                 platform_info->os_ver = dup_value;
366                 break;
367         case IOTCON_PLATFORM_INFO_HARDWARE_VER:
368                 if (platform_info->hardware_ver)
369                         free(platform_info->hardware_ver);
370                 platform_info->hardware_ver = dup_value;
371                 break;
372         case IOTCON_PLATFORM_INFO_FIRMWARE_VER:
373                 if (platform_info->firmware_ver)
374                         free(platform_info->firmware_ver);
375                 platform_info->firmware_ver = dup_value;
376                 break;
377         case IOTCON_PLATFORM_INFO_SUPPORT_URL:
378                 if (platform_info->support_url)
379                         free(platform_info->support_url);
380                 platform_info->support_url = dup_value;
381                 break;
382         case IOTCON_PLATFORM_INFO_SYSTEM_TIME:
383                 if (platform_info->system_time)
384                         free(platform_info->system_time);
385                 platform_info->system_time = dup_value;
386                 break;
387         default:
388                 ERR("Invalid property(%d)", property);
389                 free(dup_value);
390                 return IOTCON_ERROR_INVALID_PARAMETER;
391         }
392
393         return IOTCON_ERROR_NONE;
394 }
395
396
397 API int iotcon_platform_info_get_property(iotcon_platform_info_h platform_info,
398                 iotcon_platform_info_e property, char **value)
399 {
400         RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
401         RETV_IF(NULL == value, IOTCON_ERROR_INVALID_PARAMETER);
402
403         switch (property) {
404         case IOTCON_PLATFORM_INFO_ID:
405                 *value = platform_info->platform_id;
406                 break;
407         case IOTCON_PLATFORM_INFO_MANUF_NAME:
408                 *value = platform_info->manuf_name;
409                 break;
410         case IOTCON_PLATFORM_INFO_MANUF_URL:
411                 *value = platform_info->manuf_url;
412                 break;
413         case IOTCON_PLATFORM_INFO_MODEL_NUMBER:
414                 *value = platform_info->model_number;
415                 break;
416         case IOTCON_PLATFORM_INFO_DATE_OF_MANUF:
417                 *value = platform_info->date_of_manuf;
418                 break;
419         case IOTCON_PLATFORM_INFO_PLATFORM_VER:
420                 *value = platform_info->platform_ver;
421                 break;
422         case IOTCON_PLATFORM_INFO_OS_VER:
423                 *value = platform_info->os_ver;
424                 break;
425         case IOTCON_PLATFORM_INFO_HARDWARE_VER:
426                 *value = platform_info->hardware_ver;
427                 break;
428         case IOTCON_PLATFORM_INFO_FIRMWARE_VER:
429                 *value = platform_info->firmware_ver;
430                 break;
431         case IOTCON_PLATFORM_INFO_SUPPORT_URL:
432                 *value = platform_info->support_url;
433                 break;
434         case IOTCON_PLATFORM_INFO_SYSTEM_TIME:
435                 *value = platform_info->system_time;
436                 break;
437         default:
438                 ERR("Invalid property(%d)", property);
439                 return IOTCON_ERROR_INVALID_PARAMETER;
440         }
441
442         return IOTCON_ERROR_NONE;
443 }
444
445
446 /* The length of manufacturer_name should be less than and equal to 16.
447  * The length of manufacturer_url should be less than and equal to 32. */
448 API int iotcon_set_platform_info(iotcon_platform_info_h platform_info)
449 {
450         int ret;
451         GError *error = NULL;
452         GVariant *arg_info;
453
454         RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
455         RETV_IF(NULL == platform_info, IOTCON_ERROR_INVALID_PARAMETER);
456
457         if (NULL == platform_info->platform_id
458                         || NULL == platform_info->manuf_name
459                         || NULL == platform_info->manuf_url
460                         || NULL == platform_info->model_number
461                         || NULL == platform_info->date_of_manuf
462                         || NULL == platform_info->platform_ver
463                         || NULL == platform_info->os_ver
464                         || NULL == platform_info->hardware_ver
465                         || NULL == platform_info->firmware_ver
466                         || NULL == platform_info->support_url
467                         || NULL == platform_info->system_time) {
468                 ERR("one of parameter is NULL");
469                 return IOTCON_ERROR_INVALID_PARAMETER;
470         }
471
472         if (platform_info->manuf_name
473                         && (ICL_MANUFACTURER_NAME_LENGTH_MAX < strlen(platform_info->manuf_name))) {
474                 ERR("The length of manufacturer_name(%s) is invalid.", platform_info->manuf_name);
475                 return IOTCON_ERROR_INVALID_PARAMETER;
476         }
477
478         if (platform_info->manuf_url
479                         && (ICL_MANUFACTURER_URL_LENGTH_MAX < strlen(platform_info->manuf_url))) {
480                 ERR("The length of manufacturer_url(%s) is invalid.", platform_info->manuf_url);
481                 return IOTCON_ERROR_INVALID_PARAMETER;
482         }
483
484         arg_info = icl_dbus_platform_info_to_gvariant(platform_info);
485         ic_dbus_call_register_platform_info_sync(icl_dbus_get_object(), arg_info, &ret,
486                         NULL, &error);
487         if (error) {
488                 ERR("ic_dbus_call_register_platform_info_sync() Fail(%s)", error->message);
489                 ret = icl_dbus_convert_dbus_error(error->code);
490                 g_error_free(error);
491                 g_variant_unref(arg_info);
492                 return ret;
493         }
494
495         if (IOTCON_ERROR_NONE != ret) {
496                 ERR("iotcon-daemon Fail(%d)", ret);
497                 return icl_dbus_convert_daemon_error(ret);
498         }
499
500         return ret;
501 }
502
503
504 static void _icl_platform_info_cb(GDBusConnection *connection,
505                 const gchar *sender_name,
506                 const gchar *object_path,
507                 const gchar *interface_name,
508                 const gchar *signal_name,
509                 GVariant *parameters,
510                 gpointer user_data)
511 {
512         char *uri_path;
513         struct icl_platform_info info = {0};
514         icl_platform_info_s *cb_container = user_data;
515         iotcon_platform_info_cb cb = cb_container->cb;
516
517         g_variant_get(parameters, "(&s&s&s&s&s&s&s&s&s&s&s&s)",
518                         &uri_path,
519                         &info.platform_id,
520                         &info.manuf_name,
521                         &info.manuf_url,
522                         &info.model_number,
523                         &info.date_of_manuf,
524                         &info.platform_ver,
525                         &info.os_ver,
526                         &info.hardware_ver,
527                         &info.firmware_ver,
528                         &info.support_url,
529                         &info.system_time);
530
531         /* From iotivity, we can get uri_path. But, the value is always "/oic/p". */
532
533         if (cb)
534                 cb(&info, cb_container->user_data);
535 }
536
537
538 API int iotcon_get_platform_info(const char *host_address, iotcon_platform_info_cb cb,
539                 void *user_data)
540 {
541         GError *error = NULL;
542         unsigned int sub_id;
543         int ret, signal_number;
544         char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0};
545         icl_platform_info_s *cb_container;
546
547         RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
548         RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
549         RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
550
551         signal_number = icl_dbus_generate_signal_number();
552
553         ic_dbus_call_get_platform_info_sync(icl_dbus_get_object(), host_address,
554                         signal_number, &ret, NULL, &error);
555         if (error) {
556                 ERR("ic_dbus_call_get_platform_info_sync() Fail(%s)", error->message);
557                 ret = icl_dbus_convert_dbus_error(error->code);
558                 g_error_free(error);
559                 return ret;
560         }
561
562         if (IOTCON_ERROR_NONE != ret) {
563                 ERR("iotcon-daemon Fail(%d)", ret);
564                 return icl_dbus_convert_daemon_error(ret);
565         }
566
567         snprintf(signal_name, sizeof(signal_name), "%s_%u", IC_DBUS_SIGNAL_PLATFORM,
568                         signal_number);
569
570         cb_container = calloc(1, sizeof(icl_platform_info_s));
571         if (NULL == cb_container) {
572                 ERR("calloc() Fail(%d)", errno);
573                 return IOTCON_ERROR_OUT_OF_MEMORY;
574         }
575
576         cb_container->cb = cb;
577         cb_container->user_data = user_data;
578
579         sub_id = icl_dbus_subscribe_signal(signal_name, cb_container, free,
580                         _icl_platform_info_cb);
581         if (0 == sub_id) {
582                 ERR("icl_dbus_subscribe_signal() Fail");
583                 free(cb_container);
584                 return IOTCON_ERROR_DBUS;
585         }
586
587         cb_container->id = sub_id;
588
589         return ret;
590 }
591
592
593 static void _icl_tizen_info_cb(GObject *object, GAsyncResult *g_async_res,
594                 gpointer user_data)
595 {
596         int res;
597         GVariant *result;
598         char *device_name;
599         char *tizen_device_id;
600         GError *error = NULL;
601         struct icl_tizen_info info = {0};
602         icl_tizen_info_s *cb_container = user_data;
603         iotcon_tizen_info_cb cb = cb_container->cb;
604
605         ic_dbus_call_get_tizen_info_finish(IC_DBUS(object), &result, g_async_res, &error);
606         if (error) {
607                 ERR("ic_dbus_call_get_tizen_info_finish() Fail(%s)", error->message);
608                 g_error_free(error);
609                 cb(&info, IOTCON_ERROR_DBUS, cb_container->user_data);
610                 /* TODO contain time out error */
611                 free(cb_container);
612                 return;
613         }
614
615         g_variant_get(result, "(&s&si)", &device_name, &tizen_device_id, &res);
616
617         if (IOTCON_ERROR_NONE == res && NULL != ic_utils_dbus_decode_str(tizen_device_id)) {
618                 info.device_name = ic_utils_dbus_decode_str(device_name);
619                 info.tizen_device_id = tizen_device_id;
620         }
621
622         if (cb)
623                 cb(&info, res, cb_container->user_data);
624
625         free(cb_container);
626 }
627
628
629 API int iotcon_get_tizen_info(const char *host_address, iotcon_tizen_info_cb cb,
630                 void *user_data)
631 {
632         icl_tizen_info_s *cb_container;
633
634         RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
635         RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
636         RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
637
638         cb_container = calloc(1, sizeof(icl_tizen_info_s));
639         if (NULL == cb_container) {
640                 ERR("calloc() Fail(%d)", errno);
641                 return IOTCON_ERROR_OUT_OF_MEMORY;
642         }
643
644         cb_container->cb = cb;
645         cb_container->user_data = user_data;
646
647         ic_dbus_call_get_tizen_info(icl_dbus_get_object(), host_address, NULL,
648                         _icl_tizen_info_cb, cb_container);
649
650         return IOTCON_ERROR_NONE;
651 }
652
653
654 API int iotcon_tizen_info_get_property(iotcon_tizen_info_h tizen_info,
655                 iotcon_tizen_info_e property, char **value)
656 {
657         RETV_IF(NULL == tizen_info, IOTCON_ERROR_INVALID_PARAMETER);
658         RETV_IF(NULL == value, IOTCON_ERROR_INVALID_PARAMETER);
659
660         switch (property) {
661         case IOTCON_TIZEN_INFO_DEVICE_NAME:
662                 *value = tizen_info->device_name;
663                 break;
664         case IOTCON_TIZEN_INFO_TIZEN_DEVICE_ID:
665                 *value = tizen_info->tizen_device_id;
666                 break;
667         default:
668                 ERR("Invalid property(%d)", property);
669                 return IOTCON_ERROR_INVALID_PARAMETER;
670         }
671
672         return IOTCON_ERROR_NONE;
673 }