summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrohit singh <rohit.singh@samsung.com>2021-05-01 16:20:05 +0530
committerrohit singh <rohit.singh@samsung.com>2021-05-04 22:29:21 +0530
commit37260d1e8f740155ca7f5a8fddf3def4bcad0653 (patch)
tree98760e5b7e76c35f861e529322064ed66ead54ef
parentbd3485098164796094b4e17f813600214d065687 (diff)
downloaduser-awareness-37260d1e8f740155ca7f5a8fddf3def4bcad0653.tar.gz
user-awareness-37260d1e8f740155ca7f5a8fddf3def4bcad0653.tar.bz2
user-awareness-37260d1e8f740155ca7f5a8fddf3def4bcad0653.zip
Remove Deprecated API
ua_device_set_discriminant() ua_user_clone() ua_user_remove_device_by_device_id() ua_user_set_account() ua_user_set_name() ua_service_set_name() -> ua_service_create() ua_device_clone() Change-Id: I2a66b9968497c50e879fbffa81be4d10b150e120
-rwxr-xr-xsrc/user-awareness-device.c10
-rwxr-xr-xtests/test/uat-devices.c61
-rwxr-xr-xtests/test/uat-scenarios.c30
-rwxr-xr-xtests/test/uat-service.c47
-rwxr-xr-xtests/test/uat-users.c79
5 files changed, 37 insertions, 190 deletions
diff --git a/src/user-awareness-device.c b/src/user-awareness-device.c
index 2755438..d564045 100755
--- a/src/user-awareness-device.c
+++ b/src/user-awareness-device.c
@@ -235,21 +235,13 @@ int _ua_is_device_exist(char *device_id, char *mac, ua_mac_type_e type,
int _ua_device_add_info_to_list(ua_dev_info_s* dev_info)
{
FUNC_ENTRY;
- int ret;
- ua_dev_info_s* device_info;
UA_VALIDATE_INPUT_PARAMETER(dev_info);
if (NULL != _ua_get_device_from_list(
dev_info->device_id, dev_info->mac, dev_info->type))
return UA_ERROR_ALREADY_DONE; // LCOV_EXCL_LINE
- ret = ua_device_clone((ua_device_h)&device_info, dev_info);
- if (UA_ERROR_NONE != ret) {
- UA_ERR("ua_device_clone failed [%s]", _ua_get_error_string(ret));
- return ret;
- }
-
- ua_devices_list = g_slist_append(ua_devices_list, device_info);
+ ua_devices_list = g_slist_append(ua_devices_list, dev_info);
FUNC_EXIT;
return UA_ERROR_NONE;
diff --git a/tests/test/uat-devices.c b/tests/test/uat-devices.c
index 3f8bfb5..8be6ecc 100755
--- a/tests/test/uat-devices.c
+++ b/tests/test/uat-devices.c
@@ -41,7 +41,6 @@ char g_os_type_str[MENU_DATA_SIZE + 1] = { "Android" }; /**< Readable OS type st
char g_device_id_str[MENU_DATA_SIZE + 1] = {0,}; /**< Mobile ID of the selected device */
char g_mac_addr_str[MENU_DATA_SIZE + 1] = {0,}; /**< MAC of the selected device */
static char g_bss_id_str[MENU_DATA_SIZE + 1] = {0,}; /**< BSSID of the selected device */
-static char g_discriminant[MENU_DATA_SIZE + 1] = {"1",}; /**< Discrimniant for a device */
static char g_ipv4_address_str[MENU_DATA_SIZE + 1] = {0,}; /**< IPv4 of the selected device */
static char g_is_paring_required_str[MENU_DATA_SIZE + 1] = {0,}; /**< Is paring required for the selected device */
@@ -55,8 +54,7 @@ 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;
- ua_device_h handle = NULL;
+ int ret_temp;
ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
ua_os_type_e ostype = UA_OS_TYPE_NOT_DEFINED;
@@ -72,19 +70,13 @@ bool _foreach_added_device_cb(
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);
+ ret_temp = ua_device_get_mac_type(device_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_os_info(device_handle, &ostype);
if (UA_ERROR_NONE == ret_temp) {
msgb("Device OS Type : %s",
ostype == 1 ? "Tizen" :
@@ -92,39 +84,39 @@ bool _foreach_added_device_cb(
ostype == 3 ? "iOS" : "N/A");
}
- ret_temp = ua_device_get_device_id(handle, &device_id);
+ ret_temp = ua_device_get_device_id(device_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);
+ ret_temp = ua_device_get_mac_address(device_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);
+ ret_temp = ua_device_get_wifi_bssid(device_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);
+ ret_temp = ua_device_get_wifi_ipv4_address(device_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);
+ ret_temp = ua_device_get_pairing_required(device_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);
+ ret_temp = ua_device_get_last_presence(device_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);
+ g_device_list = g_slist_append(g_device_list, device_handle);
return true;
}
@@ -290,29 +282,6 @@ static int run_ua_device_get_wifi_bssid(
return RET_SUCCESS;
}
-static int run_ua_device_set_discriminant(
- MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
- int temp = 0;
- bool discriminant = false;
-
- msg("ua_device_set_discriminant");
-
- if (strlen(g_discriminant))
- temp = (unsigned char)strtol(g_discriminant, NULL, 10);
-
- if (0 != temp)
- discriminant = true;
-
- ret = ua_device_set_discriminant(g_device_h, discriminant);
-
- msg(" - ua_device_set_discriminant() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_device_set_wifi_ipv4_address(
MManager *mm, struct menu_data *menu)
{
@@ -438,14 +407,6 @@ static struct menu_data menu_ua_ipv4_address[] = {
{ NULL, NULL, },
};
-static struct menu_data menu_ua_discrminiant[] = {
- { "1", "discriminant (0: Disable 1: Enable)",
- NULL, NULL, g_discriminant },
- { "2", "run", NULL,
- run_ua_device_set_discriminant, NULL },
- { NULL, NULL, },
-};
-
static struct menu_data menu_ua_devlist_by_mac[] = {
{ "1", "MAC",
NULL, NULL, g_mac_addr_str },
@@ -471,8 +432,6 @@ struct menu_data menu_ua_devices[] = {
NULL, run_ua_device_destroy, NULL },
{ "3", "ua_device_set_os_info",
menu_ua_os_type, NULL, g_os_type_str },
- { "4", "ua_device_set_discriminant",
- menu_ua_discrminiant, NULL, g_discriminant},
{ "5", "ua_device_set_wifi_ipv4_address",
menu_ua_ipv4_address, NULL, g_ipv4_address_str },
{ "11", "ua_device_get_wifi_bssid",
diff --git a/tests/test/uat-scenarios.c b/tests/test/uat-scenarios.c
index f45f8d9..e29a153 100755
--- a/tests/test/uat-scenarios.c
+++ b/tests/test/uat-scenarios.c
@@ -57,14 +57,10 @@ static int __uat_scenario_service_startup()
char *svc_name = NULL;
int detection_cycle = 60;
- /* create service handle */
- ret = _uat_service_create();
- retv_if(ret != UA_ERROR_NONE, ret);
-
- /* set service name */
svc_name = g_strndup("ua.scenerio.service1", MENU_DATA_SIZE);
- check_if(NULL == g_service_h);
- ret = ua_service_set_name(g_service_h, svc_name);
+
+ /* create service handle */
+ ret = _uat_service_create(svc_name);
retv_if(ret != UA_ERROR_NONE, ret);
/* Add service */
@@ -99,22 +95,11 @@ static int __uat_scenario_user_startup()
{
int ret = UA_ERROR_NONE;
char *user_account = NULL;
- char *user_name = NULL;
- /* create user handle */
- ret = _uat_user_create();
- retv_if(ret != UA_ERROR_NONE, ret);
-
- /* set user account */
user_account = g_strndup("ua.scenerio.account1", MENU_DATA_SIZE);
- check_if(NULL == g_user_h);
- ret = ua_user_set_account(g_user_h, user_account);
- retv_if(ret != UA_ERROR_NONE, ret);
- /* set user name */
- user_name = g_strndup("ua.scenerio.user1", MENU_DATA_SIZE);
- check_if(NULL == g_user_h);
- ret = ua_user_set_name(g_user_h, user_name);
+ /* create user handle */
+ ret = _uat_user_create(user_account);
retv_if(ret != UA_ERROR_NONE, ret);
/* Add user */
@@ -138,12 +123,9 @@ static int __uat_scenario_user_startup()
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);
-
- memset(g_user_name_str, 0, MENU_DATA_SIZE + 1);
- memcpy(g_user_name_str, user_name, MENU_DATA_SIZE);
}
+
g_free(user_account);
- g_free(user_name);
return ret;
}
diff --git a/tests/test/uat-service.c b/tests/test/uat-service.c
index 750e08f..95fecd0 100755
--- a/tests/test/uat-service.c
+++ b/tests/test/uat-service.c
@@ -55,7 +55,6 @@ static bool _service_foreach_added_user_cb(
{
int ret = UA_ERROR_NONE;
- ua_user_h handle = NULL;
char *service_name = NULL;
char *account = NULL;
@@ -70,16 +69,10 @@ static bool _service_foreach_added_user_cb(
return true;
}
- ret = ua_user_clone(&handle, user_handle);
- if (UA_ERROR_NONE != ret) {
- msgr("ua_user_clone() result: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
- }
-
- user_list = g_slist_append(user_list, handle);
+ user_list = g_slist_append(user_list, user_handle);
idx_user++;
- ret = ua_user_get_account(handle, &account);
+ ret = ua_user_get_account(user_handle, &account);
if (UA_ERROR_NONE == ret) {
msglr("[%d]", idx_user);
msglr("User account info %s", account);
@@ -170,7 +163,6 @@ static bool _service_foreach_added_device_cb(
{
int ret = UA_ERROR_NONE;
int ret_temp = UA_ERROR_NONE;
- ua_device_h handle = NULL;
char *service_name = NULL;
ua_mac_type_e mac_type = UA_MAC_TYPE_INVALID;
@@ -197,20 +189,13 @@ static bool _service_foreach_added_device_cb(
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);
+ ret_temp = ua_device_get_mac_type(device_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_os_info(device_handle, &ostype);
if (UA_ERROR_NONE == ret_temp) {
msgb("Device OS Type : %s",
ostype == 1 ? "Tizen" :
@@ -218,39 +203,39 @@ static bool _service_foreach_added_device_cb(
ostype == 3 ? "iOS" : "N/A");
}
- ret_temp = ua_device_get_device_id(handle, &device_id);
+ ret_temp = ua_device_get_device_id(device_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);
+ ret_temp = ua_device_get_mac_address(device_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);
+ ret_temp = ua_device_get_wifi_bssid(device_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);
+ ret_temp = ua_device_get_wifi_ipv4_address(device_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);
+ ret_temp = ua_device_get_pairing_required(device_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);
+ ret_temp = ua_device_get_last_presence(device_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);
+ g_device_list = g_slist_append(g_device_list, device_handle);
return true;
}
@@ -286,7 +271,7 @@ static int uat_select_service(MManager *mm, struct menu_data *menu)
return RET_SUCCESS;
}
-int _uat_service_create()
+int _uat_service_create(char * service_str)
{
int ret = UA_ERROR_NONE;
@@ -297,7 +282,7 @@ int _uat_service_create()
g_service_h = NULL;
}
- ret = ua_service_create(g_service_str, &g_service_h);
+ ret = ua_service_create(service_str, &g_service_h);
msg(" - ua_service_create() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
@@ -308,7 +293,7 @@ int _uat_service_create()
static int run_ua_service_create(
MManager *mm, struct menu_data *menu)
{
- _uat_service_create();
+ _uat_service_create(g_service_str);
return RET_SUCCESS;
}
@@ -680,8 +665,6 @@ static struct menu_data menu_ua_service_add_user[] = {
NULL, NULL, g_service_str},
{ "-", "user account",
NULL, NULL, g_user_account_str},
- { "-", "user name",
- NULL, NULL, g_user_name_str},
{ "1", "run", NULL,
run_ua_service_add_user, NULL },
{ NULL, NULL, },
@@ -692,8 +675,6 @@ static struct menu_data menu_ua_service_remove_user[] = {
NULL, NULL, g_service_str},
{ "-", "user account",
NULL, NULL, g_user_account_str},
- { "-", "user name",
- NULL, NULL, g_user_name_str},
{ "1", "run", NULL,
run_ua_service_remove_user, NULL },
{ NULL, NULL, },
diff --git a/tests/test/uat-users.c b/tests/test/uat-users.c
index 5924300..918ac71 100755
--- a/tests/test/uat-users.c
+++ b/tests/test/uat-users.c
@@ -89,8 +89,7 @@ void uat_clear_user_list(void)
bool _foreach_registered_user_cb(
ua_user_h user_handle, void *user_data)
{
- int ret = UA_ERROR_NONE;
- ua_user_h handle = NULL;
+ int ret;
char *account = NULL;
if (!user_handle) {
@@ -98,16 +97,10 @@ bool _foreach_registered_user_cb(
return true;
}
- ret = ua_user_clone(&handle, user_handle);
- if (UA_ERROR_NONE != ret) {
- msgr("ua_user_clone() result: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
- }
-
- user_list = g_slist_append(user_list, handle);
+ user_list = g_slist_append(user_list, user_handle);
idx_user++;
- ret = ua_user_get_account(handle, &account);
+ ret = ua_user_get_account(user_handle, &account);
if (UA_ERROR_NONE == ret) {
msglr("[%d]", idx_user);
msglr("User account info %s", account);
@@ -220,7 +213,7 @@ int uat_select_user(MManager *mm, struct menu_data *menu)
return RET_SUCCESS;
}
-int _uat_user_create()
+int _uat_user_create(char* user_account_str)
{
int ret = UA_ERROR_NONE;
@@ -231,7 +224,7 @@ int _uat_user_create()
g_user_h = NULL;
}
- ret = ua_user_create(g_user_account_str, &g_user_h);
+ ret = ua_user_create(user_account_str, &g_user_h);
msg(" - ua_user_create() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
@@ -241,7 +234,7 @@ int _uat_user_create()
static int run_ua_user_create(MManager *mm, struct menu_data *menu)
{
- _uat_user_create();
+ _uat_user_create(g_user_account_str);
return RET_SUCCESS;
}
@@ -263,22 +256,6 @@ static int run_ua_user_destroy(MManager *mm, struct menu_data *menu)
return RET_SUCCESS;
}
-static int run_ua_user_set_name(MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
-
- msg("ua_user_set_name");
-
- check_if(NULL == g_user_h);
-
- ret = ua_user_set_name(g_user_h, g_user_name_str);
-
- msg(" - ua_user_set_name() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_user_add(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
@@ -405,28 +382,6 @@ static int run_ua_user_remove_device(
return RET_SUCCESS;
}
-static int run_ua_user_remove_device_by_device_id(
- MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
- uat_mac_type_e idx = UAT_MAC_TYPE_MAX;
-
- msg("ua_user_remove_device_by_device_id");
-
- if (strlen(g_device_type))
- idx = (unsigned char)strtol(g_device_type, NULL, 10);
-
- msgb("idx [%d] mac_type[%d]", idx, uat_convert_idx_to_device_type(idx));
-
- ret = ua_user_remove_device_by_device_id(g_device_id_str,
- uat_convert_idx_to_device_type(idx));
-
- msg(" - ua_user_remove_device_by_device_id() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_user_foreach_devices(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
@@ -495,14 +450,6 @@ static struct menu_data menu_ua_user_create[] = {
{ NULL, NULL, },
};
-static struct menu_data menu_ua_user_name[] = {
- { "1", "name",
- NULL, NULL, g_user_name_str },
- { "2", "run", NULL,
- run_ua_user_set_name, NULL },
- { NULL, NULL, },
-};
-
static struct menu_data menu_ua_service_get_user_by_account[] = {
{ "1", "account",
NULL, NULL, g_user_account_str},
@@ -518,16 +465,6 @@ struct menu_data menu_sel_added_user[] = {
{ NULL, NULL, },
};
-static struct menu_data menu_ua_rm_dev_by_device_id[] = {
- { "1", "type (1:BT 2:BLE 3:Wi-Fi 4:P2P)",
- NULL, NULL, g_device_type },
- { "2", "device_id",
- NULL, NULL, g_device_id_str },
- { "3", "run", NULL,
- run_ua_user_remove_device_by_device_id, NULL },
- { NULL, NULL, },
-};
-
struct menu_data menu_ua_user_added_devlist[] = {
{ "1", "Device list", NULL,
run_ua_user_foreach_devices, g_selected_device_idx},
@@ -540,8 +477,6 @@ struct menu_data menu_ua_users[] = {
menu_ua_user_create, NULL, NULL },
{ "2", "ua_user_destroy",
NULL, run_ua_user_destroy, NULL },
- { "3", "ua_user_set_name",
- menu_ua_user_name, NULL, g_user_name_str },
{ "4", "ua_user_add",
NULL, run_ua_user_add, NULL },
{ "5", "ua_user_remove",
@@ -556,8 +491,6 @@ struct menu_data menu_ua_users[] = {
NULL, run_ua_user_add_device, NULL },
{ "12", ANSI_COLOR_LIGHTRED "ua_user_remove_device" ANSI_COLOR_NORMAL,
NULL, run_ua_user_remove_device, NULL },
- { "13", "ua_user_remove_device_by_device_id",
- menu_ua_rm_dev_by_device_id, NULL, NULL },
{ "14", ANSI_COLOR_LIGHTMAGENTA "ua_user_foreach_devices" ANSI_COLOR_NORMAL,
menu_ua_user_added_devlist, NULL, NULL },
{ NULL, NULL, },