diff options
author | Lokesh <l.kasana@samsung.com> | 2019-08-01 15:37:17 +0530 |
---|---|---|
committer | saerome.kim <saerome.kim@samsung.com> | 2019-08-09 17:30:54 +0900 |
commit | 6380d3c14c8ac285b5cb6497286fbb553da74b8b (patch) | |
tree | cb64bcd8aa5c1f7a3aaaedbace57ea541e78d74c /test | |
parent | 7a26a847bbd366b5fa69a256196d58b22eedae12 (diff) | |
download | user-awareness-6380d3c14c8ac285b5cb6497286fbb553da74b8b.tar.gz user-awareness-6380d3c14c8ac285b5cb6497286fbb553da74b8b.tar.bz2 user-awareness-6380d3c14c8ac285b5cb6497286fbb553da74b8b.zip |
Added support for device->payload
Set/Get APIs for payload
Change-Id: I34676603d8ce2d8c96a5d5f3820fd443ec7ff035
Signed-off-by: Lokesh <l.kasana@samsung.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/uat-devices.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/uat-devices.c b/test/uat-devices.c index 5308ddb..d3208b4 100644 --- a/test/uat-devices.c +++ b/test/uat-devices.c @@ -43,6 +43,7 @@ static char g_bss_id_str[MENU_DATA_SIZE + 1] = {0,}; /**< BSSID of the selected 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 */ +static char g_payload_str[MENU_DATA_SIZE + 1] = {0,}; /**< payload for the selected device */ static char g_id_mac_addr_str[MENU_DATA_SIZE + 1] = {0,}; /**< Find device by MAC address */ static char g_id_mobile_id_str[MENU_DATA_SIZE + 1] = {0,}; /**< Find device by mobile ID */ @@ -88,6 +89,7 @@ static bool __foreach_added_device_cb( bool required = false; long timestamp = 0; bool discriminant = false; + char *payload = NULL; if (device_handle) { ua_device_h handle = NULL; @@ -145,6 +147,12 @@ static bool __foreach_added_device_cb( if (UA_ERROR_NONE == ret_temp) msgb("Last present at : %ld", timestamp); + ret_temp = ua_device_get_payload(handle, &payload); + if (UA_ERROR_NONE == ret_temp) { + msgb("payload : %s", payload); + g_free(payload); + } + g_device_list = g_slist_append(g_device_list, handle); } } @@ -166,6 +174,8 @@ static bool __service_foreach_added_device_cb( char *ipv4 = NULL; bool required = false; bool discriminant = false; + long timestamp = 0; + char *payload = NULL; ret = ua_service_get_name(service_tmp, &service_name); if (UA_ERROR_NONE == ret) @@ -222,6 +232,16 @@ static bool __service_foreach_added_device_cb( if (UA_ERROR_NONE == ret_temp) msgb("Discriminant : %s", discriminant ? "Enabled" : "Disabled"); + ret_temp = ua_device_get_last_presence(handle, ×tamp); + if (UA_ERROR_NONE == ret_temp) + msgb("Last present at : %ld", timestamp); + + ret_temp = ua_device_get_payload(handle, &payload); + if (UA_ERROR_NONE == ret_temp) { + msgb("payload : %s", payload); + g_free(payload); + } + g_device_list = g_slist_append(g_device_list, handle); } } @@ -332,6 +352,7 @@ static void update_device_info(void) char *ipv4 = NULL; bool required = false; bool discriminant = false; + char *payload = NULL; check_if(NULL == g_device_h); @@ -390,6 +411,13 @@ static void update_device_info(void) required ? "YES" : "NO ", sizeof("YES")); } + ret = ua_device_get_payload(g_device_h, &payload); + if (UA_ERROR_NONE == ret && payload) { + memset(g_payload_str, 0, MENU_DATA_SIZE + 1); + memcpy(g_payload_str, payload, MENU_DATA_SIZE); + g_free(payload); + } + } static int run_ua_device_set_os_info( @@ -525,6 +553,20 @@ static int run_ua_device_update( return RET_SUCCESS; } +static int run_ua_device_set_payload( + MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("ua_device_set_payload"); + + ret = ua_device_set_payload(g_device_h, g_payload_str); + + msg(" - ua_device_set_payload() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} static void __device_added_cb(int result, ua_device_h handle, void *user_data) @@ -578,6 +620,7 @@ static void __device_added_cb(int result, msgb("Device IPv4 Addr : %s", ipv4); g_free(ipv4); } + } static int run_ua_device_get_handle_by_mac_address( @@ -894,6 +937,14 @@ static struct menu_data menu_ua_discrminiant[] = { { NULL, NULL, }, }; +static struct menu_data menu_ua_device_set_payload[] = { + { "1", "Payload", + NULL, NULL, g_payload_str }, + { "2", "run", NULL, + run_ua_device_set_payload, NULL }, + { NULL, NULL, }, +}; + struct menu_data menu_ua_devices[] = { { "1", "ua_device_create", NULL, run_ua_device_create, NULL }, @@ -937,6 +988,8 @@ struct menu_data menu_ua_devices[] = { NULL, run_ua_service_remove_device, NULL }, { "21", "ua_service_foreach_added_devices", NULL, run_ua_service_foreach_added_devices, NULL }, + { "22", "ua_device_set_payload", + menu_ua_device_set_payload, NULL, g_payload_str }, { NULL, NULL, }, }; |