Remove redundant code 68/183068/1
authorinjun.yang <injun.yang@samsung.com>
Mon, 2 Jul 2018 05:17:12 +0000 (14:17 +0900)
committerinjun.yang <injun.yang@samsung.com>
Mon, 2 Jul 2018 05:17:12 +0000 (14:17 +0900)
Change-Id: I68f78b52a3d706478b6a9d1fcc9390560e6c7d0c

test/bt_unit_test.c
test/bt_unit_test.h

index df81ed9..7547b95 100644 (file)
@@ -217,6 +217,8 @@ tc_table_t tc_adapter[] = {
                , BT_UNIT_TEST_FUNCTION_ADAPTER_IS_SERVICE_USED},
        {"bt_adapter_get_visibility"
                , BT_UNIT_TEST_FUNCTION_ADAPTER_GET_VISIBILITY},
+       {"bt_adapter_set_visibility"
+               , BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY},
        {"bt_adapter_set_device_discovery_state_changed_cb"
                , BT_UNIT_TEST_FUNCTION_ADAPTER_SET_DEVICE_DISCOVERY_STATE_CHANGED_CB},
        {"bt_adapter_unset_device_discovery_state_changed_cb"
@@ -316,6 +318,8 @@ tc_table_t tc_adapter_le[] = {
                , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_SERVICE_UUID},
        {"Register scan filter (Service Solicitation UUID)"
                , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_SERVICE_SOLICITATION_UUID},
+       {"Register scan filter (Manufacturer DATA)"
+               , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_MANUFACTURER_DATA},
        {"Register iBeaconscan filter (Manufacturer DATA)"
                , BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_IBEACON_DATA},
        {"Unregister all scan filters"
@@ -1160,6 +1164,7 @@ tc_table_t tc_automated_test[] = {
        {"On/Off repeat test()"                                         , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST},
        {"On/Off repeat(1sec delay) test()"                             , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_1_SEC_DELAY},
        {"On/Off repeat(Nsec delay) test()"                             , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_N_SEC_DELAY},
+       {"AppControl default"                                   , BT_UNIT_TEST_FUNCTION_APP_CONTROL_DEFAULT},
        {"AppControl 2.3 BT onoff"                                      , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_ONOFF},
        {"AppControl 2.3 BT Visibility"                         , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_VISIBILITY},
        {"AppControl 2.4 BT onoff"                                      , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_ONOFF},
@@ -1631,6 +1636,40 @@ static void __bt_adapter_le_scan_result_cb(
        }
 }
 
+static void __print_gatt_handler(bt_gatt_h gatt_handle)
+{
+       if (!gatt_handle) {
+               TC_PRT("Invalid handler");
+               return;
+       }
+
+       char *type;
+       char *role;
+       bt_gatt_common_s *handle = (bt_gatt_common_s *)gatt_handle;
+
+       if (handle->type == BT_GATT_TYPE_SERVICE)
+               type = g_strdup("Service");
+       else if (handle->type == BT_GATT_TYPE_CHARACTERISTIC)
+               type = g_strdup("Characteristic");
+       else if (handle->type == BT_GATT_TYPE_DESCRIPTOR)
+               type = g_strdup("Descriptor");
+       else
+               type = g_strdup("Unknown");
+
+       if (handle->role == BT_GATT_ROLE_SERVER)
+               role = g_strdup("Server");
+       else if (handle->role == BT_GATT_ROLE_CLIENT)
+               role = g_strdup("Client");
+       else
+               role = g_strdup("Unknown");
+
+       TC_PRT("GATT %s  [%s]", type, role);
+       TC_PRT("%s [%s]", handle->path, handle->uuid);
+
+       g_free(type);
+       g_free(role);
+}
+
 void __bt_gatt_server_read_value_requested_cb(
        const char *remote_address, int request_id,
        bt_gatt_server_h server, bt_gatt_h gatt_handle,
@@ -1639,12 +1678,10 @@ void __bt_gatt_server_read_value_requested_cb(
        char char_value_1[3] = {0, 1, 2};
        int resp_status = BT_ATT_ERROR_NONE;
 
-       TC_PRT("__bt_gatt_server_read_value_requested_cb");
-       TC_PRT("remote_address %s", remote_address);
-       TC_PRT("req_id %d", request_id);
-       TC_PRT("server %s", (char *)server);
-       TC_PRT("gatt_handle %s", (char *)gatt_handle);
-       TC_PRT("Offset %d", offset);
+       __print_gatt_handler(gatt_handle);
+       TC_PRT("[%s] req_id %d, offset %d", remote_address, request_id, offset);
+       printf("\n");
+
        /* Get the attribute new values here */
        bt_gatt_server_send_response(request_id,
                BLUETOOTH_GATT_ATT_REQUEST_TYPE_READ, offset,
@@ -1655,10 +1692,10 @@ void __bt_gatt_server_notification_state_change_cb(bool notify,
                bt_gatt_server_h server, bt_gatt_h gatt_handle,
                void *user_data)
 {
-       TC_PRT("__bt_gatt_server_notification_state_change_cb");
-       TC_PRT("notify %d", notify);
+       __print_gatt_handler(gatt_handle);
+       TC_PRT("Notification %s [%d]", notify ? "enabled" : "disabled", notify);
        TC_PRT("server %s", (char *)server);
-       TC_PRT("gatt_handle %s", (char *)gatt_handle);
+       printf("\n\n");
 }
 
 static void __bt_adapter_le_advertising_state_changed_cb(int result,
@@ -1938,7 +1975,8 @@ void __bt_device_connection_state_changed_cb(bool connected,
        TC_PRT("__bt_device_connection_state_changed_cb [%d]", connected);
        TC_PRT("address [%s]", conn_info->remote_address);
        TC_PRT("link type [%d]", conn_info->link);
-       TC_PRT("disconnection reason [%d]", conn_info->disconn_reason);
+       if (!connected)
+               TC_PRT("disconnection reason [%d]", conn_info->disconn_reason);
 }
 
 void __bt_device_att_mtu_changed_cb(int result, bt_device_att_mtu_info_s *mtu_info, void *user_data)
@@ -1957,10 +1995,9 @@ void __bt_device_att_mtu_changed_cb(int result, bt_device_att_mtu_info_s *mtu_in
        }
 }
 
-
 bool __bt_device_connected_profile(bt_profile_e profile, void *user_data)
 {
-       TC_PRT("__bt_device_connected_profile [%d]", profile);
+       TC_PRT("__bt_device_connected_profile [0x%04x]", profile);
        return true;
 }
 
@@ -1971,6 +2008,7 @@ void __bt_device_bond_created_cb(int result,
                TC_PRT("Callback: A bond is created.");
                TC_PRT("Callback: The number of service - %d.",
                        device_info->service_count);
+               TC_PRT("Callback: class : %d %d %d", (int)device_info->bt_class.major_device_class, device_info->bt_class.minor_device_class, device_info->bt_class.major_service_class_mask);
 
                int i = 0;
                for (i = 0; i < device_info->service_count; i++) {
@@ -2575,11 +2613,12 @@ void __bt_gatt_server_write_value_requested_cb(const char *remote_address,
                                bt_gatt_h gatt_handle, bool response_needed, int offset,
                                const char *value, int len, void *user_data)
 {
-       int i, resp_status =  BT_ATT_ERROR_NONE;
-       TC_PRT("remote_address : %s", remote_address);
-       TC_PRT("Response needed : %d", response_needed);
-       TC_PRT("offset : %d", offset);
-       TC_PRT("len [%d] : ", len);
+       int i, resp_status = BT_ATT_ERROR_NONE;
+
+       __print_gatt_handler(gatt_handle);
+       TC_PRT("[%s] req_id %d, response_needed %d, offset %d, len %d",
+               remote_address, request_id, response_needed, offset, len);
+
        for (i = 0; i < len; i++)
                printf("%d ", value[i]);
 
@@ -3191,129 +3230,33 @@ int test_set_params(int test_id, char *param)
 {
        static int param_index = 0;
        const char *param_type = NULL;
+       int param_count = 0;
+
+       if (param_index > 0 && param_index  == g_test_param.param_count)
+               goto done;
 
        switch (current_tc_table) {
        case BT_UNIT_TEST_TABLE_ADAPTER: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY:
+                       param_count = 1;
                        TC_PRT("Input param(%d) (non-discoverable: -1, always: 0, limited-discoverable(time): N)", param_index + 1);
-                       param_index++;
-
                        break;
-               }
-               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_CONNECTABLE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1],
-                                       param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_CONNECTABLE:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
                        break;
-               }
                case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_MANUFACTURER_DATA:
-               {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_BYTE_ARRAY;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_BYTE_ARRAY;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
                        break;
-               }
-               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_REMOTE_OOB_EXT_DATA: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 5;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len);
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, len);
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_REMOTE_OOB_EXT_DATA:
+                       param_count = 5;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
                        TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
-                       param_index++;
-
                        break;
-
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -3326,118 +3269,40 @@ int test_set_params(int test_id, char *param)
        case BT_UNIT_TEST_TABLE_ADAPTER_LE: {
                switch (test_id) {
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_MODE:
+                       param_count = 1;
+                       TC_PRT("Scan mode\n (0 : Balanced (5000/2000 ms), 1: Low Latency (5000/5000 ms), 2 : Low Energy (5000/500 ms)");
+                       break;
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_ADD_ADVERTISING_DATA:
+                       param_count = 1;
+                       TC_PRT("Select advertising data \n (0 : Service uuid, 1: Service solicitation 2 : Appearance & Tx power, 3 : All, 4 : ANCS");
+                       TC_PRT("\t (Default scan response : Service Data &Local name & Manufacturer data)");
+                       break;
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_MODE:
+                       param_count = 1;
+                       TC_PRT("Input mode \n (0 : Balanced(500 ms), 1 : Low Latency(150 ms), 2 : Low Energy (1000 ms))");
+                       break;
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_FILTER_POLICY:
+                       param_count = 1;
+                       TC_PRT("Input filter_policy \n (0 : No use White List, 1 : Allow scan, 2 : Allow conneciton, 3 : Allow scan & conneciton)");
+                       break;
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CONNECTABLE:
-               case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_ADVERTISING: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       switch (test_id) {
-                       case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_SCAN_MODE:
-                               TC_PRT("Scan mode\n (0 : Balanced (5000/2000 ms), 1: Low Latency (5000/5000 ms), 2 : Low Energy (5000/500 ms)");
-                               break;
-                       case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_ADD_ADVERTISING_DATA:
-                               TC_PRT("Select advertising data \n (0 : Service uuid, 1: Service solicitation 2 : Appearance & Tx power, 3 : All, 4 : ANCS");
-                               TC_PRT("\t (Default scan response : Service Data &Local name & Manufacturer data)");
-                               break;
-                       case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_MODE:
-                               TC_PRT("Input mode \n (0 : Balanced(500 ms), 1 : Low Latency(150 ms), 2 : Low Energy (1000 ms))");
-                               break;
-                       case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_FILTER_POLICY:
-                               TC_PRT("Input filter_policy \n (0 : No use White List, 1 : Allow scan, 2 : Allow conneciton, 3 : Allow scan & conneciton)");
-                               break;
-                       case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_ADVERTISING_CONNECTABLE:
-                               TC_PRT("Input adv type \n (0 : Non-connectable (ADV_SCAN_IND), 1 : Connectable (ADV_IND) ");
-                               break;
-                       case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_ADVERTISING:
-                               TC_PRT("Input adv slot id \n (Default is 0, Maximum is 2) ");
-                               break;
-                       }
-                       param_index++;
-
+                       param_count = 1;
+                       TC_PRT("Input adv type \n (0 : Non-connectable (ADV_SCAN_IND), 1 : Connectable (ADV_IND) ");
                        break;
-               }
-               case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_ENABLE_PRIVACY: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_STOP_ADVERTISING:
+                       param_count = 1;
+                       TC_PRT("Input adv slot id \n (Default is 0, Maximum is 2) ");
                        break;
-               }
-
-               case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_REMOTE_OOB_EXT_DATA: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 3;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len);
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, len);
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_ENABLE_PRIVACY:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+                       break;
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_REMOTE_OOB_EXT_DATA:
+                       param_count = 3;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
                        TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
-                       param_index++;
-
                        break;
-
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -3449,124 +3314,21 @@ int test_set_params(int test_id, char *param)
 
        case BT_UNIT_TEST_TABLE_DEVICE: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_DEVICE_IS_PROFILE_CONNECTED: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-
-               case BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND_BY_TYPE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
+               case BT_UNIT_TEST_FUNCTION_DEVICE_IS_PROFILE_CONNECTED:
+               case BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND_BY_TYPE:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
                        break;
-               }
-
-               case BT_UNIT_TEST_FUNCTION_DEVICE_UPDATE_LE_CONNECTION_MODE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) mode (0 : balanced, 1 : low latency, 2 : low power) : %s", param_index + 1, param_type);
-                       param_index++;
-
+               case BT_UNIT_TEST_FUNCTION_DEVICE_UPDATE_LE_CONNECTION_MODE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) mode (0 : balanced, 1 : low latency, 2 : low power) ", param_index + 1);
                        break;
-               }
-
-               case BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = "int(1, 2, 10, ...., 512)";
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU:
+                       param_count = 1;
+                       param_type = "int(1, 2, 10, ...., 512)";
                        TC_PRT("Input param(%d) : %s", param_index + 1, param_type);
-                       param_index++;
-
                        break;
-               }
-
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -3575,97 +3337,52 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
+
        case BT_UNIT_TEST_TABLE_SOCKET: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_SOCKET_CREATE_RFCOMM_CUSTOM_UUID: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_SOCKET_CREATE_RFCOMM_CUSTOM_UUID:
+               case BT_UNIT_TEST_FUNCTION_SOCKET_CONNECT_RFCOMM_CUSTOM_UUID:
+               case BT_UNIT_TEST_FUNCTION_SOCKET_SEND_DATA:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
                        TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
-                       param_index++;
+                       break;
+               default:
+                       TC_PRT("There is no param to set\n");
+                       need_to_set_params = false;
                        break;
                }
-               case BT_UNIT_TEST_FUNCTION_SOCKET_CONNECT_RFCOMM_CUSTOM_UUID: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
 
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
+               break;
+       }
 
-                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
-                       param_index++;
+       case BT_UNIT_TEST_TABLE_OPP: {
+               switch (test_id) {
+               default:
+                       TC_PRT("There is no param to set\n");
+                       need_to_set_params = false;
                        break;
                }
-               case BT_UNIT_TEST_FUNCTION_SOCKET_SEND_DATA: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
 
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
+               break;
+       }
 
+       case BT_UNIT_TEST_TABLE_AUDIO: {
+               switch (test_id) {
+               case BT_UNIT_TEST_FUNCTION_AUDIO_CONNECT:
+               case BT_UNIT_TEST_FUNCTION_AUDIO_DISCONNECT:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+                       break;
+               case BT_UNIT_TEST_FUNCTION_AG_CALL_EVENT_DIALING:
+               case BT_UNIT_TEST_FUNCTION_AG_CALL_EVENT_INCOMING:
+               case BT_UNIT_TEST_FUNCTION_CALL_LIST_ADD:
+               case BT_UNIT_TEST_FUNCTION_AG_SWITCH_HEADSET:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
                        break;
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -3674,7 +3391,8 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
-       case BT_UNIT_TEST_TABLE_OPP: {
+
+       case BT_UNIT_TEST_TABLE_PAN: {
                switch (test_id) {
                default:
                        TC_PRT("There is no param to set\n");
@@ -3684,258 +3402,17 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
-       case BT_UNIT_TEST_TABLE_AUDIO: {
-               switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_AUDIO_CONNECT: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
 
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_AUDIO_DISCONNECT: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-
-               case BT_UNIT_TEST_FUNCTION_AG_CALL_EVENT_DIALING: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_AG_CALL_EVENT_INCOMING: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_CALL_LIST_ADD: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_AG_SWITCH_HEADSET: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-
-               default:
-                       TC_PRT("There is no param to set\n");
-                       need_to_set_params = false;
-                       break;
-               }
-
-               break;
-       }
-       case BT_UNIT_TEST_TABLE_PAN: {
-               switch (test_id) {
-               default:
-                       TC_PRT("There is no param to set\n");
-                       need_to_set_params = false;
-                       break;
-               }
-
-               break;
-       }
-       case BT_UNIT_TEST_TABLE_GATT: {
-               switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_GATT_CONNECT: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_GATT_SET_WRITE_TYPE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 3;
-                               g_test_param.params = g_malloc0(sizeof(char*) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
+       case BT_UNIT_TEST_TABLE_GATT: {
+               switch (test_id) {
+               case BT_UNIT_TEST_FUNCTION_GATT_CONNECT:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+                       break;
+               case BT_UNIT_TEST_FUNCTION_GATT_SET_WRITE_TYPE: {
+                       param_count = 3;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
 
                        switch (param_index) {
                        case 0:
@@ -3948,35 +3425,10 @@ int test_set_params(int test_id, char *param)
                                TC_PRT("Input write_type (0 : no response, 1 : with reponse, 2 : signed)");
                                break;
                        }
-
-                       param_index++;
-
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_READ_VALUE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 3;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
+                       param_count = 3;
 
                        switch (param_index) {
                        case 0:
@@ -3989,36 +3441,10 @@ int test_set_params(int test_id, char *param)
                                TC_PRT("Input Descriptor UUID or nothing");
                                break;
                        }
-
-                       param_index++;
-
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_WRITE_VALUE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 5;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-
-                               param_index = 0;
-                               return 0;
-                       }
+                       param_count = 5;
 
                        switch (param_index) {
                        case 0:
@@ -4037,35 +3463,10 @@ int test_set_params(int test_id, char *param)
                                TC_PRT("Input Value");
                                break;
                        }
-
-                       param_index++;
-
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_SET_CHAR_VALUE_CHANGED_CB: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 2;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
+                       param_count = 2;
 
                        switch (param_index) {
                        case 0:
@@ -4075,484 +3476,149 @@ int test_set_params(int test_id, char *param)
                                TC_PRT("Input Characteristic UUID");
                                break;
                        }
-
-                       param_index++;
-
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_UNSET_CHAR_VALUE_CHANGED_CB: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 2;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
+                       param_count = 2;
 
                        switch (param_index) {
                        case 0:
                                TC_PRT("Input Service UUID");
                                break;
-                       case 1:
-                               TC_PRT("Input Characteristic UUID");
-                               break;
-                       }
-
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_ANCS_POSITIVE_ACTION:
-               case BT_UNIT_TEST_FUNCTION_ANCS_NEGATIVE_ACTION:
-               case BT_UNIT_TEST_FUNCTION_ANCS_GET_NOTI_ATTR: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-                       break;
-               }
-
-               default:
-                       TC_PRT("There is no param to set\n");
-                       need_to_set_params = false;
-                       break;
-               }
-
-               break;
-       }
-       case BT_UNIT_TEST_TABLE_HPS: {
-               switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_CREATE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_HDR:
-               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_ENTITY:
-               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_URI: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       switch (param_index) {
-                       case 0:
-                               TC_PRT("Input Value in string");
-                               break;
-                       }
-
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_CP: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       switch (param_index) {
-                       case 0:
-                               TC_PRT("Input Value Type (avail. : \n1.HTTP_GET, \n2.HTTP_HEAD, \n3.HTTP_POST, \n4.HTTP_PUT, \n5.HTTP_DELETE, \n6.HTTPS_GET, \n7.HTTPS_HEAD, \n8.HTTPS_POST, \n9.HTTPS_PUT, \n10.HTTPS_DELETE, \n11.HTTP_CANCEL");
-                               break;
-                       }
-                       TC_PRT("Input param(%d) type:%s",
-                               param_index + 1, param_type);
-                       param_index++;
-
-                       break;
-               }
-               default:
-                       TC_PRT("There is no param to set\n");
-                       need_to_set_params = false;
-                       break;
-               }
-               break;
-       }
-
-       case BT_UNIT_TEST_TABLE_DPM: {
-               switch (test_id) {
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_BLUETOOTH_MODE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-                               switch (param_index) {
-                               case 0:
-                                       TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_HANDSFREE_ONLY, \n2.BT_DPM_BT_RESTRICTED");
-                                       break;
-                               }
-                               TC_PRT("Input param(%d) type:%s",
-                                       param_index + 1, param_type);
-                               param_index++;
-
-                               break;
-                       }
-                       break;
-                       case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_DEVICE_RESTRICTION:
-                       case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_UUID_RESTRICTION:
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_OUTGOING_CALL:
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_PAIRING_STATE:
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_DESKTOP_CONNECTIVITY_STATE:
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_DISCOVERABLE_STATE:
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_LIMITED_DISCOVERABLE_STATE:
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_DATA_TRANSFER_STATE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-                               switch (param_index) {
-                               case 0:
-                                       TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_RESTRICTED");
-                                       break;
-                               }
-                               TC_PRT("Input param(%d) type:%s",
-                                       param_index + 1, param_type);
-                               param_index++;
-
-                               break;
-                       }
-                       break;
-                       case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_BLACKLIST:
-                       case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_WHITELIST:
-                       case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_BLACKLIST:
-                       case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_WHITELIST:  {
-                               if (param_index == 0) {
-                                       g_test_param.param_count = 1;
-                                       g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               }
-
-                               if (param_index > 0) {
-                                       int len = strlen(param);
-                                       g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                                       /* Remove new line character */
-                                       param[len - 1] = '\0';
-                                       strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                               }
-
-                               if (param_index == g_test_param.param_count) {
-                                       need_to_set_params = false;
-#ifdef ARCH64
-                                       test_input_callback((void *)(uintptr_t)test_id);
-#else
-                                       test_input_callback((void *)test_id);
-#endif
-                                       param_index = 0;
-                                       return 0;
-                               }
-
-                               switch (param_index) {
-                               case 0:
-                                       TC_PRT("Input device Address");
-                                       break;
-                               }
-                               param_index++;
-
-                               break;
-                       }
-                       case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_BLACKLIST:
-                       case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_WHITELIST:
-                       case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_BLACKLIST:
-                       case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_WHITELIST:   {
-                               if (param_index == 0) {
-                                       g_test_param.param_count = 1;
-                                       g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               }
-
-                               if (param_index > 0) {
-                                       int len = strlen(param);
-                                       g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                                       /* Remove new line character */
-                                       param[len - 1] = '\0';
-                                       strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                               }
-
-                               if (param_index == g_test_param.param_count) {
-                                       need_to_set_params = false;
-#ifdef ARCH64
-                                       test_input_callback((void *)(uintptr_t)test_id);
-#else
-                                       test_input_callback((void *)test_id);
-#endif
-                                       param_index = 0;
-                                       return 0;
-                               }
-
-                               switch (param_index) {
-                               case 0:
-                                       TC_PRT("Input UUID");
-                                       break;
-                               }
-                               param_index++;
-
-                               break;
-                       }
-                       case BT_UNIT_TEST_FUNCTION_DPM_SET_PROFILE_STATE: {
-                               if (param_index == 0) {
-                                       g_test_param.param_count = 2;
-                                       g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                                       param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                               }
-                               if (param_index > 0) {
-                                       g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                                       strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                               }
-
-                               if (param_index == g_test_param.param_count) {
-                                       need_to_set_params = false;
-#ifdef ARCH64
-                                       test_input_callback((void *)(uintptr_t)test_id);
-#else
-                                       test_input_callback((void *)test_id);
-#endif
-                                       param_index = 0;
-                                       return 0;
-                               }
-                               switch (param_index) {
-                               case 0:
-                                       TC_PRT("Input Profile Type (avail. : \n0.BT_DPM_POLICY_A2DP_PROFILE_STATE, \
-                                                                                                       \n1.BT_DPM_POLICY_AVRCP_PROFILE_STATE, \
-                                                                                                       \n2.BT_DPM_POLICY_BPP_PROFILE_STATE, \
-                                                                                                       \n3.BT_DPM_POLICY_DUN_PROFILE_STATE, \
-                                                                                                       \n4.BT_DPM_POLICY_FTP_PROFILE_STATE, \
-                                                                                                       \n5.BT_DPM_POLICY_HFP_PROFILE_STATE, \
-                                                                                                       \n6.BT_DPM_POLICY_HSP_PROFILE_STATE, \
-                                                                                                       \n7.BT_DPM_POLICY_PBAP_PROFILE_STATE, \
-                                                                                                       \n8.BT_DPM_POLICY_SAP_PROFILE_STATE, \
-                                                                                                       \n9.BT_DPM_POLICY_SPP_PROFILE_STATE");
-                                       break;
-                               case 1:
-                                       TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_RESTRICTED");
-                                       break;
-                               }
-                               TC_PRT("Input param(%d) type:%s",
-                                               param_index + 1, param_type);
-                               param_index++;
-
-                               break;
-                       }
-                       case BT_UNIT_TEST_FUNCTION_DPM_GET_PROFILE_STATE: {
-                               if (param_index == 0) {
-                                       g_test_param.param_count = 1;
-                                       g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                                       param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                               }
-                               if (param_index > 0) {
-                                       g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                                       strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                               }
-
-                               if (param_index == g_test_param.param_count) {
-                                       need_to_set_params = false;
-#ifdef ARCH64
-                                       test_input_callback((void *)(uintptr_t)test_id);
-#else
-                                       test_input_callback((void *)test_id);
-#endif
-                                       param_index = 0;
-                                       return 0;
-                               }
-                               switch (param_index) {
-                               case 0:
-                                       TC_PRT("Input Profile Type (avail. : \n0.BT_DPM_POLICY_A2DP_PROFILE_STATE, \
-                                                                                                       \n1.BT_DPM_POLICY_AVRCP_PROFILE_STATE, \
-                                                                                                       \n2.BT_DPM_POLICY_BPP_PROFILE_STATE, \
-                                                                                                       \n3.BT_DPM_POLICY_DUN_PROFILE_STATE, \
-                                                                                                       \n4.BT_DPM_POLICY_FTP_PROFILE_STATE, \
-                                                                                                       \n5.BT_DPM_POLICY_HFP_PROFILE_STATE, \
-                                                                                                       \n6.BT_DPM_POLICY_HSP_PROFILE_STATE, \
-                                                                                                       \n7.BT_DPM_POLICY_PBAP_PROFILE_STATE, \
-                                                                                                       \n8.BT_DPM_POLICY_SAP_PROFILE_STATE, \
-                                                                                                       \n9.BT_DPM_POLICY_SPP_PROFILE_STATE");
-                                       break;
-                               }
-
-                               TC_PRT("Input param(%d) type:%s",
-                                       param_index + 1, param_type);
-                               param_index++;
-
-                               break;
-                       }
-
-                       default:
-                               TC_PRT("There is no param to set\n");
-                               need_to_set_params = false;
+                       case 1:
+                               TC_PRT("Input Characteristic UUID");
                                break;
+                       }
+                       break;
+               }
+               case BT_UNIT_TEST_FUNCTION_ANCS_POSITIVE_ACTION:
+               case BT_UNIT_TEST_FUNCTION_ANCS_NEGATIVE_ACTION:
+               case BT_UNIT_TEST_FUNCTION_ANCS_GET_NOTI_ATTR:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+                       break;
+               default:
+                       TC_PRT("There is no param to set\n");
+                       need_to_set_params = false;
                        break;
                }
+
                break;
        }
 
-       case BT_UNIT_TEST_TABLE_PXP: {
+       case BT_UNIT_TEST_TABLE_HPS: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_PXP_MONITOR_WRITE_LINKLOSS_ALERT:
-               case BT_UNIT_TEST_FUNCTION_PXP_MONITOR_WRITE_IMMEDIATE_ALERT: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
+               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_CREATE:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_BOOL;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+                       break;
+               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_HDR:
+               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_ENTITY:
+               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_URI:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
+                       TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+                       break;
+               case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_CP: {
+                       param_count = 1;
+                       TC_PRT("Input Value Type (avail. : \n1.HTTP_GET, \n2.HTTP_HEAD, \
+                                                       \n3.HTTP_POST, \n4.HTTP_PUT, \n5.HTTP_DELETE, \
+                                                       \n6.HTTPS_GET, \n7.HTTPS_HEAD, \n8.HTTPS_POST, \
+                                                       \n9.HTTPS_PUT, \n10.HTTPS_DELETE, \n11.HTTP_CANCEL");
+                       break;
+               }
+               default:
+                       TC_PRT("There is no param to set\n");
+                       need_to_set_params = false;
+                       break;
+               }
+               break;
+       }
 
+       case BT_UNIT_TEST_TABLE_DPM: {
+               switch (test_id) {
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_BLUETOOTH_MODE:
+                       param_count = 1;
+                       TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_HANDSFREE_ONLY, \n2.BT_DPM_BT_RESTRICTED");
+                       break;
+
+               case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_DEVICE_RESTRICTION:
+               case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_UUID_RESTRICTION:
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_OUTGOING_CALL:
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_PAIRING_STATE:
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_DESKTOP_CONNECTIVITY_STATE:
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_DISCOVERABLE_STATE:
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_LIMITED_DISCOVERABLE_STATE:
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_DATA_TRANSFER_STATE:
+                       param_count = 1;
+                       TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_RESTRICTED");
+                       break;
+               case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_BLACKLIST:
+               case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_WHITELIST:
+               case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_BLACKLIST:
+               case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_WHITELIST:
+                       param_count = 1;
+                       TC_PRT("Input device Address");
+                       break;
+               case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_BLACKLIST:
+               case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_WHITELIST:
+               case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_BLACKLIST:
+               case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_WHITELIST:
+                       param_count = 1;
+                       TC_PRT("Input UUID");
+                       break;
+               case BT_UNIT_TEST_FUNCTION_DPM_SET_PROFILE_STATE:
+                       param_count = 2;
                        switch (param_index) {
                        case 0:
-                               TC_PRT("Input Value Type (avail. : \n0.NONE, \n1.MILD, \n2.HIGH");
+                               TC_PRT("Input Profile Type (avail. : \n0.BT_DPM_POLICY_A2DP_PROFILE_STATE, \
+                                                                                               \n1.BT_DPM_POLICY_AVRCP_PROFILE_STATE, \
+                                                                                               \n2.BT_DPM_POLICY_BPP_PROFILE_STATE, \
+                                                                                               \n3.BT_DPM_POLICY_DUN_PROFILE_STATE, \
+                                                                                               \n4.BT_DPM_POLICY_FTP_PROFILE_STATE, \
+                                                                                               \n5.BT_DPM_POLICY_HFP_PROFILE_STATE, \
+                                                                                               \n6.BT_DPM_POLICY_HSP_PROFILE_STATE, \
+                                                                                               \n7.BT_DPM_POLICY_PBAP_PROFILE_STATE, \
+                                                                                               \n8.BT_DPM_POLICY_SAP_PROFILE_STATE, \
+                                                                                               \n9.BT_DPM_POLICY_SPP_PROFILE_STATE");
+                               break;
+                       case 1:
+                               TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_RESTRICTED");
                                break;
                        }
+                       break;
+               case BT_UNIT_TEST_FUNCTION_DPM_GET_PROFILE_STATE:
+                       param_count = 1;
+                       TC_PRT("Input Profile Type (avail. : \n0.BT_DPM_POLICY_A2DP_PROFILE_STATE, \
+                                                                                               \n1.BT_DPM_POLICY_AVRCP_PROFILE_STATE, \
+                                                                                               \n2.BT_DPM_POLICY_BPP_PROFILE_STATE, \
+                                                                                               \n3.BT_DPM_POLICY_DUN_PROFILE_STATE, \
+                                                                                               \n4.BT_DPM_POLICY_FTP_PROFILE_STATE, \
+                                                                                               \n5.BT_DPM_POLICY_HFP_PROFILE_STATE, \
+                                                                                               \n6.BT_DPM_POLICY_HSP_PROFILE_STATE, \
+                                                                                               \n7.BT_DPM_POLICY_PBAP_PROFILE_STATE, \
+                                                                                               \n8.BT_DPM_POLICY_SAP_PROFILE_STATE, \
+                                                                                               \n9.BT_DPM_POLICY_SPP_PROFILE_STATE");
 
-                       param_index++;
-
                        break;
+               default:
+                       TC_PRT("There is no param to set\n");
+                       need_to_set_params = false;
+                       break;
+               break;
                }
+               break;
+       }
+
+       case BT_UNIT_TEST_TABLE_PXP: {
+               switch (test_id) {
+               case BT_UNIT_TEST_FUNCTION_PXP_MONITOR_WRITE_LINKLOSS_ALERT:
+               case BT_UNIT_TEST_FUNCTION_PXP_MONITOR_WRITE_IMMEDIATE_ALERT:
+                       param_count = 1;
+                       TC_PRT("Input Value Type (avail. : \n0.NONE, \n1.MILD, \n2.HIGH");
+                       break;
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -4573,34 +3639,10 @@ int test_set_params(int test_id, char *param)
        }
        case BT_UNIT_TEST_TABLE_HID: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_RC_KEY_EVENT: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_RC_KEY_EVENT:
+                       param_count = 1;
                        TC_PRT("Select TV control mode (1 : Vol Up, 2 : Vol Down, 3 : CH Up, 4 : CH Down) : ");
-                       param_index++;
-
                        break;
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -4609,56 +3651,16 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
+
        case BT_UNIT_TEST_TABLE_IPSP: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_IPSP_CONNECT_WITH_APP_SERVER_SOCKET: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-                               test_input_callback(GINT_TO_POINTER(test_id));
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_IPSP_CONNECT_WITH_APP_SERVER_SOCKET:
+                       param_count = 1;
                        TC_PRT("IPSP Client : Input IPSP App server's IPv6 address to connect :");
-
-                       param_index++;
                        break;
-               }
                case BT_UNIT_TEST_FUNCTION_IPSP_SEND_IPV6_APP_DATA: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 2;
-                               g_test_param.params = g_malloc0(sizeof(char *) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-                               test_input_callback(GINT_TO_POINTER(test_id));
-                               param_index = 0;
-                               return 0;
-                       }
+                       param_count = 2;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
 
                        switch (param_index) {
                        case 0:
@@ -4668,40 +3670,12 @@ int test_set_params(int test_id, char *param)
                        TC_PRT("IPSP : input data to send :");
                                break;
                        }
-
-                               param_index++;
-
                        break;
                }
-               case BT_UNIT_TEST_FUNCTION_IPSP_RECV_IPV6_APP_DATA: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-               }
-
-               if (param_index == g_test_param.param_count) {
-                       need_to_set_params = false;
-                       test_input_callback(GINT_TO_POINTER(test_id));
-                       param_index = 0;
-                       return 0;
-               }
-
-               TC_PRT("IPSP : Input current role of Application[Server[0]/Client[1] :");
-
-               param_index++;
-
-               break;
-       }
-
+               case BT_UNIT_TEST_FUNCTION_IPSP_RECV_IPV6_APP_DATA:
+                       param_count = 1;
+                       TC_PRT("IPSP : Input current role of Application[Server[0]/Client[1] :");
+                       break;
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -4725,34 +3699,11 @@ int test_set_params(int test_id, char *param)
        case BT_UNIT_TEST_TABLE_HF:
        {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_WITH_PARAM: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_WITH_PARAM:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
                        TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
-                       param_index++;
-
                        break;
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -4761,6 +3712,7 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
+
        case BT_UNIT_TEST_TABLE_PBAP_CLIENT:
                if (!TIZEN_PROFILE_WEARABLE_IVI)
                        goto __default__;
@@ -4774,38 +3726,18 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
+
        case BT_UNIT_TEST_TABLE_ETC: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_CHECK_FEATURE: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) * g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
+               case BT_UNIT_TEST_FUNCTION_APP_CONTROL_DEFAULT:
+                       param_count = 1;
+                       param_type = BT_UNIT_TEST_PARAM_TYPE_STRING;
+                       TC_PRT("Input launch-type string(ex. setting, headset, hid)");
+                       break;
+               case BT_UNIT_TEST_FUNCTION_CHECK_FEATURE:
+                       param_count = 1;
                        TC_PRT("Input feature string(ex. tizen.org/feature/network.bluetooth)");
-                       param_index++;
                        break;
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -4814,139 +3746,20 @@ int test_set_params(int test_id, char *param)
 
                break;
        }
+
        case BT_UNIT_TEST_TABLE_OTP: {
                switch (test_id) {
-               case BT_UNIT_TEST_FUNCTION_OTP_SERVER_INIT: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       switch (param_index) {
-                       case 0:
-                               TC_PRT("Input Value in string");
-                               break;
-                       }
-
-                       param_index++;
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_OTP_CLIENT_SELECT_OBJ: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                               param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       switch (param_index) {
-                       case 0:
-                               TC_PRT("Input Value in uint64_t");
-                               break;
-                       }
-
-                       param_index++;
-
+               case BT_UNIT_TEST_FUNCTION_OTP_SERVER_INIT:
+               case BT_UNIT_TEST_FUNCTION_OTP_CLIENT_CREATE_OBJ:
+                       param_count = 1;
+                       TC_PRT("Input Value in string");
                        break;
-               }
-               case BT_UNIT_TEST_FUNCTION_OTP_CLIENT_CREATE_OBJ: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 1;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-                               param_index = 0;
-                               return 0;
-                       }
-
-                       switch (param_index) {
-                       case 0:
-                               TC_PRT("Input Value in string");
-                               break;
-                       }
-
-                       param_index++;
-
+               case BT_UNIT_TEST_FUNCTION_OTP_CLIENT_SELECT_OBJ:
+                       param_count = 1;
+                       TC_PRT("Input Value in uint64_t");
                        break;
-               }
-               case BT_UNIT_TEST_FUNCTION_OTP_CLIENT_WRITE_OBJ: {
-                       if (param_index == 0) {
-                               g_test_param.param_count = 4;
-                               g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
-                       }
-
-                       if (param_index > 0) {
-                               int len = strlen(param);
-                               g_test_param.params[param_index - 1] = g_malloc0(len + 1);
-                               /* Remove new line character */
-                               param[len - 1] = '\0';
-                               strncpy(g_test_param.params[param_index - 1], param, strlen(param));
-                       }
-
-                       if (param_index == g_test_param.param_count) {
-                               need_to_set_params = false;
-#ifdef ARCH64
-                               test_input_callback((void *)(uintptr_t)test_id);
-#else
-                               test_input_callback((void *)test_id);
-#endif
-
-                               param_index = 0;
-                               return 0;
-                       }
+               case BT_UNIT_TEST_FUNCTION_OTP_CLIENT_WRITE_OBJ:
+                       param_count = 4;
 
                        switch (param_index) {
                        case 0:
@@ -4962,11 +3775,7 @@ int test_set_params(int test_id, char *param)
                                TC_PRT("Input mode");
                                break;
                        }
-
-                       param_index++;
-
                        break;
-               }
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -4982,6 +3791,35 @@ __default__:
                break;
        }
 
+done:
+       if (need_to_set_params) {
+               if (param_index == 0) {
+                       g_test_param.param_count = param_count;
+                       g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
+               }
+
+               if (param_index > 0) {
+                       int len = strlen(param);
+                       g_test_param.params[param_index - 1] = g_malloc0(len + 1);
+                       /* Remove new line character */
+                       param[len - 1] = '\0';
+                       strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+               }
+
+               if (param_index  == g_test_param.param_count) {
+                       need_to_set_params = false;
+#ifdef ARCH64
+                       test_input_callback((void *)(uintptr_t)test_id);
+#else
+                       test_input_callback((void *)test_id);
+#endif
+                       param_index = 0;
+                       return 0;
+               }
+
+               param_index++;
+       }
+
        return 0;
 }
 
@@ -5982,7 +4820,7 @@ int test_input_callback(void *data)
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_MANUFACTURER_DATA: {
                        bt_scan_filter_h scan_filter = NULL;
                        int manufacturer_id = 117; /* samsung */
-                       char param_data[] = {0x2, 0x2, 0x2, 0x2};
+                       char param_data[] = {0x42, 0x04};
                        /* Use "appearance & tx power level" of bt_adapter_le_add_XXX_advertising_data */
 
                        ret = bt_adapter_le_scan_filter_create(&scan_filter);
@@ -7718,9 +6556,9 @@ int test_input_callback(void *data)
                        bt_gatt_h descriptor = NULL;
                        char *service_uuid = "000018f2-0000-1000-8000-00805f9b34fb";
                        char *char_uuid = "00002af6-0000-1000-8000-00805f9b34fb";
-                       char *desc_uuid = "00002a56-0000-1000-8000-00805f9b34fb";
+                       char *desc_uuid = "2902";  // CCCD
                        char char_value[4] = {10, 20, 30, 40};
-                       char desc_value[4] = {12, 34, 56, 78};
+                       char desc_value[2] = {0, 0}; // Notification disabled
                        int value_length = 4;
                        int permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE;
                        int properties = BT_GATT_PROPERTY_BROADCAST | BT_GATT_PROPERTY_READ |
@@ -7739,30 +6577,29 @@ int test_input_callback(void *data)
                                        &service);
                        TC_PRT("bt_gatt_service_create : %s \n", __bt_get_error_message(ret));
 
+                       /* Read & Write & Notify characteristics UUID */
                        ret = bt_gatt_characteristic_create(char_uuid, permissions,
                                        properties, char_value,
                                        value_length, &characteristic);
                        TC_PRT("bt_gatt_characteristic_create : %s\n", __bt_get_error_message(ret));
 
+                       bt_gatt_server_set_read_value_requested_cb(characteristic,
+                               __bt_gatt_server_read_value_requested_cb, NULL);
+
                        ret = bt_gatt_server_set_write_value_requested_cb(characteristic,
                                __bt_gatt_server_write_value_requested_cb, NULL);
 
-                       bt_gatt_server_set_read_value_requested_cb(characteristic,
-                               __bt_gatt_server_read_value_requested_cb, NULL);
+                       ret = bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic,
+                                               __bt_gatt_server_notification_state_change_cb, NULL);
+
                        ret = bt_gatt_service_add_characteristic(service, characteristic);
                        TC_PRT("bt_gatt_service_add_characteristic : %s\n", __bt_get_error_message(ret));
 
+                       /* CCCD for Notify characteristics */
                        ret = bt_gatt_descriptor_create(desc_uuid, permissions,
                                        desc_value, value_length, &descriptor);
                        TC_PRT("bt_gatt_descriptor_create : %s\n", __bt_get_error_message(ret));
 
-                       bt_gatt_server_set_read_value_requested_cb(descriptor,
-                               __bt_gatt_server_read_value_requested_cb, NULL);
-
-                       ret = bt_gatt_server_set_write_value_requested_cb(descriptor,
-                               __bt_gatt_server_write_value_requested_cb,
-                               NULL);
-
                        ret = bt_gatt_characteristic_add_descriptor(characteristic, descriptor);
                        TC_PRT("bt_gatt_characteristic_add_descriptor : %s\n", __bt_get_error_message(ret));
 
@@ -10673,6 +9510,24 @@ int test_input_callback(void *data)
                                bt_adapter_disable();
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_APP_CONTROL_DEFAULT: {
+                       char *mode = "setting";
+
+                       if (g_test_param.param_count > 0)
+                               mode = g_test_param.params[0];
+
+                       app_control_h service = NULL;
+
+                       app_control_create(&service);
+                       app_control_set_app_id(service, "com.samsung.bluetooth-single");
+                       app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
+                       app_control_add_extra_data(service, "launch-type", mode);
+                       ret = app_control_send_launch_request(service, NULL, NULL);
+                       TC_PRT("returns %d", ret);
+
+                       app_control_destroy(service);
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_ONOFF: {
                        app_control_h service = NULL;
 
index 08c1302..f2ec69e 100644 (file)
@@ -124,7 +124,7 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_DEVICE_ADDRESS,
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_SERVICE_UUID,
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_SERVICE_SOLICITATION_UUID,
-BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_MANUFACTURER_DATA,
+       BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_MANUFACTURER_DATA,
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_IBEACON_DATA,
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_UNREGISTER_ALL_SCAN_FILTERS,
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_SET_DEVICE_DISCOVERY_STATE_CHANGED_CB,
@@ -443,6 +443,7 @@ BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_MANUFACTURER_DATA,
        BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST = 1,
        BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_1_SEC_DELAY,
        BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_N_SEC_DELAY,
+       BT_UNIT_TEST_FUNCTION_APP_CONTROL_DEFAULT,
        BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_ONOFF,
        BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_VISIBILITY,
        BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_ONOFF,