Add unit test 66/134066/2
authorInjun Yang <injun.yang@samsung.com>
Wed, 14 Jun 2017 10:55:19 +0000 (19:55 +0900)
committerInjun Yang <injun.yang@samsung.com>
Wed, 14 Jun 2017 11:48:14 +0000 (20:48 +0900)
Change-Id: I7cf32772efa3fa8f6012472a9feacbbce4ca4d34

test/bt_unit_test.c
test/bt_unit_test.h

index 1d52a78dbd2e7b9c5a75239f53908facb0f44a99..360e8a372784bd38e41c9b4d46cbd5e1144bd0c4 100644 (file)
@@ -1349,6 +1349,9 @@ static const char *__bt_get_error_message(bt_error_e err)
        case BT_ERROR_SERVICE_NOT_FOUND:
                err_str = "BT_ERROR_SERVICE_NOT_FOUND";
                break;
+       case BT_ERROR_NO_DATA:
+               err_str = "BT_ERROR_NO_DATA";
+               break;
        case BT_ERROR_NOT_SUPPORTED:
                err_str = "BT_ERROR_NOT_SUPPORTED";
                break;
@@ -1518,16 +1521,23 @@ static bool __bt_adapter_bonded_device_cb(bt_device_info_s *device_info,
        void *user_data)
 {
        int i;
+       char *str = NULL;
 
        TC_PRT("remote_address: %s", device_info->remote_address);
        TC_PRT("remote_name: %s", device_info->remote_name);
+       TC_PRT("is_connected: %d", device_info->is_connected);
        TC_PRT("service_count: %d", device_info->service_count);
 
        if (device_info->service_uuid == NULL) {
                TC_PRT("No uuids");
        } else {
-               for (i = 0; i < device_info->service_count; i++)
-                       TC_PRT("uuid: %s", device_info->service_uuid[i]);
+               for (i = 0; i < device_info->service_count; i++) {
+                       bt_get_uuid_name(device_info->service_uuid[i], &str);
+
+                       TC_PRT("[%d / %d] %s (%s)", i, device_info->service_count,
+                               str ? str : "Unknown", device_info->service_uuid[i]);
+                       g_free(str);
+               }
        }
 
        if (device_info->manufacturer_data_len > 0) {
@@ -1538,6 +1548,7 @@ static bool __bt_adapter_bonded_device_cb(bt_device_info_s *device_info,
                        printf("%02x ", device_info->manufacturer_data[i]);
                printf("]\n");
        }
+       printf("\n");
 
        return true;
 }
@@ -1749,18 +1760,12 @@ static void __bt_adapter_le_device_discovery_state_changed_cb(int result,
                        discovery_info->rssi,
                        discovery_info->address_type);
 
-               if (discovery_info->adv_data_len > 31 ||
-                               discovery_info->scan_data_len > 31) {
-                       TC_PRT("###################");
-                       bt_adapter_le_stop_device_discovery();
-                       TC_PRT("###################");
-                       return;
-               }
 #if 0
                /* LE ADV information */
                int i, ret;
                int field_len = 0;
                unsigned char *field_data;
+
                printf("Adv data [");
                for (i = 0; i < discovery_info->adv_data_len; i++)
                        printf("%02x ", discovery_info->adv_data[i]);
@@ -2041,7 +2046,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)
@@ -2060,10 +2066,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;
 }
 
@@ -2146,13 +2151,21 @@ void __bt_print_repeat_test_final_summary()
 void __bt_gatt_connection_state_changed_cb(int result,
        bool connected, const char *remote_address, void *user_data)
 {
-       TC_PRT("result: %s", __bt_get_error_message(result));
+       if (result != BT_ERROR_NONE)
+               TC_PRT("result: %s", __bt_get_error_message(result));
+
        if (connected) {
-               TC_PRT("LE connected(address = %s)", remote_address);
-               /* Fix : STRING_OVERFLOW */
-               strncpy(remote_addr, remote_address, strlen(remote_addr));
+               TC_PRT("GATT connected [%s]", remote_address);
+
+               bt_le_conn_update_s param;
+
+               param.interval_min = 90;
+               param.interval_max = 90;
+               param.latency = 0;
+               param.time_out = 2000;
+               bt_device_le_conn_update(remote_addr, &param);
        } else {
-               TC_PRT("LE DISconnected");
+               TC_PRT("GATT DISconnected [%s]", remote_address);
        }
 }
 
@@ -2160,9 +2173,11 @@ void __bt_hps_connection_state_changed_cb(int result,
        bool connected, const char *remote_address, void *user_data)
 {
        int ret;
-       TC_PRT("result: %s", __bt_get_error_message(result));
+       if (result != BT_ERROR_NONE)
+               TC_PRT("result: %s", __bt_get_error_message(result));
+
        if (connected) {
-               TC_PRT("HPS connected(address = %s)", remote_address);
+               TC_PRT("HPS connected  [%s]", remote_address);
                /* Fix : STRING_OVERFLOW */
                strncpy(remote_addr, remote_address, strlen(remote_addr));
                if (hps_client) {
@@ -2174,7 +2189,7 @@ void __bt_hps_connection_state_changed_cb(int result,
                        __bt_get_error_message(ret));
 
        } else {
-               TC_PRT("HPS DISconnected");
+               TC_PRT("HPS DISconnected [%s]", remote_address);
        }
 }
 
@@ -2269,11 +2284,6 @@ void __bt_gatt_client_print_value(bt_gatt_h h)
 
        if (hex_format) {
                str = g_malloc0(len * 5 + 1);
-               /* Fix : NULL_RETURNS */
-               if (!str) {
-                       TC_PRT("BT_ERROR_OUT_OF_MEMORY");
-                       goto fail;
-               }
                for (i = 0; i < len; i++) {
                        if (i > 0)
                                str[i * 5 - 1] = ' ';
@@ -2282,16 +2292,11 @@ void __bt_gatt_client_print_value(bt_gatt_h h)
                }
        } else {
                str = g_malloc0(len + 1);
-               /* Fix : NULL_RETURNS */
-               if (!str) {
-                       TC_PRT("BT_ERROR_OUT_OF_MEMORY");
-                       goto fail;
-               }
                memcpy(str, value, len);
        }
 
        TC_PRT("Value : %s", str);
-fail:
+
        g_free(str);
        g_free(value);
 }
@@ -3223,6 +3228,14 @@ static void __bt_initialize_all(void)
                        __bt_device_bond_destroyed_cb, NULL);
        if (ret != BT_ERROR_NONE)
                TC_PRT("returns %s\n", __bt_get_error_message(ret));
+       ret = bt_device_set_connection_state_changed_cb(
+                       __bt_device_connection_state_changed_cb, NULL);
+       if (ret != BT_ERROR_NONE)
+               TC_PRT("returns %s\n", __bt_get_error_message(ret));
+       ret = bt_device_set_att_mtu_changed_cb(
+                       __bt_device_att_mtu_changed_cb, NULL);
+       if (ret != BT_ERROR_NONE)
+               TC_PRT("returns %s\n", __bt_get_error_message(ret));
        ret = bt_gatt_set_connection_state_changed_cb(
                        __bt_gatt_connection_state_changed_cb, NULL);
        if (ret != BT_ERROR_NONE)
@@ -3237,13 +3250,13 @@ static void __bt_initialize_all(void)
        if (ret != BT_ERROR_NONE)
                TC_PRT("returns %s\n", __bt_get_error_message(ret));
 #else
-       ret = bt_pbap_client_set_connection_state_changed_cb(__bt_pbap_connection_state_changed_cb,
-                       NULL);
+       ret = bt_pbap_client_set_connection_state_changed_cb(
+                       __bt_pbap_connection_state_changed_cb, NULL);
        if (ret != BT_ERROR_NONE)
                TC_PRT("returns %s\n", __bt_get_error_message(ret));
 #endif
        ret = bt_socket_set_connection_state_changed_cb(
-               __bt_socket_connection_state_changed_cb, NULL);
+                       __bt_socket_connection_state_changed_cb, NULL);
        if (ret != BT_ERROR_NONE)
                TC_PRT("returns %s\n", __bt_get_error_message(ret));
 
@@ -3263,6 +3276,34 @@ int test_set_params(int test_id, char *param)
        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;
+                       }
+
+                       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;
@@ -3517,7 +3558,34 @@ int test_set_params(int test_id, char *param)
 
                        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++;
+
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU: {
                        if (param_index == 0) {
                                g_test_param.param_count = 1;
@@ -3546,6 +3614,62 @@ int test_set_params(int test_id, char *param)
 
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_DEVICE_UPDATE_LE_CONNECTION: {
+                       if (param_index == 0) {
+                               g_test_param.param_count = 4;
+                               g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
+                               param_type = BT_UNIT_TEST_PARAM_TYPE_FLOAT;
+                       }
+
+                       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) : %s", param_index + 1, param_type);
+                       param_index++;
+
+                       break;
+               }
+               case BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH:{
+                       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 (0: MAX 27 ,  1: MAX 251)";
+                       }
+
+                       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) : %s", param_index + 1, param_type);
+                       param_index++;
+
+                       break;
+               }
 
                default:
                        TC_PRT("There is no param to set\n");
@@ -3891,6 +4015,48 @@ int test_set_params(int test_id, char *param)
 
                        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;
+                       }
+
+                       switch (param_index) {
+                       case 0:
+                               TC_PRT("Input Service UUID");
+                               break;
+                       case 1:
+                               TC_PRT("Input Characteristic UUID");
+                               break;
+                       case 2:
+                               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;
@@ -4663,6 +4829,34 @@ int test_set_params(int test_id, char *param)
 #if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
        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;
+                       }
+
+                       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;
@@ -4856,6 +5050,26 @@ int test_input_callback(void *data)
                        TC_PRT("time: %d", time);
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY: {
+                       int mode = BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE;
+                       int timeout_sec = 0;
+
+                       if (g_test_param.param_count > 0) {
+                               if (g_test_param.params[0][0] == '-')
+                                       mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
+                               else if (g_test_param.params[0][0] == '0')
+                                       mode = BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE;
+                               else {
+                                       mode = BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE;
+                                       timeout_sec = atoi(g_test_param.params[0]);
+                               }
+                               __bt_free_test_param(&g_test_param);
+                       }
+
+                       ret = bt_adapter_set_visibility(mode, timeout_sec);
+                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_DEVICE_DISCOVERY_STATE_CHANGED_CB:
                        ret = bt_adapter_set_device_discovery_state_changed_cb(
                                __bt_adapter_device_discovery_state_changed_cb, NULL);
@@ -5246,6 +5460,7 @@ int test_input_callback(void *data)
                        const char *heart_rate_svc_uuid_16 = "180d";
                        const char *lmmediate_alert_svc_uuid_16 = "1802";
                        const char *ancs_uuid_128 = "7905F431-B5CE-4E99-A40F-4B1E122D00D0";
+                       const char *ams_uuid_128 = "89D3502B-0F36-433A-8EF4-C502AD55F8DC";
                        int appearance = 192;  /* 192 is generic watch */
 
                        advertiser = advertiser_list[advertiser_index];
@@ -5364,6 +5579,24 @@ int test_input_callback(void *data)
 
                                return 0;
 
+                       case 5: /* AMS */
+                               ret = bt_adapter_le_add_advertising_service_solicitation_uuid(advertiser,
+                                               BT_ADAPTER_LE_PACKET_ADVERTISING, time_svc_uuid_16);
+                               if (ret != BT_ERROR_NONE)
+                                       TC_PRT("add service_solicitation_uuid [0x%04x]", ret);
+
+                               ret = bt_adapter_le_add_advertising_service_solicitation_uuid(advertiser,
+                                               BT_ADAPTER_LE_PACKET_ADVERTISING, ams_uuid_128);
+                               if (ret != BT_ERROR_NONE)
+                                       TC_PRT("add service_solicitation_uuid [0x%04x]", ret);
+
+                               ret = bt_adapter_le_set_advertising_device_name(advertiser,
+                                       BT_ADAPTER_LE_PACKET_SCAN_RESPONSE, true);
+                               if (ret != BT_ERROR_NONE)
+                                       TC_PRT("set device name [0x%04x]", ret);
+
+                               return 0;
+
                        default:
                                TC_PRT("No adv data");
                                break;
@@ -5461,14 +5694,14 @@ int test_input_callback(void *data)
                        else cb = __bt_adapter_le_advertising_state_changed_cb_3;
 
                        advertiser = advertiser_list[advertiser_index];
+                       advertiser_index++;
+                       advertiser_index %= 3;
 
                        if (advertiser == NULL) {
                                ret = bt_adapter_le_create_advertiser(&advertiser);
                                TC_PRT("created le advertiser(%d)", ret);
                                advertiser_list[advertiser_index] = advertiser;
                        }
-                       advertiser_index++;
-                       advertiser_index %= 3;
 
                        TC_PRT("advertiser: %p", advertiser);
 
@@ -5487,6 +5720,8 @@ int test_input_callback(void *data)
                        else cb = __bt_adapter_le_advertising_state_changed_cb_3;
 
                        advertiser = advertiser_list[advertiser_index];
+                       advertiser_index++;
+                       advertiser_index %= 3;
 
                        adv_params.interval_min = 500;
                        adv_params.interval_max = 500;
@@ -5496,8 +5731,6 @@ int test_input_callback(void *data)
                                TC_PRT("created le advertiser(%d)", ret);
                                advertiser_list[advertiser_index] = advertiser;
                        }
-                       advertiser_index++;
-                       advertiser_index %= 3;
 
                        ret = bt_adapter_le_start_advertising(advertiser,
                                &adv_params, cb, NULL);
@@ -5514,24 +5747,9 @@ int test_input_callback(void *data)
                                __bt_free_test_param(&g_test_param);
                        }
 
-                       if (slot_id < 0 || slot_id >= 3) {
-                               TC_PRT("Invalid slot id: %d", slot_id);
-                               break;
-                       }
-
                        advertiser = advertiser_list[slot_id];
 
-                       TC_PRT("advertiser: %p", advertiser);
-
                        ret = bt_adapter_le_stop_advertising(advertiser);
-
-                       if (advertiser_index > 0)
-                               advertiser_index--;
-                       else
-                               advertiser_index = 2;
-
-                       advertiser_list[slot_id] = NULL;
-
                        if (ret < BT_ERROR_NONE)
                                        TC_PRT("failed with [0x%04x]", ret);
                        break;
@@ -5646,6 +5864,32 @@ int test_input_callback(void *data)
                        break;
                }
 
+               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 data[] = {0x2, 0x2, 0x2, 0x2}; 
+                       /* Use "appearance & tx power level" of bt_adapter_le_add_XXX_advertising_data */
+
+                       ret = bt_adapter_le_scan_filter_create(&scan_filter);
+                       if (ret != BT_ERROR_NONE)
+                               TC_PRT("failed with [0x%04x]", ret);
+
+                       ret = bt_adapter_le_scan_filter_set_manufacturer_data(scan_filter,
+                                               manufacturer_id, data, sizeof(data));
+                       if (ret != BT_ERROR_NONE)
+                               TC_PRT("failed with [0x%04x]", ret);
+
+                       ret = bt_adapter_le_scan_filter_register(scan_filter);
+                       if (ret != BT_ERROR_NONE)
+                               TC_PRT("failed with [0x%04x]", ret);
+
+                       ret = bt_adapter_le_scan_filter_destroy(scan_filter);
+                       if (ret != BT_ERROR_NONE)
+                               TC_PRT("failed with [0x%04x]", ret);
+
+                       break;
+               }
+
                case BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_IBEACON_DATA: {
                        bt_scan_filter_h scan_filter;
 
@@ -5918,6 +6162,25 @@ int test_input_callback(void *data)
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                }
+
+               case BT_UNIT_TEST_FUNCTION_DEVICE_UPDATE_LE_CONNECTION: {
+                       bt_le_conn_update_s param;
+
+                       if (g_test_param.param_count == 0)
+                               break;
+
+                       param.interval_min = atof(g_test_param.params[0]);
+                       param.interval_max = atof(g_test_param.params[1]);
+                       param.latency = atoi(g_test_param.params[2]);
+                       param.time_out = atoi(g_test_param.params[3]);
+
+                       __bt_free_test_param(&g_test_param);
+
+                       ret = bt_device_le_conn_update(remote_addr, &param);
+                       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");
@@ -6472,6 +6735,43 @@ int test_input_callback(void *data)
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_GATT_SET_WRITE_TYPE: {
+                       char *svc_uuid = NULL;
+                       char *chr_uuid = NULL;
+                       bt_gatt_h svc = NULL;
+                       bt_gatt_h chr = NULL;
+                       bt_gatt_write_type_e write_type;
+
+                       if (g_test_param.param_count < 3) {
+                               TC_PRT("Input parameters first");
+                               break;
+                       }
+
+                       svc_uuid = g_test_param.params[0];
+                       chr_uuid = g_test_param.params[1];
+
+                       ret = bt_gatt_client_get_service(client, svc_uuid, &svc);
+                       if (ret != BT_ERROR_NONE) {
+                               TC_PRT("bt_gatt_client_get_service is failed : %d", ret);
+                               __bt_free_test_param(&g_test_param);
+                               break;
+                       }
+
+                       ret = bt_gatt_service_get_characteristic(svc, chr_uuid, &chr);
+                       if (ret != BT_ERROR_NONE) {
+                               TC_PRT("bt_gatt_service_get_characteristic is failed : %d", ret);
+                               __bt_free_test_param(&g_test_param);
+                               break;
+                       }
+
+                       write_type = atoi(g_test_param.params[2]);
+                       ret = bt_gatt_characteristic_set_write_type(chr, write_type);
+                       if (ret != BT_ERROR_NONE)
+                               TC_PRT("bt_gatt_characteristic_set_write_type is failed : %d", ret);
+
+                       __bt_free_test_param(&g_test_param);
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_CREATE: {
                        if (client) {
                               bt_gatt_client_destroy(client);
@@ -7170,6 +7470,13 @@ int test_input_callback(void *data)
                        }
                        ret = bt_gatt_set_value(custom_h.chr, char_value, 4);
                        TC_PRT("returns  %s\n", __bt_get_error_message(ret));
+
+                       /* notify only client remote_addr */
+                       ret = bt_gatt_server_notify_characteristic_changed_value(custom_h.chr,
+                                       __bt_gatt_server_notification_sent_cb, remote_addr, NULL);
+                       TC_PRT("bt_gatt_server_notify_characteristic_changed_value : %s\n",
+                                       __bt_get_error_message(ret));
+
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_GATT_START_SERVER: {
@@ -8251,6 +8558,32 @@ int test_input_callback(void *data)
 
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_MOUSE_EVENT_SCROLL: {
+                       bt_hid_mouse_data_s send_data;
+
+                       send_data.buttons = BT_HID_MOUSE_BUTTON_NONE;
+                       send_data.padding  = 0x01;
+
+                       send_data.axis_x = 0;
+                       send_data.axis_y = 0;
+                       TC_PRT("Scroll UP");
+                       ret = bt_hid_device_send_mouse_event(remote_addr,&send_data);
+                       if (ret < 0)
+                               TC_PRT("returns %d\n", ret);
+                       break;
+               }
+               case BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_MOUSE_EVENT_SCROLL_DOWN: {
+                       bt_hid_mouse_data_s send_data;
+                       send_data.buttons = BT_HID_MOUSE_BUTTON_NONE;
+                       send_data.padding = 0xff;
+                       send_data.axis_x = 0;
+                       send_data.axis_y = 0;
+                       TC_PRT("Scroll Down");
+                       ret = bt_hid_device_send_mouse_event(remote_addr,&send_data);
+                               if (ret < 0)
+                                       TC_PRT("returns %d\n", ret);
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_KEY_EVENT: {
                        bt_hid_key_data_s send_data;
                        /* Will send character 'a' */
index 5fe851193c3756cf8f48f878722e7f58854e2042..40290289cbdb3ee2a508744737875db565f5a306 100644 (file)
@@ -75,6 +75,7 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_ADAPTER_GET_BONDED_DEVICE_INFO,
        BT_UNIT_TEST_FUNCTION_ADAPTER_IS_SERVICE_USED,
        BT_UNIT_TEST_FUNCTION_ADAPTER_GET_VISIBILITY,
+       BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY,
        BT_UNIT_TEST_FUNCTION_ADAPTER_SET_DEVICE_DISCOVERY_STATE_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_ADAPTER_UNSET_DEVICE_DISCOVERY_STATE_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_ADAPTER_GET_LOCAL_OOB_DATA,
@@ -129,6 +130,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_IBEACON_DATA,
        BT_UNIT_TEST_FUNCTION_ADAPTER_LE_UNREGISTER_ALL_SCAN_FILTERS,
 #ifndef TIZEN_PROFILE_WEARABLE
@@ -157,6 +159,8 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_DEVICE_DISABLE_RSSI_MONITOR,
        BT_UNIT_TEST_FUNCTION_DEVICE_GET_RSSI_STRENGTH,
        BT_UNIT_TEST_FUNCTION_DEVICE_GET_CONNECTION_STATE,
+       BT_UNIT_TEST_FUNCTION_DEVICE_UPDATE_LE_CONNECTION_MODE,
+       BT_UNIT_TEST_FUNCTION_DEVICE_UPDATE_LE_CONNECTION,
        BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU,
        BT_UNIT_TEST_FUNCTION_DEVICE_SET_REQUEST_ATT_MTU_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_DEVICE_UNSET_REQUEST_ATT_MTU_CHANGED_CB,
@@ -231,6 +235,7 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_GATT_DISCONNECT,
        BT_UNIT_TEST_FUNCTION_SET_GATT_CONNECTION_STATE_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_UNSET_GATT_CONNECTION_STATE_CHANGED_CB,
+       BT_UNIT_TEST_FUNCTION_GATT_SET_WRITE_TYPE,
        BT_UNIT_TEST_FUNCTION_GATT_CLIENT_CREATE,
        BT_UNIT_TEST_FUNCTION_GATT_CLIENT_DESTROY,
        BT_UNIT_TEST_FUNCTION_GATT_CLIENT_GET_REMOTE_ADDRESS,
@@ -334,6 +339,8 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_HID_DEVICE_DISCONNECT,
        BT_UNIT_TEST_FUCNTION_HID_DEVICE_DEACTIVATE,
        BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_MOUSE_EVENT,
+       BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_MOUSE_EVENT_SCROLL,
+       BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_MOUSE_EVENT_SCROLL_DOWN,
        BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_KEY_EVENT,
        BT_UNIT_TEST_FUNCTION_HID_DEVICE_SEND_RC_KEY_EVENT,
        BT_UNIT_TEST_FUNCTION_HID_DEVICE_SET_DATA_RECEIVED_CB,
@@ -404,6 +411,7 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_ANSWER,
        BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_INIT,
        BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_TERM,
+       BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_WITH_PARAM,
        BT_UNIT_TEST_FUNCTION_HF_GET_CALL_STATUS_INFO_LIST,
        BT_UNIT_TEST_FUNCTION_HF_SET_CALL_EVENT_CB,
        BT_UNIT_TEST_FUNCTION_HF_UNSET_CALL_EVENT_CB,