Merge getter API's for service/user/device 64/252364/3
authorAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 25 Jan 2021 11:12:59 +0000 (16:42 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 28 Jan 2021 04:29:58 +0000 (09:59 +0530)
Deprecated API's in this patch
- ua_service_get_name()
- ua_service_get_detection_threshold()
- ua_user_get_account()
- ua_device_get_mac_type()
- ua_device_get_os_info()
- ua_device_get_mac_address()
- ua_device_get_device_id()
- ua_device_get_wifi_bssid()
- ua_device_get_wifi_ipv4_address()
- ua_device_get_last_presence()

This patch adds below new getter API's
- ua_service_get_information()
- ua_user_get_information()
- ua_device_get_information()

Change-Id: Ie6716701f4b2d53c808bc1cc7a7e74439c6261a4
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
include/user-awareness.h
src/user-awareness-device.c
src/user-awareness-service.c
src/user-awareness-users.c
test/uat-detections.c
test/uat-devices.c
test/uat-scenarios.c
test/uat-service.c
test/uat-users.c

index f066250eab12131440868683384f7e3a11b0a632..30654a29cf99cb7845b40f8db1aeeb20641805a4 100755 (executable)
@@ -480,6 +480,43 @@ typedef bool (*ua_service_added_user_cb)(
                ua_user_h user_handle,
                void *user_data);
 
+/**
+ * @brief User info. data structure.
+ * @since_tizen 6.5
+ */
+typedef struct {
+       char *account; /**< Account */
+       char *name; /**< User name */
+       unsigned long long last_seen ; /*last seen */
+} ua_user_information_s;
+
+/**
+ * @brief Service info. data structure.
+ * @since_tizen 6.5
+ */
+typedef struct {
+       char *name; /**< Service name */
+       int presence_threshold; /**< Presence detection threshold */
+       int absence_threshold; /**<Absence detection threshold */
+} ua_service_information_s;
+
+/**
+ * @brief Device info data structure.
+ * @since_tizen 6.5
+ */
+typedef struct {
+       char *device_id; /**< Mobile id (e.g. BT MAC or UUID) */
+       ua_mac_type_e type; /**< Connectivity technology type using this MAC address */
+       char *mac; /**< MAC address */
+       ua_os_type_e os; /**< OS type */
+       char *bssid; /**< BSSID */
+       char *ipv4; /**< IPv4 address */
+       char *ipv6; /**< IPv6 address */
+       unsigned long long last_seen; /**< The time of last presence */
+       int rssi; /* RSSI value for device */
+       bool pairing_required; /**< Does it need pairing? */
+} ua_dev_information_s;
+
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Initializes an user awareness framework.
@@ -949,8 +986,7 @@ int ua_user_destroy(
  *
  * @see ua_user_remove()
  */
-int ua_user_add(
-               ua_user_h user_handle);
+int ua_user_add(ua_user_h user_handle);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -992,7 +1028,32 @@ int ua_user_remove(
  *
  * @see ua_user_set_account()
  */
-int ua_user_get_account(ua_user_h user_handle, char **account);
+int ua_user_get_account(ua_user_h user_handle,
+               char **account) TIZEN_DEPRECATED_API;
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets user info for user handle.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release user_info.
+ * @param[in] user_handle The user handle
+ * @param[out] user_info The user information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_user_create()
+ */
+int ua_user_get_information(ua_user_h user_handle,
+                       ua_user_information_s **user_info);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1302,6 +1363,30 @@ int ua_service_get_by_name(
                const char *name,
                ua_service_h *service_handle) TIZEN_DEPRECATED_API;
 
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets service info for service handle.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release service_info.
+ * @param[in] service_handle The service handle
+ * @param[out] service_info The service information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_service_create()
+ */
+int ua_service_get_information(ua_service_h service_handle,
+                       ua_service_information_s **service_info);
+
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Gets service handle by service name.
@@ -1372,7 +1457,7 @@ int ua_service_set_detection_threshold(
 int ua_service_get_detection_threshold(
                ua_service_h service_handle,
                unsigned int *presence_threshold,
-               unsigned int *absence_threshold);
+               unsigned int *absence_threshold) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1418,7 +1503,7 @@ int ua_service_set_name(
  */
 int ua_service_get_name(
                ua_service_h service_handle,
-               char **name);
+               char **name) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1482,8 +1567,8 @@ int ua_service_remove_user(
  * @pre
  * @post
  *
- * @see ua_service_add_device()
- * @see ua_service_remove_device()
+ * @see ua_service_add_user()
+ * @see ua_service_remove_user()
  */
 int ua_service_set_device_discriminant(
                ua_service_h service_handle,
@@ -1507,8 +1592,8 @@ int ua_service_set_device_discriminant(
  * @pre
  * @post
  *
- * @see ua_service_add_device()
- * @see ua_service_remove_device()
+ * @see ua_service_add_user()
+ * @see ua_service_remove_user()
  */
 int ua_service_get_device_discriminant(
                ua_service_h service_handle,
@@ -1682,7 +1767,7 @@ int ua_device_set_mac_type(
  */
 int ua_device_get_mac_type(
                ua_device_h device_handle,
-               ua_mac_type_e *mac_type);
+               ua_mac_type_e *mac_type) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1726,7 +1811,7 @@ int ua_device_set_os_info(
  */
 int ua_device_get_os_info(
                ua_device_h device_handle,
-               ua_os_type_e *os_info);
+               ua_os_type_e *os_info) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1772,7 +1857,7 @@ int ua_device_set_mac_address(
  */
 int ua_device_get_mac_address(
                ua_device_h device_handle,
-               char **mac_address);
+               char **mac_address) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1813,7 +1898,7 @@ int ua_device_set_device_id(
  */
 int ua_device_get_device_id(
                ua_device_h device_handle,
-               char **device_id);
+               char **device_id) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1858,7 +1943,7 @@ int ua_device_set_wifi_bssid(
  */
 int ua_device_get_wifi_bssid(
                ua_device_h device_handle,
-               char **bssid);
+               char **bssid) TIZEN_DEPRECATED_API;
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets device's Wi-Fi IPv4 address.
@@ -1903,7 +1988,7 @@ int ua_device_set_wifi_ipv4_address(
  */
 int ua_device_get_wifi_ipv4_address(
                ua_device_h device_handle,
-               char **ipv4_address);
+               char **ipv4_address) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1924,7 +2009,7 @@ int ua_device_get_wifi_ipv4_address(
  */
 int ua_device_get_last_presence(
                ua_device_h device_handle,
-               unsigned long long *last_seen);
+               unsigned long long *last_seen) TIZEN_DEPRECATED_API;
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1945,7 +2030,31 @@ int ua_device_get_last_presence(
  */
 int ua_device_get_pairing_required(
                ua_device_h device_handle,
-               bool *pairing_required);
+               bool *pairing_required) TIZEN_DEPRECATED_API;
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets device info for device handle.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release device_info.
+ * @param[in] device_handle The device handle
+ * @param[out] device_info The device information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_device_create()
+ */
+int ua_device_get_information(ua_device_h device_handle,
+                       ua_dev_information_s **device_info);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
index 219f8c9863ec0c152342544b26e37dc04c2d0d4a..b1a2fb13d2f21de849f1ec73971b223d971251e8 100755 (executable)
@@ -533,6 +533,7 @@ int ua_device_get_mac_type(ua_device_h handle, ua_mac_type_e *mac_type)
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
 
@@ -709,7 +710,6 @@ int ua_device_set_discriminant(
        FUNC_ENTRY;
 
        UA_DEPRECATED_LOG(__FUNCTION__, "");
-
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        ua_dev_info_s *device = (ua_dev_info_s *)device_handle;
@@ -726,6 +726,7 @@ int ua_device_get_mac_address(
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(mac_address);
@@ -759,6 +760,7 @@ int ua_device_get_os_info(
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(os_info);
@@ -776,6 +778,7 @@ int ua_device_get_device_id(
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_PRINT_DEVICE_HANDLE(device_handle);
@@ -807,6 +810,7 @@ int ua_device_get_wifi_bssid(
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(bssid);
@@ -838,6 +842,7 @@ int ua_device_get_wifi_ipv4_address(
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(ipv4_address);
@@ -871,6 +876,7 @@ int ua_device_get_last_presence(
 {
        FUNC_ENTRY;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(timestamp);
@@ -1206,6 +1212,7 @@ int ua_device_get_pairing_required(
        gboolean is_registered = FALSE;
        uam_device_info_s uam_device;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_INPUT_PARAMETER(pairing_required);
@@ -1246,3 +1253,39 @@ int ua_device_get_pairing_required(
        FUNC_EXIT;
        return UA_ERROR_NONE;
 }
+
+int ua_device_get_information(ua_device_h device_handle,
+                       ua_dev_information_s **device_info)
+{
+       FUNC_ENTRY;
+       ua_dev_info_s *device = (ua_dev_info_s *)device_handle;
+
+       UA_CHECK_INIT_STATUS();
+       UA_VALIDATE_INPUT_PARAMETER(device_handle);
+       UA_VALIDATE_INPUT_PARAMETER(device_info);
+       UA_VALIDATE_HANDLE(device_handle, ua_devices_list);
+       UA_PRINT_USER_HANDLE(device_handle);
+
+       retv_if(NULL == device->device_id, UA_ERROR_INVALID_PARAMETER);
+
+       *device_info = g_malloc0(sizeof(ua_dev_information_s));
+       if (!*device_info) {
+               /* LCOV_EXCL_START */
+               UA_ERR("g_malloc0 failed");
+               return UA_ERROR_OUT_OF_MEMORY;
+               /* LCOV_EXCL_STOP */
+       }
+       (*device_info)->device_id = g_strdup(device->device_id);
+       (*device_info)->type = device->type;
+       (*device_info)->mac = g_strdup(device->mac);
+       (*device_info)->os = device->os;
+       (*device_info)->last_seen = device->last_seen;
+       (*device_info)->bssid = g_strdup(device->bssid);
+       (*device_info)->ipv4 = g_strdup(device->ipv4);
+       (*device_info)->ipv6 = g_strdup(device->ipv6);
+       (*device_info)->pairing_required = device->pairing_required;
+       (*device_info)->rssi = device->rssi;
+
+       FUNC_EXIT;
+       return UA_ERROR_NONE;
+}
index acca08a7d8404f6b948d84dc1dac0afc258cb569..ad100245cd15f7d30cb63ae07d6e694691aaf233 100755 (executable)
@@ -517,6 +517,7 @@ int ua_service_get_name(ua_service_h service_handle, char **name)
 
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_service_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(name);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
@@ -542,6 +543,7 @@ int ua_service_get_detection_threshold(ua_service_h service_handle,
 
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_service_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -628,9 +630,8 @@ int ua_service_get_by_name(const char *name, ua_service_h *service_handle)
        GSList *l;
        ua_service_info_s *s;
 
-       UA_CHECK_INIT_STATUS();
        UA_DEPRECATED_LOG(__FUNCTION__, "ua_get_service_by_name");
-
+       UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(name);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
 
@@ -991,7 +992,6 @@ int ua_service_foreach_added_devices(
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
        UA_DEPRECATED_LOG(__FUNCTION__, "");
-
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
@@ -1095,3 +1095,32 @@ int ua_service_get_user_by_account(ua_service_h service_handle,
        FUNC_EXIT;
        return UA_ERROR_NONE;
 }
+
+int ua_service_get_information(ua_service_h service_handle,
+                       ua_service_information_s **service_info)
+{
+       FUNC_ENTRY;
+       ua_service_info_s *service = (ua_service_info_s *)service_handle;
+
+       UA_CHECK_INIT_STATUS();
+       UA_VALIDATE_INPUT_PARAMETER(service_handle);
+       UA_VALIDATE_INPUT_PARAMETER(service_info);
+       UA_VALIDATE_HANDLE(service_handle, ua_services_list);
+       UA_PRINT_USER_HANDLE(service_handle);
+
+       retv_if(NULL == service->name, UA_ERROR_INVALID_PARAMETER);
+
+       *service_info = g_malloc0(sizeof(ua_service_information_s));
+       if (!*service_info) {
+               /* LCOV_EXCL_START */
+               UA_ERR("g_malloc0 failed");
+               return UA_ERROR_OUT_OF_MEMORY;
+               /* LCOV_EXCL_STOP */
+       }
+       (*service_info)->name = g_strdup(service->name);
+       (*service_info)->presence_threshold = service->presence_threshold;
+       (*service_info)->absence_threshold = service->absence_threshold;
+
+       FUNC_EXIT;
+       return UA_ERROR_NONE;
+}
index 7df9c924ce7b03f7777cbc55d7e367ee169ddc11..702a032672ddb2de44f6a7e4d8352cdc8ee2a810 100755 (executable)
@@ -652,12 +652,44 @@ int ua_user_set_account(ua_user_h user_handle, const char *account)
        return UA_ERROR_NONE;
 }
 
+int ua_user_get_information(ua_user_h user_handle,
+                       ua_user_information_s **user_info)
+{
+       FUNC_ENTRY;
+       ua_user_info_s *user = (ua_user_info_s *)user_handle;
+
+       UA_CHECK_INIT_STATUS();
+       UA_VALIDATE_INPUT_PARAMETER(user_handle);
+       UA_VALIDATE_INPUT_PARAMETER(user_info);
+       UA_VALIDATE_HANDLE(user_handle, ua_users_list);
+       UA_PRINT_USER_HANDLE(user_handle);
+
+       retv_if(NULL == user->account, UA_ERROR_INVALID_PARAMETER);
+
+       *user_info = g_malloc0(sizeof(ua_user_information_s));
+       if (!*user_info) {
+               /* LCOV_EXCL_START */
+               UA_ERR("g_malloc0 failed");
+               return UA_ERROR_OUT_OF_MEMORY;
+               /* LCOV_EXCL_STOP */
+       }
+       (*user_info)->account = g_strdup(user->account);
+       (*user_info)->name = g_strdup(user->name);
+
+       /* TO-DO: update user last seen */
+       (*user_info)->last_seen = 0;
+
+       FUNC_EXIT;
+       return UA_ERROR_NONE;
+}
+
 int ua_user_get_account(ua_user_h user_handle, char **account)
 {
        FUNC_ENTRY;
 
        ua_user_info_s *user = (ua_user_info_s *)user_handle;
 
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_user_get_information");
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
        UA_VALIDATE_INPUT_PARAMETER(account);
index 1cda8d2d25fa7433fc0e5afc638147522cbaa56c..22bda1c2f7ff9f5ffd5b1ef5a7a89c31de769565 100755 (executable)
@@ -47,23 +47,15 @@ static char g_lpm_onoff[MENU_DATA_SIZE + 1] = "1"; /**<  LPM mode on/off */
 static void __sensor_presence_detected_device(ua_device_h device_handle)
 {
        int ret;
-       char *mac = NULL;
-       ua_mac_type_e mac_type;
+       ua_dev_information_s *device = NULL;
 
-       ret = ua_device_get_mac_address(device_handle, &mac);
+       ret = ua_device_get_information(device_handle, &device);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_device_get_mac_address() ret: [0x%X] [%s]",
-                       ret, uat_get_error_str(ret));
-       }
-       ret = ua_device_get_mac_type(device_handle, &mac_type);
-       if (UA_ERROR_NONE != ret) {
-               msg(" - ua_device_get_mac_type() ret: [0x%X] [%s]",
+               msg(" - ua_device_get_information() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
        }
        msgb("[%s] Presence detected on [%s]",
-             uat_convert_device_mac_type_to_txt(mac_type), mac);
-
-       g_free(mac);
+             uat_convert_device_mac_type_to_txt(device->type), device->mac);
 }
 
 static void __sensor_detected_sensor_info(int type,
@@ -95,14 +87,18 @@ void _sensor_presence_detected_cb(int result, ua_monitor_h monitor,
        msgb("\n[%s]", pbuf);
        free(pbuf);
        int ret;
-       char *service_name = NULL;
+       ua_service_information_s* service = NULL;
 
-       ret = ua_service_get_name(g_service_h, &service_name);
+       ret = ua_service_get_information(g_service_h, &service);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_name() ret: [0x%X] [%s]",
+               msg(" - ua_service_get_information() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
        }
-       msgb("Presence detected for service [%s]", service_name);
+       msgb("Presence detected for service [%s]", service->name);
+       if (service)
+               g_free(service->name);
+       g_free(service);
+
 
        if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
                msgb("[%s] PRESENCE detected [%s]",
@@ -137,14 +133,17 @@ void _sensor_absence_detected_cb(int result, ua_monitor_h monitor,
        msgp("\n[%s]", pbuf);
        free(pbuf);
        int ret;
-       char *service_name = NULL;
+       ua_service_information_s* service = NULL;
 
-       ret = ua_service_get_name(g_service_h, &service_name);
+       ret = ua_service_get_information(g_service_h, &service);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_name() ret: [0x%X] [%s]",
+               msg(" - ua_service_get_information() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
        }
-       msgb("Absence detected for service [%s]", service_name);
+       msgb("Absence detected for service [%s]", service->name);
+       if (service)
+               g_free(service->name);
+       g_free(service);
 
        if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
                msgp("[%s] ABSENCE detected [%s]",
index 784f3323ab58442dd738f515f1cd35c7b7508fa1..5ae9687c7c830fda22287b23f693834ab63c3095 100755 (executable)
@@ -55,76 +55,42 @@ extern int g_device_count; /**< Seletected service name */
 bool _foreach_added_device_cb(
        ua_device_h device_handle, void *user_data)
 {
-       int ret, ret_temp;
+       int ret_temp;
        ua_device_h handle = NULL;
-
-       ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
-       ua_os_type_e ostype = UA_OS_TYPE_NOT_DEFINE;
-       char *device_id = NULL;
-       char *mac = NULL;
-       char *wifi_bssid = NULL;
-       char *ipv4 = NULL;
-       bool required = false;
-       unsigned long long last_seen = 0;
+       ua_dev_information_s *device = NULL;
 
        if (!device_handle) {
                msgr("device_handle is NULL");
                return true;
        }
-
-       ret = ua_device_clone(&handle, device_handle);
-       if (UA_ERROR_NONE != ret) {
-               msgr("ua_device_clone() result: [0x%X] [%s]",
-                       ret, uat_get_error_str(ret));
-       }
-
        msgb("\n[%d]", ++g_device_count);
 
-       ret_temp = ua_device_get_mac_type(handle, &mac_type);
-       if (UA_ERROR_NONE == ret_temp)
-               msgb("Device MAC Type : %s", uat_get_mac_type_str(mac_type));
-
-       ret_temp = ua_device_get_os_info(handle, &ostype);
+       ret_temp = ua_device_get_information(device_handle, &device);
        if (UA_ERROR_NONE == ret_temp) {
+               msgb("Device MAC Type : %s",
+                       uat_get_mac_type_str(device->type));
                msgb("Device OS Type : %s",
-                       ostype == 1 ? "Tizen" :
-                       ostype == 2 ? "Android" :
-                       ostype == 3 ? "iOS" : "N/A");
+                       device->os == 1 ? "Tizen" :
+                       device->os == 2 ? "Android" :
+                       device->os == 3 ? "iOS" : "N/A");
+               msgb("Device ID : %s", device->device_id);
+               msgb("Device MAC : %s", device->mac);
+               msgb("Device BSSID : %s", device->bssid);
+               msgb("Device IPv4 Addr : %s", device->ipv4);
+               msgb("Pairing Required : %s",
+                       device->pairing_required ? "YES" : "NO");
+               msgb("Last present at : %llu", device->last_seen);
        }
 
-       ret_temp = ua_device_get_device_id(handle, &device_id);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device ID : %s", device_id);
-               g_free(device_id);
-       }
-
-       ret_temp = ua_device_get_mac_address(handle, &mac);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device MAC : %s", mac);
-               g_free(mac);
-       }
-
-       ret_temp = ua_device_get_wifi_bssid(handle, &wifi_bssid);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device BSSID : %s", wifi_bssid);
-               g_free(wifi_bssid);
-       }
-
-       ret_temp = ua_device_get_wifi_ipv4_address(handle, &ipv4);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device IPv4 Addr : %s", ipv4);
-               g_free(ipv4);
-       }
-
-       ret_temp = ua_device_get_pairing_required(handle, &required);
-       if (UA_ERROR_NONE == ret_temp)
-               msgb("Pairing Required : %s", required ? "YES" : "NO");
-
-       ret_temp = ua_device_get_last_presence(handle, &last_seen);
-       if (UA_ERROR_NONE == ret_temp)
-               msgb("Last present at : %llu", last_seen);
-
        g_device_list = g_slist_append(g_device_list, handle);
+       if (device) {
+               g_free(device->device_id);
+               g_free(device->mac);
+               g_free(device->bssid);
+               g_free(device->ipv4);
+               g_free(device->ipv6);
+       }
+       g_free(device);
 
        return true;
 }
@@ -132,65 +98,41 @@ bool _foreach_added_device_cb(
 void uat_update_device_info(void)
 {
        int ret = UA_ERROR_NONE;
-       ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
-       ua_os_type_e ostype = UA_OS_TYPE_NOT_DEFINE;
-       char *device_id = NULL;
-       char *mac = NULL;
-       char *wifi_bssid = NULL;
-       char *ipv4 = NULL;
-       bool required = false;
+       ua_dev_information_s *device = NULL;
 
        check_if(NULL == g_device_h);
 
-       ret = ua_device_get_mac_type(g_device_h, &mac_type);
+       ret = ua_device_get_information(g_device_h, &device);
        if (UA_ERROR_NONE == ret) {
                memset(g_device_type_str, 0, MENU_DATA_SIZE + 1);
                snprintf(g_device_type_str, MENU_DATA_SIZE, "%s",
-                       uat_get_mac_type_str(mac_type));
+                       uat_get_mac_type_str(device->type));
                snprintf(g_device_type, MENU_DATA_SIZE, "%d",
-                       uat_convert_device_type_to_idx(mac_type));
-       }
-
-       ret = ua_device_get_os_info(g_device_h, &ostype);
-       snprintf(g_os_type_str, MENU_DATA_SIZE, "%s",
-               ostype == 1 ? "Tizen" :
-               ostype == 2 ? "Android" :
-               ostype == 3 ? "iOS" : "N/A");
-
-       ret = ua_device_get_device_id(g_device_h, &device_id);
-       if (UA_ERROR_NONE == ret && device_id) {
+                       uat_convert_device_type_to_idx(device->type));
+               snprintf(g_os_type_str, MENU_DATA_SIZE, "%s",
+                       device->os == 1 ? "Tizen" :
+                       device->os == 2 ? "Android" :
+                       device->os == 3 ? "iOS" : "N/A");
                memset(g_device_id_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_device_id_str, device_id, MENU_DATA_SIZE);
-               g_free(device_id);
-       }
-
-       ret = ua_device_get_mac_address(g_device_h, &mac);
-       if (UA_ERROR_NONE == ret && mac) {
+               memcpy(g_device_id_str, device->device_id, MENU_DATA_SIZE);
                memset(g_mac_addr_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_mac_addr_str, mac, MENU_DATA_SIZE);
-               g_free(mac);
-       }
-
-       ret = ua_device_get_wifi_bssid(g_device_h, &wifi_bssid);
-       if (UA_ERROR_NONE == ret && wifi_bssid) {
+               memcpy(g_mac_addr_str, device->mac, MENU_DATA_SIZE);
                memset(g_bss_id_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_bss_id_str, wifi_bssid, MENU_DATA_SIZE);
-               g_free(wifi_bssid);
-       }
-
-       ret = ua_device_get_wifi_ipv4_address(g_device_h, &ipv4);
-       if (UA_ERROR_NONE == ret && ipv4) {
+               memcpy(g_bss_id_str, device->bssid, MENU_DATA_SIZE);
                memset(g_ipv4_address_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_ipv4_address_str, ipv4, MENU_DATA_SIZE);
-               g_free(ipv4);
-       }
-
-       ret = ua_device_get_pairing_required(g_device_h, &required);
-       if (UA_ERROR_NONE == ret) {
+               memcpy(g_ipv4_address_str, device->ipv4, MENU_DATA_SIZE);
                memset(g_is_paring_required_str, 0, MENU_DATA_SIZE + 1);
                memcpy(g_is_paring_required_str,
-                       required ? "YES" : "NO ", sizeof("YES"));
+                       device->pairing_required ? "YES" : "NO ", sizeof("YES"));
+       }
+       if (device) {
+               g_free(device->device_id);
+               g_free(device->mac);
+               g_free(device->bssid);
+               g_free(device->ipv4);
+               g_free(device->ipv6);
        }
+       g_free(device);
 
 }
 
index 4b44c09833c66f4b1b6c37ddad26c36eba2df3d1..1120753b2dea284388b893464fe59ae4b9fad30e 100755 (executable)
@@ -278,9 +278,6 @@ static void __device_added_cb(int result,
        ret = ua_service_add_device(g_service_h, handle);
        msg(" - ua_service_add_device() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
-
-       ua_mac_type_e device_type = UA_MAC_TYPE_INVALID;
-       ret = ua_device_get_mac_type(handle, &device_type);
 }
 
 static int __create_add_device(int device_type, int ostype,
index 87ae0f96da79feeb2dd1be261a1343c610b7536e..2712baa51955f7c5832c4af694851ff96073b8a4 100755 (executable)
@@ -56,14 +56,16 @@ static bool _service_foreach_added_user_cb(
        int ret = UA_ERROR_NONE;
 
        ua_user_h handle = NULL;
-       char *service_name = NULL;
-       char *account = NULL;
+       ua_user_information_s *user = NULL;
+       ua_service_information_s *service = NULL;
 
-       ret = ua_service_get_name(service_handle, &service_name);
+       ret = ua_service_get_information(service_handle, &service);
        if (UA_ERROR_NONE == ret)
-               msgp("Cur. Service name : %s\n", service_name);
+               msgp("Cur. Service name : %s\n", service->name);
 
-       g_free(service_name);
+       if (service)
+               g_free(service->name);
+       g_free(service);
 
        if (!user_handle) {
                msgr("user_handle is NULL");
@@ -79,12 +81,16 @@ static bool _service_foreach_added_user_cb(
        user_list = g_slist_append(user_list, handle);
        idx_user++;
 
-       ret = ua_user_get_account(handle, &account);
+       ret = ua_user_get_information(handle, &user);
        if (UA_ERROR_NONE == ret) {
                msglr("[%d]", idx_user);
-               msglr("User account info %s", account);
-               g_free(account);
+               msglr("User account info %s", user->account);
        }
+       if (user) {
+               g_free(user->account);
+               g_free(user->name);
+       }
+       g_free(user);
 
        return true;
 }
@@ -92,7 +98,7 @@ static bool _service_foreach_added_user_cb(
 static void __update_service_info(void)
 {
        int ret = UA_ERROR_NONE;
-       char *name = NULL;
+       ua_service_information_s *service = NULL;
 
        if (1 == g_service_count) {
                if (g_service_h) {
@@ -103,12 +109,16 @@ static void __update_service_info(void)
                ua_service_get_default_service(&g_service_h);
        }
 
-       ret = ua_service_get_name(g_service_h, &name);
+       ret = ua_service_get_information(g_service_h, &service);
        if (UA_ERROR_NONE == ret) {
+               msgp("Cur. Service name : %s\n", service->name);
                memset(g_service_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_service_str, name, MENU_DATA_SIZE);
-               g_free(name);
+               memcpy(g_service_str, service->name, MENU_DATA_SIZE);
        }
+
+       if (service)
+               g_free(service->name);
+       g_free(service);
 }
 
 static void  ___free_service(gpointer data)
@@ -129,38 +139,28 @@ bool _foreach_added_service_cb(
        ua_service_h service_handle, void *user_data)
 {
        int ret = UA_ERROR_NONE;
-       char *name = NULL;
-       unsigned int presence_threshold = 0;
-       unsigned int absence_threshold = 0;
+       ua_service_information_s *service = NULL;
 
        if (NULL == service_handle) {
                msgr("service_handle is NULL");
                return true;
        }
 
-       ret = ua_service_get_name(service_handle, &name);
-       if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_name() ret: [0x%X] [%s]",
-                       ret, uat_get_error_str(ret));
-               return RET_SUCCESS;
-       }
-
-       ret = ua_service_get_detection_threshold(service_handle,
-                       &presence_threshold, &absence_threshold);
+       ret = ua_service_get_information(service_handle, &service);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_detection_threshold() ret: [0x%X] [%s]",
+               msg(" - ua_service_get_information() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
-               g_free(name);
                return RET_SUCCESS;
        }
 
-       msgr("[%d] %s ", ++g_service_count, name);
+       msgr("[%d] %s ", ++g_service_count, service->name);
        msgr("presence threshold :[%d] absence threshold :[%d]",
-                       presence_threshold, absence_threshold);
+               service->presence_threshold, service->absence_threshold);
 
        g_service_list = g_slist_append(g_service_list, service_handle);
-
-       g_free(name);
+       if (service)
+               g_free(service->name);
+       g_free(service);
 
        return true;
 }
@@ -170,84 +170,52 @@ static bool _service_foreach_added_device_cb(
 {
        int ret, ret_temp;
        ua_device_h handle = NULL;
-       char *service_name = NULL;
-
-       ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
-       ua_os_type_e ostype = UA_OS_TYPE_NOT_DEFINE;
-       char *device_id = NULL;
-       char *mac = NULL;
-       char *wifi_bssid = NULL;
-       char *ipv4 = NULL;
-       bool required = false;
-       unsigned long long last_seen = 0;
+       ua_service_information_s *service = NULL;
+       ua_dev_information_s *device = NULL;
 
        if (!service_handle) {
                msgr("service_handle is NULL");
                return true;
        }
 
-       ret = ua_service_get_name(service_handle, &service_name);
+       ret = ua_service_get_information(service_handle, &service);
        if (UA_ERROR_NONE == ret)
-               msgb("Cur. Service name : %s", service_name);
-       g_free(service_name);
+               msgp("Cur. Service name : %s\n", service->name);
+
+       if (service)
+               g_free(service->name);
+       g_free(service);
 
        if (!device_handle) {
                msgr("device_handle is NULL");
                return true;
        }
-
-       ret = ua_device_clone(&handle, device_handle);
-       if (UA_ERROR_NONE != ret) {
-               msgr(" - ua_device_clone() ret: [0x%X] [%s]",
-                       ret, uat_get_error_str(ret));
-               return true;
-       }
-
        msgb("\n[%d]", ++g_device_count);
 
-       ret_temp = ua_device_get_mac_type(handle, &mac_type);
-       if (UA_ERROR_NONE == ret_temp)
-               msgb("Device MAC Type : %s", uat_get_mac_type_str(mac_type));
-
-       ret_temp = ua_device_get_os_info(handle, &ostype);
+       ret = ua_device_get_information(g_device_h, &device);
        if (UA_ERROR_NONE == ret_temp) {
+               msgb("Device MAC Type : %s",
+                       uat_get_mac_type_str(device->type));
                msgb("Device OS Type : %s",
-                       ostype == 1 ? "Tizen" :
-                       ostype == 2 ? "Android" :
-                       ostype == 3 ? "iOS" : "N/A");
-       }
-
-       ret_temp = ua_device_get_device_id(handle, &device_id);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device ID : %s", device_id);
-               g_free(device_id);
+                       device->os == 1 ? "Tizen" :
+                       device->os == 2 ? "Android" :
+                       device->os == 3 ? "iOS" : "N/A");
+               msgb("Device ID : %s", device->device_id);
+               msgb("Device MAC : %s", device->mac);
+               msgb("Device BSSID : %s", device->bssid);
+               msgb("Device IPv4 Addr : %s", device->ipv4);
+               msgb("Pairing Required : %s",
+                       device->pairing_required ? "YES" : "NO");
+               msgb("Last present at : %llu", device->last_seen);
        }
-
-       ret_temp = ua_device_get_mac_address(handle, &mac);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device MAC : %s", mac);
-               g_free(mac);
+       if (device) {
+               g_free(device->device_id);
+               g_free(device->mac);
+               g_free(device->bssid);
+               g_free(device->ipv4);
+               g_free(device->ipv6);
        }
-
-       ret_temp = ua_device_get_wifi_bssid(handle, &wifi_bssid);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device BSSID : %s", wifi_bssid);
-               g_free(wifi_bssid);
-       }
-
-       ret_temp = ua_device_get_wifi_ipv4_address(handle, &ipv4);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgb("Device IPv4 Addr : %s", ipv4);
-               g_free(ipv4);
-       }
-
-       ret_temp = ua_device_get_pairing_required(handle, &required);
-       if (UA_ERROR_NONE == ret_temp)
-               msgb("Pairing Required : %s", required ? "YES" : "NO");
-
-       ret_temp = ua_device_get_last_presence(handle, &last_seen);
-       if (UA_ERROR_NONE == ret_temp)
-               msgb("Last present at : %llu", last_seen);
+       g_free(device);
 
        g_device_list = g_slist_append(g_device_list, handle);
 
index 39105eb06ce56cd2e808de3d3c9c333cb717dfd3..69c030f18aabd141ffd742eb499f27209910ad56 100755 (executable)
@@ -54,7 +54,7 @@ char g_selected_user_idx[MENU_DATA_SIZE + 1] = {0,}; /** Selected user id */
 static void update_user_info(void)
 {
        int ret = UA_ERROR_NONE;
-       char *account = NULL;
+       ua_user_information_s *user = NULL;
 
        if (0 == idx_user) {
                if (g_user_h) {
@@ -64,12 +64,16 @@ static void update_user_info(void)
                ua_get_default_user(&g_user_h);
        }
 
-       ret  = ua_user_get_account(g_user_h, &account);
+       ret  = ua_user_get_information(g_user_h, &user);
        if (UA_ERROR_NONE == ret) {
                memset(g_user_account_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_user_account_str, account, MENU_DATA_SIZE);
-               g_free(account);
+               memcpy(g_user_account_str, user->account, MENU_DATA_SIZE);
        }
+       if (user) {
+               g_free(user->account);
+               g_free(user->name);
+       }
+       g_free(user);
 }
 
 static void  ___free_users(gpointer data)
@@ -91,7 +95,7 @@ bool _foreach_registered_user_cb(
 {
        int ret = UA_ERROR_NONE;
        ua_user_h handle = NULL;
-       char *account = NULL;
+       ua_user_information_s *user = NULL;
 
        if (!user_handle) {
                msgr("user_handle is NULL");
@@ -107,12 +111,16 @@ bool _foreach_registered_user_cb(
        user_list = g_slist_append(user_list, handle);
        idx_user++;
 
-       ret = ua_user_get_account(handle, &account);
+       ret = ua_user_get_information(handle, &user);
        if (UA_ERROR_NONE == ret) {
                msglr("[%d]", idx_user);
-               msglr("User account info %s", account);
-               g_free(account);
+               msglr("User account info %s", user->account);
+       }
+       if (user) {
+               g_free(user->account);
+               g_free(user->name);
        }
+       g_free(user);
 
        return true;
 }
@@ -120,45 +128,37 @@ bool _foreach_registered_user_cb(
 void _print_device_info(ua_device_h handle)
 {
        int ret;
-       ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
-       ua_os_type_e ostype = UA_OS_TYPE_NOT_DEFINE;
-       char *device_id = NULL;
-       char *mac = NULL;
-       char *ipv4 = NULL;
+       ua_dev_information_s *device = NULL;
 
        if (NULL == handle) {
                msgr("Device handle is NULL");
                return;
        }
 
-       ret = ua_device_get_mac_type(handle, &mac_type);
-       if (UA_ERROR_NONE == ret)
-               msg("Device MAC Type : %s", uat_get_mac_type_str(mac_type));
-
-       ret = ua_device_get_os_info(handle, &ostype);
-       if (UA_ERROR_NONE == ret)
-               msg("Device OS Type : %s",
-                       ostype == 1 ? "Tizen" :
-                       ostype == 2 ? "Android" :
-                       ostype == 3 ? "iOS" : "N/A");
-
-       ret = ua_device_get_device_id(handle, &device_id);
-       if (UA_ERROR_NONE == ret) {
-               msg("Device ID : %s", device_id);
-               g_free(device_id);
-       }
-
-       ret = ua_device_get_mac_address(handle, &mac);
+       ret = ua_device_get_information(handle, &device);
        if (UA_ERROR_NONE == ret) {
-               msg("Device MAC : %s", mac);
-               g_free(mac);
+               msgb("Device MAC Type : %s",
+                       uat_get_mac_type_str(device->type));
+               msgb("Device OS Type : %s",
+                       device->os == 1 ? "Tizen" :
+                       device->os == 2 ? "Android" :
+                       device->os == 3 ? "iOS" : "N/A");
+               msgb("Device ID : %s", device->device_id);
+               msgb("Device MAC : %s", device->mac);
+               msgb("Device BSSID : %s", device->bssid);
+               msgb("Device IPv4 Addr : %s", device->ipv4);
+               msgb("Pairing Required : %s",
+                       device->pairing_required ? "YES" : "NO");
+               msgb("Last present at : %llu", device->last_seen);
        }
-
-       ret = ua_device_get_wifi_ipv4_address(handle, &ipv4);
-       if (UA_ERROR_NONE == ret) {
-               msg("Device IPv4 Addr : %s", ipv4);
-               g_free(ipv4);
+       if (device) {
+               g_free(device->device_id);
+               g_free(device->mac);
+               g_free(device->bssid);
+               g_free(device->ipv4);
+               g_free(device->ipv6);
        }
+       g_free(device);
 }
 
 static void __device_added_cb(int result,
@@ -177,77 +177,15 @@ static void __device_added_cb(int result,
 static bool _user_foreach_added_device_cb(ua_device_h device_handle,
        void *user_data)
 {
-       int ret, ret_temp;
        ua_device_h handle = NULL;
 
-       ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
-       ua_os_type_e ostype = UA_OS_TYPE_NOT_DEFINE;
-
-       char *device_id = NULL;
-       char *mac = NULL;
-       char *wifi_bssid = NULL;
-       char *ipv4 = NULL;
-       bool required = false;
-       unsigned long long last_seen = 0;
-
        if (!device_handle) {
                msgr("device_handle is NULL");
                return true;
        }
-
-       ret = ua_device_clone(&handle, device_handle);
-       if (UA_ERROR_NONE != ret) {
-               msgr(" - ua_device_clone() ret: [0x%X] [%s]",
-                       ret, uat_get_error_str(ret));
-               return true;
-       }
-
        msgc("\n[%d]", ++g_device_count);
 
-       ret_temp = ua_device_get_mac_type(handle, &mac_type);
-       if (UA_ERROR_NONE == ret_temp)
-               msgc("Device MAC Type : %s", uat_get_mac_type_str(mac_type));
-
-       ret_temp = ua_device_get_os_info(handle, &ostype);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgc("Device OS Type : %s",
-                       ostype == 1 ? "Tizen" :
-                       ostype == 2 ? "Android" :
-                       ostype == 3 ? "iOS" : "N/A");
-       }
-
-       ret_temp = ua_device_get_device_id(handle, &device_id);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgc("Device ID : %s", device_id);
-               g_free(device_id);
-       }
-
-       ret_temp = ua_device_get_mac_address(handle, &mac);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgc("Device MAC : %s", mac);
-               g_free(mac);
-       }
-
-       ret_temp = ua_device_get_wifi_bssid(handle, &wifi_bssid);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgc("Device BSSID : %s", wifi_bssid);
-               g_free(wifi_bssid);
-       }
-
-       ret_temp = ua_device_get_wifi_ipv4_address(handle, &ipv4);
-       if (UA_ERROR_NONE == ret_temp) {
-               msgc("Device IPv4 Addr : %s", ipv4);
-               g_free(ipv4);
-       }
-
-       ret_temp = ua_device_get_pairing_required(handle, &required);
-       if (UA_ERROR_NONE == ret_temp)
-               msgc("Pairing Required : %s", required ? "YES" : "NO");
-
-       ret_temp = ua_device_get_last_presence(handle, &last_seen);
-       if (UA_ERROR_NONE == ret_temp)
-               msgc("Last present at : %llu", last_seen);
-
+       _print_device_info(device_handle);
        g_device_list = g_slist_append(g_device_list, handle);
 
        return true;