Revert "Merge getter API's for service/user/device" 45/252645/1 submit/tizen/20210201.221559
authorAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 1 Feb 2021 05:19:28 +0000 (10:49 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 1 Feb 2021 05:52:39 +0000 (11:22 +0530)
This reverts commit 057d14d70ba706358570d899b81a1da3e2bd0e

Change-Id: I5db08acd80587c869aabe0775781e8684d41460d
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
include/user-awareness-internal.h
include/user-awareness.h
src/user-awareness-device.c
src/user-awareness-service.c
src/user-awareness-users.c
test/.uat-users.c.swp [new file with mode: 0644]
test/uat-detections.c
test/uat-devices.c
test/uat-scenarios.c
test/uat-service.c
test/uat-users.c

index d6fef7b4278510e7a23df01cfed0c49db21c9015..a588bfe8fdabc329851d5c7ccf86e76c10db5080 100755 (executable)
@@ -340,7 +340,7 @@ int ua_get_detection_window(unsigned int* window);
 int ua_reset_database(void);
 
 
-/* Depricated API's */
+/* Deprecated API's */
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -466,31 +466,6 @@ int ua_service_get_by_name(
                const char *name,
                ua_service_h *service_handle) TIZEN_DEPRECATED_API;
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets detection threshold info for service handle.
- * @since_tizen 6.5
- *
- * @param[in] service_handle The service handle
- * @param[out] presence_threshold The service presence threshold information
- * @param[out] absence_threshold The service absence threshold 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_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_service_set_detection_threshold()
- */
-int ua_service_get_detection_threshold(
-               ua_service_h service_handle,
-               unsigned int *presence_threshold,
-               unsigned int *absence_threshold) TIZEN_DEPRECATED_API;
-
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets name info for service handle.
@@ -514,31 +489,6 @@ int ua_service_set_name(
                ua_service_h service_handle,
                const char *name) TIZEN_DEPRECATED_API;
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets name info for service handle.
- * @since_tizen 6.5
- *
- * @remarks You must release @a name using g_free().
- *
- * @param[in] service_handle The service handle
- * @param[out] name The service name 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_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_service_set_name()
- */
-int ua_service_get_name(
-               ua_service_h service_handle,
-               char **name) TIZEN_DEPRECATED_API;
-
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets a device type info for a device.
@@ -562,52 +512,6 @@ int ua_device_set_mac_type(
                ua_device_h device_handle,
                ua_mac_type_e mac_type) TIZEN_DEPRECATED_API;
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device type info from the device.
- * @since_tizen 6.5
- *
- * @param[in] device_handle The device handle
- * @param[out] mac_type The MAC address type of the device
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_device_set_mac_type()
- */
-int ua_device_get_mac_type(
-               ua_device_h device_handle,
-               ua_mac_type_e *mac_type) TIZEN_DEPRECATED_API;
-
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device's operating system info.
- * @since_tizen 6.5
- *
- * @param[in] device_handle The device handle
- * @param[out] os_info Device's operating system info.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_device_set_os_info()
- */
-int ua_device_get_os_info(
-               ua_device_h device_handle,
-               ua_os_type_e *os_info) TIZEN_DEPRECATED_API;
-
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets device's MAC address.
@@ -631,31 +535,6 @@ int ua_device_set_mac_address(
                ua_device_h device_handle,
                const char *mac_address) TIZEN_DEPRECATED_API;
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device's MAC address.
- * @since_tizen 6.5
- *
- * @remarks You must release @a mac_address using g_free().
- *
- * @param[in] device_handle The device handle
- * @param[out] mac_address The device's MAC address.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_device_set_mac_address()
- */
-int ua_device_get_mac_address(
-               ua_device_h device_handle,
-               char **mac_address) TIZEN_DEPRECATED_API;
-
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets device ID.
@@ -679,119 +558,6 @@ int ua_device_set_device_id(
                ua_device_h device_handle,
                const char *device_id) TIZEN_DEPRECATED_API;
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device ID.
- * @since_tizen 6.5
- *
- * @remarks You must release @a device_id using g_free().
- * @param[in] device_handle The device handle
- * @param[out] device_id The device ID.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @see ua_device_set_device_id()
- */
-int ua_device_get_device_id(
-               ua_device_h device_handle,
-               char **device_id) TIZEN_DEPRECATED_API;
-
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device's Wi-Fi BSSID.
- * @since_tizen 6.5
- *
- * @remarks You must release @a bssid using g_free().
- * @param[in] device_handle The device handle
- * @param[out] bssid The device's Wi-Fi BSSID.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_device_set_wifi_bssid()
- */
-int ua_device_get_wifi_bssid(
-               ua_device_h device_handle,
-               char **bssid) TIZEN_DEPRECATED_API;
-
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device's Wi-Fi IPv4 address.
- * @since_tizen 6.5
- *
- * @remarks You must release @a ipv4_address using g_free().
- *
- * @param[in] device_handle The device handle
- * @param[out] ipv4_address The device's Wi-Fi IPv4 address.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_device_set_wifi_ipv4_address()
- */
-int ua_device_get_wifi_ipv4_address(
-               ua_device_h device_handle,
-               char **ipv4_address) TIZEN_DEPRECATED_API;
-
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets last presence time for device handle.
- * @since_tizen 6.5
- *
- * @param[in] device_handle The device handle
- * @param[out] last_seen The last presence time for UA device
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- */
-int ua_device_get_last_presence(
-               ua_device_h device_handle,
-               unsigned long long *last_seen) TIZEN_DEPRECATED_API;
-
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets whether pairing is required for the user device.
- * @since_tizen 6.5
- *
- * @param[in] device_handle The device handle
- * @param[out] pairing_required TRUE if pairing is required, FALSE otherwise.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- */
-int ua_device_get_pairing_required(
-               ua_device_h device_handle,
-               bool *pairing_required) TIZEN_DEPRECATED_API;
-
 /**
  * @internal
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -868,29 +634,6 @@ int ua_device_clone(
                ua_device_h *cloned,
                ua_device_h origin) TIZEN_DEPRECATED_API;
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets account info for user handle.
- * @since_tizen 6.5
- *
- * @remarks You must release @a account using g_free().
- * @param[in] user_handle The user handle
- * @param[out] account  Account 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_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_user_set_account()
- */
-int ua_user_get_account(ua_user_h user_handle,
-               char **account) TIZEN_DEPRECATED_API;
-
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Gets user handle by account.
index 7b7f7a76691149aba92ab5bc2b73e5a611ede04f..5a514accd745ae5155120ed696a88af67e72f98c 100755 (executable)
@@ -481,43 +481,6 @@ typedef void (*ua_user_device_added_cb)(
                ua_device_h dev_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.
@@ -554,6 +517,29 @@ int ua_initialize(void);
  */
 int ua_deinitialize(void);
 
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Retrieves the service handle of all the added services.
+ * @since_tizen 6.5
+ *
+ * @param[in] foreach_cb Callback function to be invoked with service handle.
+ * @param[in] user_data The user data to be passed when callback is called.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_service_added_cb()
+ */
+int ua_foreach_services(
+               ua_service_added_cb foreach_cb,
+               void *user_data);
+
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Creates the ua monitor's handle.
@@ -1025,17 +1011,16 @@ int ua_user_add(ua_user_h user_handle);
  *
  * @see ua_user_add()
  */
-int ua_user_remove(
-               ua_user_h user_handle);
+int ua_user_remove(ua_user_h user_handle);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets user info for user handle.
+ * @brief Gets account info for user handle.
  * @since_tizen 6.5
  *
- * @remarks You must release user_info.
+ * @remarks You must release @a account using g_free().
  * @param[in] user_handle The user handle
- * @param[out] user_info The user information
+ * @param[out] account  Account information
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #UA_ERROR_NONE Successful
@@ -1049,8 +1034,7 @@ int ua_user_remove(
  *
  * @see ua_user_create()
  */
-int ua_user_get_information(ua_user_h user_handle,
-                       ua_user_information_s **user_info);
+int ua_user_get_account(ua_user_h user_handle, char **account);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1275,17 +1259,18 @@ int ua_service_get_default_service(
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets service info for service handle.
+ * @brief Gets service handle by service name.
  * @since_tizen 6.5
  *
- * @remarks You must release service_info.
- * @param[in] service_handle The service handle
- * @param[out] service_info The service information
+ * @remarks The @a service_handle should be destroyed by using #ua_service_destroy().
+ *
+ * @param[in] name The service name information
+ * @param[out] service_handle The service handle
  *
  * @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_OPERATION_FAILED Operation failed
  * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
  *
  * @exception
@@ -1294,46 +1279,43 @@ int ua_service_get_default_service(
  *
  * @see ua_service_create()
  */
-int ua_service_get_information(ua_service_h service_handle,
-                       ua_service_information_s **service_info);
+int ua_get_service_by_name(
+                       const char *name,
+                       ua_service_h *service_handle);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets service handle by service name.
+ * @brief Gets name info for service handle.
  * @since_tizen 6.5
  *
- * @remarks The @a service_handle should be destroyed by using #ua_service_destroy().
+ * @remarks You must release @a name using g_free().
  *
- * @param[in] name The service name information
- * @param[out] service_handle The service handle
+ * @param[in] service_handle The service handle
+ * @param[out] name The service name 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_OPERATION_FAILED Operation failed
  * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
  *
  * @exception
  * @pre
  * @post
  *
- * @see ua_service_create()
+ * @see ua_service_set_name()
  */
-int ua_get_service_by_name(
-                       const char *name,
-                       ua_service_h *service_handle);
+int ua_service_get_name(
+               ua_service_h service_handle,
+               char **name);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets user handle by account.
+ * @brief Sets detection threshold for service handle.
  * @since_tizen 6.5
  *
- * @remarks The @a user_handle should not be released.
- * @remarks The @a user_handle can be used only in the function.
- *
  * @param[in] service_handle The service handle
- * @param[in] account The user account information
- * @param[out] user_handle The user handle
+ * @param[in] presence_threshold The service presence threshold information
+ * @param[in] absence_threshold The service absence threshold information
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #UA_ERROR_NONE Successful
@@ -1345,17 +1327,19 @@ int ua_get_service_by_name(
  * @post
  *
  */
-int ua_service_get_user_by_account(ua_service_h service_handle,
-               const char* account, ua_user_h *user_handle);
+int ua_service_set_detection_threshold(
+               ua_service_h service_handle,
+               unsigned int presence_threshold,
+               unsigned int absence_threshold);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Sets detection threshold for service handle.
+ * @brief Gets detection threshold for service handle.
  * @since_tizen 6.5
  *
  * @param[in] service_handle The service handle
- * @param[in] presence_threshold The service presence threshold information
- * @param[in] absence_threshold The service absence threshold information
+ * @param[out] presence_threshold The service presence threshold information
+ * @param[out] absence_threshold The service absence threshold information
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #UA_ERROR_NONE Successful
@@ -1366,11 +1350,34 @@ int ua_service_get_user_by_account(ua_service_h service_handle,
  * @pre
  * @post
  *
+ * @see ua_service_set_detection_threshold()
  */
-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 *presence_threshold,
+               unsigned int *absence_threshold);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Sets name info for service handle.
+ * @since_tizen 6.5
+ *
+ * @param[in] service_handle The service handle
+ * @param[in] account The user account information
+ * @param[out] user_handle The user handle
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ */
+int ua_service_get_user_by_account(ua_service_h service_handle,
+               const char* account, ua_user_h *user_handle);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
@@ -1463,37 +1470,14 @@ int ua_service_set_device_discriminant(
  * @pre
  * @post
  *
- * @see ua_service_add_user()
- * @see ua_service_remove_user()
+ * @see ua_service_add_device()
+ * @see ua_service_remove_device()
  */
 int ua_service_get_device_discriminant(
                ua_service_h service_handle,
                ua_device_h device_handle,
                gboolean *discriminant);
 
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Retrieves the service handle of all the added services.
- * @since_tizen 6.5
- *
- * @param[in] foreach_cb Callback function to be invoked with service handle.
- * @param[in] user_data The user data to be passed when callback is called.
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #UA_ERROR_NONE Successful
- * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
- *
- * @exception
- * @pre
- * @post
- *
- * @see ua_service_added_cb()
- */
-int ua_foreach_services(
-               ua_service_added_cb foreach_cb,
-               void *user_data);
-
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Retrieves the user handle of all the added users for a specific service.
@@ -1572,6 +1556,28 @@ int ua_device_create(ua_mac_type_e mac_type,
 int ua_device_destroy(
                ua_device_h device_handle);
 
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets device type info from the device.
+ * @since_tizen 6.5
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] mac_type The MAC address type of the device
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_device_set_mac_type()
+ */
+int ua_device_get_mac_type(
+               ua_device_h device_handle,
+               ua_mac_type_e *mac_type);
+
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets device's operating system info.
@@ -1595,6 +1601,71 @@ int ua_device_set_os_info(
                ua_device_h device_handle,
                ua_os_type_e os);
 
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets device's operating system info.
+ * @since_tizen 6.5
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] os_info Device's operating system info.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_device_set_os_info()
+ */
+int ua_device_get_os_info(
+               ua_device_h device_handle,
+               ua_os_type_e *os_info);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets device's MAC address.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release @a mac_address using g_free().
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] mac_address The device's MAC address.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_device_set_mac_address()
+ */
+int ua_device_get_mac_address(
+               ua_device_h device_handle,
+               char **mac_address);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets device ID.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release @a device_id using g_free().
+ * @param[in] device_handle The device handle
+ * @param[out] device_id The device ID.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see ua_device_set_device_id()
+ */
+int ua_device_get_device_id(
+               ua_device_h device_handle,
+               char **device_id);
+
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets device's Wi-Fi BSSID.
@@ -1618,6 +1689,28 @@ int ua_device_set_wifi_bssid(
                ua_device_h device_handle,
                const char *bssid);
 
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets device's Wi-Fi BSSID.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release @a bssid using g_free().
+ * @param[in] device_handle The device handle
+ * @param[out] bssid The device's Wi-Fi BSSID.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_device_set_wifi_bssid()
+ */
+int ua_device_get_wifi_bssid(
+               ua_device_h device_handle,
+               char **bssid);
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Sets device's Wi-Fi IPv4 address.
@@ -1643,12 +1736,56 @@ int ua_device_set_wifi_ipv4_address(
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets device info for device handle.
+ * @brief Gets device's Wi-Fi IPv4 address.
+ * @since_tizen 6.5
+ *
+ * @remarks You must release @a ipv4_address using g_free().
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] ipv4_address The device's Wi-Fi IPv4 address.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_device_set_wifi_ipv4_address()
+ */
+int ua_device_get_wifi_ipv4_address(
+               ua_device_h device_handle,
+               char **ipv4_address);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets last presence time for device handle.
+ * @since_tizen 6.5
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] last_seen The last presence time for UA device
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ */
+int ua_device_get_last_presence(
+               ua_device_h device_handle,
+               unsigned long long *last_seen);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets whether pairing is required for the user device.
  * @since_tizen 6.5
  *
- * @remarks You must release device_info.
  * @param[in] device_handle The device handle
- * @param[out] device_info The device information
+ * @param[out] pairing_required TRUE if pairing is required, FALSE otherwise.
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #UA_ERROR_NONE Successful
@@ -1662,8 +1799,9 @@ int ua_device_set_wifi_ipv4_address(
  *
  * @see ua_device_create()
  */
-int ua_device_get_information(ua_device_h device_handle,
-                       ua_dev_information_s **device_info);
+int ua_device_get_pairing_required(
+               ua_device_h device_handle,
+               bool *pairing_required);
 
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
index b1a2fb13d2f21de849f1ec73971b223d971251e8..219f8c9863ec0c152342544b26e37dc04c2d0d4a 100755 (executable)
@@ -533,7 +533,6 @@ 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);
 
@@ -710,6 +709,7 @@ 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,7 +726,6 @@ 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);
@@ -760,7 +759,6 @@ 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);
@@ -778,7 +776,6 @@ 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);
@@ -810,7 +807,6 @@ 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);
@@ -842,7 +838,6 @@ 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);
@@ -876,7 +871,6 @@ 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);
@@ -1212,7 +1206,6 @@ 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);
@@ -1253,39 +1246,3 @@ 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 ad100245cd15f7d30cb63ae07d6e694691aaf233..acca08a7d8404f6b948d84dc1dac0afc258cb569 100755 (executable)
@@ -517,7 +517,6 @@ 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);
@@ -543,7 +542,6 @@ 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);
@@ -630,8 +628,9 @@ int ua_service_get_by_name(const char *name, ua_service_h *service_handle)
        GSList *l;
        ua_service_info_s *s;
 
-       UA_DEPRECATED_LOG(__FUNCTION__, "ua_get_service_by_name");
        UA_CHECK_INIT_STATUS();
+       UA_DEPRECATED_LOG(__FUNCTION__, "ua_get_service_by_name");
+
        UA_VALIDATE_INPUT_PARAMETER(name);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
 
@@ -992,6 +991,7 @@ 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,32 +1095,3 @@ 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 702a032672ddb2de44f6a7e4d8352cdc8ee2a810..7df9c924ce7b03f7777cbc55d7e367ee169ddc11 100755 (executable)
@@ -652,44 +652,12 @@ 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);
diff --git a/test/.uat-users.c.swp b/test/.uat-users.c.swp
new file mode 100644 (file)
index 0000000..0875a35
Binary files /dev/null and b/test/.uat-users.c.swp differ
index 22bda1c2f7ff9f5ffd5b1ef5a7a89c31de769565..1cda8d2d25fa7433fc0e5afc638147522cbaa56c 100755 (executable)
@@ -47,15 +47,23 @@ 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;
-       ua_dev_information_s *device = NULL;
+       char *mac = NULL;
+       ua_mac_type_e mac_type;
 
-       ret = ua_device_get_information(device_handle, &device);
+       ret = ua_device_get_mac_address(device_handle, &mac);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_device_get_information() ret: [0x%X] [%s]",
+               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]",
                        ret, uat_get_error_str(ret));
        }
        msgb("[%s] Presence detected on [%s]",
-             uat_convert_device_mac_type_to_txt(device->type), device->mac);
+             uat_convert_device_mac_type_to_txt(mac_type), mac);
+
+       g_free(mac);
 }
 
 static void __sensor_detected_sensor_info(int type,
@@ -87,18 +95,14 @@ void _sensor_presence_detected_cb(int result, ua_monitor_h monitor,
        msgb("\n[%s]", pbuf);
        free(pbuf);
        int ret;
-       ua_service_information_s* service = NULL;
+       char *service_name = NULL;
 
-       ret = ua_service_get_information(g_service_h, &service);
+       ret = ua_service_get_name(g_service_h, &service_name);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_information() ret: [0x%X] [%s]",
+               msg(" - ua_service_get_name() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
        }
-       msgb("Presence detected for service [%s]", service->name);
-       if (service)
-               g_free(service->name);
-       g_free(service);
-
+       msgb("Presence detected for service [%s]", service_name);
 
        if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
                msgb("[%s] PRESENCE detected [%s]",
@@ -133,17 +137,14 @@ void _sensor_absence_detected_cb(int result, ua_monitor_h monitor,
        msgp("\n[%s]", pbuf);
        free(pbuf);
        int ret;
-       ua_service_information_s* service = NULL;
+       char *service_name = NULL;
 
-       ret = ua_service_get_information(g_service_h, &service);
+       ret = ua_service_get_name(g_service_h, &service_name);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_information() ret: [0x%X] [%s]",
+               msg(" - ua_service_get_name() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
        }
-       msgb("Absence detected for service [%s]", service->name);
-       if (service)
-               g_free(service->name);
-       g_free(service);
+       msgb("Absence detected for service [%s]", service_name);
 
        if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
                msgp("[%s] ABSENCE detected [%s]",
index 5ae9687c7c830fda22287b23f693834ab63c3095..784f3323ab58442dd738f515f1cd35c7b7508fa1 100755 (executable)
@@ -55,42 +55,76 @@ extern int g_device_count; /**< Seletected service name */
 bool _foreach_added_device_cb(
        ua_device_h device_handle, void *user_data)
 {
-       int ret_temp;
+       int ret, ret_temp;
        ua_device_h handle = NULL;
-       ua_dev_information_s *device = 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() result: [0x%X] [%s]",
+                       ret, uat_get_error_str(ret));
+       }
+
        msgb("\n[%d]", ++g_device_count);
 
-       ret_temp = ua_device_get_information(device_handle, &device);
+       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);
        if (UA_ERROR_NONE == ret_temp) {
-               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);
+                       ostype == 1 ? "Tizen" :
+                       ostype == 2 ? "Android" :
+                       ostype == 3 ? "iOS" : "N/A");
        }
 
-       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);
+       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);
        }
-       g_free(device);
+
+       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);
 
        return true;
 }
@@ -98,41 +132,65 @@ bool _foreach_added_device_cb(
 void uat_update_device_info(void)
 {
        int ret = UA_ERROR_NONE;
-       ua_dev_information_s *device = 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;
 
        check_if(NULL == g_device_h);
 
-       ret = ua_device_get_information(g_device_h, &device);
+       ret = ua_device_get_mac_type(g_device_h, &mac_type);
        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(device->type));
+                       uat_get_mac_type_str(mac_type));
                snprintf(g_device_type, MENU_DATA_SIZE, "%d",
-                       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");
+                       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) {
                memset(g_device_id_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_device_id_str, device->device_id, MENU_DATA_SIZE);
+               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) {
                memset(g_mac_addr_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_mac_addr_str, device->mac, MENU_DATA_SIZE);
+               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) {
                memset(g_bss_id_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_bss_id_str, device->bssid, MENU_DATA_SIZE);
+               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) {
                memset(g_ipv4_address_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_ipv4_address_str, device->ipv4, MENU_DATA_SIZE);
+               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) {
                memset(g_is_paring_required_str, 0, MENU_DATA_SIZE + 1);
                memcpy(g_is_paring_required_str,
-                       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);
+                       required ? "YES" : "NO ", sizeof("YES"));
        }
-       g_free(device);
 
 }
 
index 1120753b2dea284388b893464fe59ae4b9fad30e..4b44c09833c66f4b1b6c37ddad26c36eba2df3d1 100755 (executable)
@@ -278,6 +278,9 @@ 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 0610925b9562b206cc080ae294710981682c3323..492bb5e705fc3a7cbf8bd3ff2a9e143f3e947edb 100755 (executable)
@@ -56,16 +56,14 @@ static bool _service_foreach_added_user_cb(
        int ret = UA_ERROR_NONE;
 
        ua_user_h handle = NULL;
-       ua_user_information_s *user = NULL;
-       ua_service_information_s *service = NULL;
+       char *service_name = NULL;
+       char *account = NULL;
 
-       ret = ua_service_get_information(service_handle, &service);
+       ret = ua_service_get_name(service_handle, &service_name);
        if (UA_ERROR_NONE == ret)
-               msgp("Cur. Service name : %s\n", service->name);
+               msgp("Cur. Service name : %s\n", service_name);
 
-       if (service)
-               g_free(service->name);
-       g_free(service);
+       g_free(service_name);
 
        if (!user_handle) {
                msgr("user_handle is NULL");
@@ -81,16 +79,12 @@ static bool _service_foreach_added_user_cb(
        user_list = g_slist_append(user_list, handle);
        idx_user++;
 
-       ret = ua_user_get_information(handle, &user);
+       ret = ua_user_get_account(handle, &account);
        if (UA_ERROR_NONE == ret) {
                msglr("[%d]", idx_user);
-               msglr("User account info %s", user->account);
+               msglr("User account info %s", account);
+               g_free(account);
        }
-       if (user) {
-               g_free(user->account);
-               g_free(user->name);
-       }
-       g_free(user);
 
        return true;
 }
@@ -98,7 +92,7 @@ static bool _service_foreach_added_user_cb(
 static void __update_service_info(void)
 {
        int ret = UA_ERROR_NONE;
-       ua_service_information_s *service = NULL;
+       char *name = NULL;
 
        if (1 == g_service_count) {
                if (g_service_h) {
@@ -109,16 +103,12 @@ static void __update_service_info(void)
                ua_service_get_default_service(&g_service_h);
        }
 
-       ret = ua_service_get_information(g_service_h, &service);
+       ret = ua_service_get_name(g_service_h, &name);
        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, service->name, MENU_DATA_SIZE);
+               memcpy(g_service_str, name, MENU_DATA_SIZE);
+               g_free(name);
        }
-
-       if (service)
-               g_free(service->name);
-       g_free(service);
 }
 
 static void  ___free_service(gpointer data)
@@ -139,28 +129,38 @@ bool _foreach_added_service_cb(
        ua_service_h service_handle, void *user_data)
 {
        int ret = UA_ERROR_NONE;
-       ua_service_information_s *service = NULL;
+       char *name = NULL;
+       unsigned int presence_threshold = 0;
+       unsigned int absence_threshold = 0;
 
        if (NULL == service_handle) {
                msgr("service_handle is NULL");
                return true;
        }
 
-       ret = ua_service_get_information(service_handle, &service);
+       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);
        if (UA_ERROR_NONE != ret) {
-               msg(" - ua_service_get_information() ret: [0x%X] [%s]",
+               msg(" - ua_service_get_detection_threshold() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
+               g_free(name);
                return RET_SUCCESS;
        }
 
-       msgr("[%d] %s ", ++g_service_count, service->name);
+       msgr("[%d] %s ", ++g_service_count, name);
        msgr("presence threshold :[%d] absence threshold :[%d]",
-               service->presence_threshold, service->absence_threshold);
+                       presence_threshold, absence_threshold);
 
        g_service_list = g_slist_append(g_service_list, service_handle);
-       if (service)
-               g_free(service->name);
-       g_free(service);
+
+       g_free(name);
 
        return true;
 }
@@ -171,52 +171,84 @@ static bool _service_foreach_added_device_cb(
        int ret = UA_ERROR_NONE;
        int ret_temp = UA_ERROR_NONE;
        ua_device_h handle = NULL;
-       ua_service_information_s *service = NULL;
-       ua_dev_information_s *device = 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;
 
        if (!service_handle) {
                msgr("service_handle is NULL");
                return true;
        }
 
-       ret = ua_service_get_information(service_handle, &service);
+       ret = ua_service_get_name(service_handle, &service_name);
        if (UA_ERROR_NONE == ret)
-               msgp("Cur. Service name : %s\n", service->name);
-
-       if (service)
-               g_free(service->name);
-       g_free(service);
+               msgb("Cur. Service name : %s", service_name);
+       g_free(service_name);
 
        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 = ua_device_get_information(g_device_h, &device);
+       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);
        if (UA_ERROR_NONE == ret_temp) {
-               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);
+                       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);
        }
-       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_mac_address(handle, &mac);
+       if (UA_ERROR_NONE == ret_temp) {
+               msgb("Device MAC : %s", mac);
+               g_free(mac);
        }
-       g_free(device);
+
+       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);
 
index 69c030f18aabd141ffd742eb499f27209910ad56..87144b894b95022d7021d28a22fae76d89b16487 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;
-       ua_user_information_s *user = NULL;
+       char *account = NULL;
 
        if (0 == idx_user) {
                if (g_user_h) {
@@ -64,16 +64,12 @@ static void update_user_info(void)
                ua_get_default_user(&g_user_h);
        }
 
-       ret  = ua_user_get_information(g_user_h, &user);
+       ret  = ua_user_get_account(g_user_h, &account);
        if (UA_ERROR_NONE == ret) {
                memset(g_user_account_str, 0, MENU_DATA_SIZE + 1);
-               memcpy(g_user_account_str, user->account, MENU_DATA_SIZE);
+               memcpy(g_user_account_str, account, MENU_DATA_SIZE);
+               g_free(account);
        }
-       if (user) {
-               g_free(user->account);
-               g_free(user->name);
-       }
-       g_free(user);
 }
 
 static void  ___free_users(gpointer data)
@@ -95,7 +91,7 @@ bool _foreach_registered_user_cb(
 {
        int ret = UA_ERROR_NONE;
        ua_user_h handle = NULL;
-       ua_user_information_s *user = NULL;
+       char *account = NULL;
 
        if (!user_handle) {
                msgr("user_handle is NULL");
@@ -111,16 +107,12 @@ bool _foreach_registered_user_cb(
        user_list = g_slist_append(user_list, handle);
        idx_user++;
 
-       ret = ua_user_get_information(handle, &user);
+       ret = ua_user_get_account(handle, &account);
        if (UA_ERROR_NONE == ret) {
                msglr("[%d]", idx_user);
-               msglr("User account info %s", user->account);
-       }
-       if (user) {
-               g_free(user->account);
-               g_free(user->name);
+               msglr("User account info %s", account);
+               g_free(account);
        }
-       g_free(user);
 
        return true;
 }
@@ -128,37 +120,45 @@ bool _foreach_registered_user_cb(
 void _print_device_info(ua_device_h handle)
 {
        int ret;
-       ua_dev_information_s *device = 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 *ipv4 = NULL;
 
        if (NULL == handle) {
                msgr("Device handle is NULL");
                return;
        }
 
-       ret = ua_device_get_information(handle, &device);
+       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) {
-               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);
+               msg("Device ID : %s", device_id);
+               g_free(device_id);
        }
-       if (device) {
-               g_free(device->device_id);
-               g_free(device->mac);
-               g_free(device->bssid);
-               g_free(device->ipv4);
-               g_free(device->ipv6);
+
+       ret = ua_device_get_mac_address(handle, &mac);
+       if (UA_ERROR_NONE == ret) {
+               msg("Device MAC : %s", mac);
+               g_free(mac);
+       }
+
+       ret = ua_device_get_wifi_ipv4_address(handle, &ipv4);
+       if (UA_ERROR_NONE == ret) {
+               msg("Device IPv4 Addr : %s", ipv4);
+               g_free(ipv4);
        }
-       g_free(device);
 }
 
 static void __device_added_cb(int result,
@@ -177,16 +177,15 @@ static void __device_added_cb(int result,
 static bool _user_foreach_added_device_cb(ua_device_h device_handle,
        void *user_data)
 {
-       ua_device_h handle = NULL;
-
        if (!device_handle) {
                msgr("device_handle is NULL");
                return true;
        }
+
        msgc("\n[%d]", ++g_device_count);
 
        _print_device_info(device_handle);
-       g_device_list = g_slist_append(g_device_list, handle);
+       g_device_list = g_slist_append(g_device_list, device_handle);
 
        return true;
 }