diff options
author | Abhay agarwal <ay.agarwal@samsung.com> | 2019-12-27 09:40:55 +0530 |
---|---|---|
committer | DoHyun Pyun <dh79.pyun@samsung.com> | 2019-12-30 16:45:56 +0900 |
commit | b0b3085fb1e31610441b3549ad7eec8a6a86ea84 (patch) | |
tree | e8e8f5ffe82378c6480414a3702608fe7af6c43c | |
parent | c3ee9bcbf12b883e6b91e5ed5255a5ee0c69e8aa (diff) | |
download | user-awareness-b0b3085fb1e31610441b3549ad7eec8a6a86ea84.tar.gz user-awareness-b0b3085fb1e31610441b3549ad7eec8a6a86ea84.tar.bz2 user-awareness-b0b3085fb1e31610441b3549ad7eec8a6a86ea84.zip |
modify ua-test app to show payload params in hex
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
-rw-r--r-- | include/user-awareness.h | 21 | ||||
-rw-r--r-- | src/user-awareness-payload.c | 25 | ||||
-rw-r--r-- | test/uat-payload.c | 12 |
3 files changed, 56 insertions, 2 deletions
diff --git a/include/user-awareness.h b/include/user-awareness.h index d5ff9d4..22eaa95 100644 --- a/include/user-awareness.h +++ b/include/user-awareness.h @@ -3047,6 +3047,27 @@ int ua_payload_get_user_data( /** * @ingroup CAPI_NETWORK_UA_MODULE + * @brief Gets device's BLE payload DEVICE_UID length. + * @since_tizen 5.5 + * + * @param[in] handle The payload handle. + * @param[out] device_uid_len The BLE payload DEVICE_UID length. + * + * @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_payload_get_device_uid_len( + ua_payload_h handle, + int *device_uid_len); + +/** + * @ingroup CAPI_NETWORK_UA_MODULE * @brief Gets device's BLE payload DEVICE_UID. * @since_tizen 5.5 * diff --git a/src/user-awareness-payload.c b/src/user-awareness-payload.c index 6b82934..f07f99a 100644 --- a/src/user-awareness-payload.c +++ b/src/user-awareness-payload.c @@ -504,6 +504,31 @@ done: return UA_ERROR_NONE; } +int ua_payload_get_device_uid_len( + ua_payload_h handle, + int *device_uid_len) +{ + FUNC_ENTRY; + ua_payload_info_s *payload = (ua_payload_info_s *)handle; + + UA_VALIDATE_INPUT_PARAMETER(handle); + UA_VALIDATE_INPUT_PARAMETER(device_uid_len); + UA_PRINT_PAYLOAD_HANDLE(handle); + + if (!payload) { + *device_uid_len = 0x00; + UA_DBG("payload(device_uid_len) is not found"); + goto done; + } + + UA_DBG("payload(device_uid_len) [%d]", payload->device_uid_len); + *device_uid_len = payload->device_uid_len; + +done: + FUNC_EXIT; + return UA_ERROR_NONE; +} + int ua_payload_get_device_uid( ua_payload_h handle, char **device_uid) diff --git a/test/uat-payload.c b/test/uat-payload.c index e6067a1..eac06ea 100644 --- a/test/uat-payload.c +++ b/test/uat-payload.c @@ -277,6 +277,7 @@ static bool __foreach_added_payload_cb( char primary_key = 0; char secondary_key = 0; char *device_uid = NULL; + int device_uid_len = 0; char device_icon = 0; char *payload_user_data = NULL; @@ -304,9 +305,15 @@ static bool __foreach_added_payload_cb( if (UA_ERROR_NONE == ret) msglr("Payload secondary key : %d", secondary_key); + ret = ua_payload_get_device_uid_len(handle, &device_uid_len); + if (UA_ERROR_NONE == ret) { + msglr("Payload device uid len %d", device_uid_len); + } + ret = ua_payload_get_device_uid(handle, &device_uid); if (UA_ERROR_NONE == ret) { - msglr("Payload device uid %s", device_uid); + for (int i = 0; i < device_uid_len; i++ ) + msglr("Payload device uid 0x%2.2X", device_uid[i]); } ret = ua_payload_get_device_icon(handle, &device_icon); @@ -315,7 +322,8 @@ static bool __foreach_added_payload_cb( ret = ua_payload_get_user_data(handle, &payload_user_data); if (UA_ERROR_NONE == ret) { - msglr("Payload user data : %s", payload_user_data); + for (int i = 0; i < 17 - 1 - device_uid_len; i++ ) + msglr("Payload user data : 0x%2.2X", payload_user_data[i]); } return true; |