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.
*
* @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
*
* @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
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.
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
*/
int ua_service_get_name(
ua_service_h service_handle,
- char **name);
+ char **name) TIZEN_DEPRECATED_API;
/**
* @ingroup CAPI_NETWORK_UA_MODULE
* @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,
* @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,
*/
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
*/
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
*/
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
*/
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
*/
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.
*/
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
*/
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
*/
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
{
FUNC_ENTRY;
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_get_information");
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(handle);
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;
{
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);
{
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);
{
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);
{
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);
{
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);
{
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);
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);
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;
+}
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);
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);
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);
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);
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;
+}
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);
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,
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]",
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]",
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;
}
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);
}
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,
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");
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;
}
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) {
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)
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;
}
{
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);
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) {
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)
{
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");
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;
}
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,
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;