modify ua-test app to show payload params in hex
authorAbhay agarwal <ay.agarwal@samsung.com>
Fri, 27 Dec 2019 04:10:55 +0000 (09:40 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 30 Dec 2019 07:45:56 +0000 (16:45 +0900)
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
include/user-awareness.h
src/user-awareness-payload.c
test/uat-payload.c

index d5ff9d40b2e136eef4db2775f7ad5b2c61c5d001..22eaa9570adf064559f29de7028ed9bfd7fd0ebb 100644 (file)
@@ -3045,6 +3045,27 @@ int ua_payload_get_user_data(
                ua_payload_h handle,
                char **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.
index 6b82934bc3234f34e21a38ba745d50a343506098..f07f99ab8c76f7759ed165c92f991d59d891a5c5 100644 (file)
@@ -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)
index e6067a131d8a3d9d75bcacd00e4c60e63cffb0dc..eac06eafdfee952d656ec8b57c44bbd7a862ed15 100644 (file)
@@ -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;