[bt_unit_test] Add parameters for le_set_data_length 52/203352/1 accepted/tizen/unified/20190416.071433 submit/tizen/20190415.001851
authorDeokhyun Kim <dukan.kim@samsung.com>
Fri, 12 Apr 2019 04:30:38 +0000 (13:30 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Fri, 12 Apr 2019 04:30:52 +0000 (13:30 +0900)
  test_input_callback:5823() Select the function again
  test_set_params:3754() Input max octets (27 ~ 251)
  test_set_params:3757() Input max time (328 ~ 2120)

Change-Id: I0034e45e1da9629045bf962e9b40640430ee39d0
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
test/bt_unit_test.c
test/bt_unit_test.h

index c4d079ce4c093db2c7b639fa22d54133ee07d933..66abf011bfbc75bb00a48f0d24481c4386f43e13 100644 (file)
@@ -3444,6 +3444,17 @@ int test_set_params(int test_id, char *param)
                        param_type = "int(1, 2, 10, ...., 512)";
                        TC_PRT("Input param(%d) : %s", param_index + 1, param_type);
                        break;
+               case BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH:
+                       param_count = 2;
+                       switch (param_index) {
+                       case 0:
+                               TC_PRT("Input max octets (27 ~ 251)");
+                               break;
+                       case 1:
+                               TC_PRT("Input max time (328 ~ 2120)");
+                               break;
+                       }
+                       break;
                default:
                        TC_PRT("There is no param to set\n");
                        need_to_set_params = false;
@@ -5028,32 +5039,6 @@ int test_input_callback(void *data)
                        TC_PRT("LE CODED PHY Support [%s]", is_coded_phy_supported ? "YES" : "NO");
                        break;
                }
-               case BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH: {
-
-                       TC_PRT("Set LE Data length paramters cmd");
-
-                       unsigned int tx_octets = 50;
-                       unsigned int tx_time = 500;
-
-                       TC_PRT("settting le data length values  tx octects: %d  tx time: %d",
-                       tx_octets, tx_time);
-                       ret = bt_device_le_set_data_length(remote_addr,
-                               tx_octets, tx_time);
-                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
-
-                       break;
-               }
-               case BT_UNIT_TEST_FUNCTION_LE_DEVICE_DATA_LENGTH_CHANGED_CB: {
-
-                       TC_PRT("Setting LE Data length change callback");
-
-                       ret = bt_device_le_set_data_length_change_cb(
-                               __bt_le_set_data_length_changed_cb,
-                               NULL);
-                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
-
-                       break;
-               }
                case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
                        need_to_set_params = true;
                        TC_PRT("Select the function again");
@@ -5243,7 +5228,39 @@ int test_input_callback(void *data)
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH: {
+
+                       TC_PRT("Set LE Data length paramters cmd");
+
+                       unsigned int tx_octets = 50;
+                       unsigned int tx_time = 500;
+
+                       if (g_test_param.param_count > 0) {
+                               tx_octets = atoi(g_test_param.params[0]);
+                               tx_time = atoi(g_test_param.params[1]);
+
+                               __bt_free_test_param(&g_test_param);
+                       }
 
+                       TC_PRT("settting le data length values  tx octects: %d  tx time: %d",
+                               tx_octets, tx_time);
+                       ret = bt_device_le_set_data_length(remote_addr,
+                               tx_octets, tx_time);
+                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
+
+                       break;
+               }
+               case BT_UNIT_TEST_FUNCTION_LE_DEVICE_DATA_LENGTH_CHANGED_CB: {
+
+                       TC_PRT("Setting LE Data length change callback");
+
+                       ret = bt_device_le_set_data_length_change_cb(
+                               __bt_le_set_data_length_changed_cb,
+                               NULL);
+                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
+
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
                        need_to_set_params = true;
                        TC_PRT("Select the function again");
index b096d50a0659798033d65b254c9950b9448c1cb1..7919c40ccea6020a2ae69b581383502192ebaa88 100644 (file)
@@ -136,8 +136,6 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_READ_HOST_SUGGESTED_DEFAULT_DATA_LENGTH,
        BT_UNIT_TEST_FUNCTION_LE_2M_PHY_SUPPORT,
        BT_UNIT_TEST_FUNCTION_LE_CODED_PHY_SUPPORT,
-       BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH,
-       BT_UNIT_TEST_FUNCTION_LE_DEVICE_DATA_LENGTH_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_DEVICE_SET_AUTHORIZATION_TRUE = 1,
        BT_UNIT_TEST_FUNCTION_DEVICE_SET_AUTHORIZATION_FALSE,
        BT_UNIT_TEST_FUNCTION_DEVICE_SET_AUTHORIZATION_CHANGED_CB,
@@ -162,6 +160,8 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_DEVICE_SET_REQUEST_ATT_MTU_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_DEVICE_UNSET_REQUEST_ATT_MTU_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_DEVICE_GET_ATT_MTU,
+       BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH,
+       BT_UNIT_TEST_FUNCTION_LE_DEVICE_DATA_LENGTH_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_SOCKET_CREATE_RFCOMM = 1,
        BT_UNIT_TEST_FUNCTION_SOCKET_DESTROY_RFCOMM,
        BT_UNIT_TEST_FUNCTION_SOCKET_LISTEN_AND_ACCEPT_RFCOMM,