From d6b0f4278c4fbd878687bd9071fb1e9092584a8a Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Thu, 23 Jun 2016 13:20:23 +0900 Subject: [PATCH] [UTC][capi-network-bluetooth][ACR-626][Add GATT server TCS and bring internal TCs] Change-Id: Ic9a76afafb0effda7f63c33e7c658a2c5b38cb4e Signed-off-by: Hyuk Lee --- src/utc/bluetooth/tct-bluetooth-core_common_iot.h | 104 +++ src/utc/bluetooth/tct-bluetooth-core_mobile.h | 104 +++ src/utc/bluetooth/tct-bluetooth-core_wearable.h | 104 +++ src/utc/bluetooth/utc_bluetooth_gatt_negative.c | 676 +++++++++++++++ src/utc/bluetooth/utc_bluetooth_gatt_positive.c | 960 ++++++++++++++++++++++ 5 files changed, 1948 insertions(+) diff --git a/src/utc/bluetooth/tct-bluetooth-core_common_iot.h b/src/utc/bluetooth/tct-bluetooth-core_common_iot.h index 2b970e8..310fde1 100644 --- a/src/utc/bluetooth/tct-bluetooth-core_common_iot.h +++ b/src/utc/bluetooth/tct-bluetooth-core_common_iot.h @@ -344,8 +344,60 @@ extern int utc_bluetooth_bt_gatt_client_set_characteristic_value_changed_cb_n(vo extern int utc_bluetooth_bt_gatt_client_unset_characteristic_value_changed_cb_n(void); extern int utc_bluetooth_bt_gatt_client_get_service_n(void); extern int utc_bluetooth_bt_gatt_client_foreach_services_n(void); +extern int utc_bluetooth_bt_gatt_service_destroy_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_destroy_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_destroy_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_get_permissions_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_get_permissions_n(void); +extern int utc_bluetooth_bt_gatt_service_create_n(void); +extern int utc_bluetooth_bt_gatt_service_add_characteristic_n(void); +extern int utc_bluetooth_bt_gatt_service_add_included_service_n(void); +extern int utc_bluetooth_bt_gatt_service_get_server_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_create_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_add_descriptor_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_create_n(void); +extern int utc_bluetooth_bt_gatt_server_initialize_n(void); +extern int utc_bluetooth_bt_gatt_server_deinitialize_n(void); +extern int utc_bluetooth_bt_gatt_server_create_n(void); +extern int utc_bluetooth_bt_gatt_server_destroy_n(void); +extern int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n(void); +extern int utc_bluetooth_bt_gatt_server_get_service_n(void); +extern int utc_bluetooth_bt_gatt_server_foreach_services_n(void); +extern int utc_bluetooth_bt_gatt_server_register_service_n(void); +extern int utc_bluetooth_bt_gatt_server_unregister_service_n(void); +extern int utc_bluetooth_bt_gatt_server_unregister_all_services_n(void); +extern int utc_bluetooth_bt_gatt_server_start_n(void); +extern int utc_bluetooth_bt_gatt_server_send_response_n(void); extern int utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p(void); extern int utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_gatt_service_destroy_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_destroy_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_destroy_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_get_permissions_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_get_permissions_p(void); +extern int utc_bluetooth_bt_gatt_service_create_p(void); +extern int utc_bluetooth_bt_gatt_service_add_characteristic_p(void); +extern int utc_bluetooth_bt_gatt_service_add_included_service_p(void); +extern int utc_bluetooth_bt_gatt_service_get_server_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_create_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_add_descriptor_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_create_p(void); +extern int utc_bluetooth_bt_gatt_server_initialize_p(void); +extern int utc_bluetooth_bt_gatt_server_deinitialize_p(void); +extern int utc_bluetooth_bt_gatt_server_create_p(void); +extern int utc_bluetooth_bt_gatt_server_destroy_p(void); +extern int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_get_service_p(void); +extern int utc_bluetooth_bt_gatt_server_foreach_services_p(void); +extern int utc_bluetooth_bt_gatt_server_register_service_p(void); +extern int utc_bluetooth_bt_gatt_server_unregister_service_p(void); +extern int utc_bluetooth_bt_gatt_server_unregister_all_services_p(void); +extern int utc_bluetooth_bt_gatt_server_start_p(void); extern int utc_bluetooth_bt_hdp_set_data_received_cb_n(void); extern int utc_bluetooth_bt_hdp_set_data_received_cb_n1(void); extern int utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n(void); @@ -715,8 +767,60 @@ testcase tc_array[] = { {"utc_bluetooth_bt_gatt_client_unset_characteristic_value_changed_cb_n", utc_bluetooth_bt_gatt_client_unset_characteristic_value_changed_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_client_get_service_n", utc_bluetooth_bt_gatt_client_get_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_client_foreach_services_n", utc_bluetooth_bt_gatt_client_foreach_services_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_destroy_n", utc_bluetooth_bt_gatt_service_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_destroy_n", utc_bluetooth_bt_gatt_characteristic_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_destroy_n", utc_bluetooth_bt_gatt_descriptor_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_get_permissions_n", utc_bluetooth_bt_gatt_characteristic_get_permissions_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_get_permissions_n", utc_bluetooth_bt_gatt_descriptor_get_permissions_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_create_n", utc_bluetooth_bt_gatt_service_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_characteristic_n", utc_bluetooth_bt_gatt_service_add_characteristic_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_included_service_n", utc_bluetooth_bt_gatt_service_add_included_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_get_server_n", utc_bluetooth_bt_gatt_service_get_server_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_create_n", utc_bluetooth_bt_gatt_characteristic_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_add_descriptor_n", utc_bluetooth_bt_gatt_characteristic_add_descriptor_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_create_n", utc_bluetooth_bt_gatt_descriptor_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_initialize_n", utc_bluetooth_bt_gatt_server_initialize_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_deinitialize_n", utc_bluetooth_bt_gatt_server_deinitialize_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_create_n", utc_bluetooth_bt_gatt_server_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_destroy_n", utc_bluetooth_bt_gatt_server_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n", utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n", utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n", utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n", utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_get_service_n", utc_bluetooth_bt_gatt_server_get_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_foreach_services_n", utc_bluetooth_bt_gatt_server_foreach_services_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_register_service_n", utc_bluetooth_bt_gatt_server_register_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_service_n", utc_bluetooth_bt_gatt_server_unregister_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_all_services_n", utc_bluetooth_bt_gatt_server_unregister_all_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_start_n", utc_bluetooth_bt_gatt_server_start_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_send_response_n", utc_bluetooth_bt_gatt_server_send_response_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p", utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p", utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_destroy_p", utc_bluetooth_bt_gatt_service_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_destroy_p", utc_bluetooth_bt_gatt_characteristic_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_destroy_p", utc_bluetooth_bt_gatt_descriptor_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_get_permissions_p", utc_bluetooth_bt_gatt_characteristic_get_permissions_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_get_permissions_p", utc_bluetooth_bt_gatt_descriptor_get_permissions_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_create_p", utc_bluetooth_bt_gatt_service_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_characteristic_p", utc_bluetooth_bt_gatt_service_add_characteristic_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_included_service_p", utc_bluetooth_bt_gatt_service_add_included_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_get_server_p", utc_bluetooth_bt_gatt_service_get_server_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_create_p", utc_bluetooth_bt_gatt_characteristic_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_add_descriptor_p", utc_bluetooth_bt_gatt_characteristic_add_descriptor_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_create_p", utc_bluetooth_bt_gatt_descriptor_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_initialize_p", utc_bluetooth_bt_gatt_server_initialize_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_deinitialize_p", utc_bluetooth_bt_gatt_server_deinitialize_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_create_p", utc_bluetooth_bt_gatt_server_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_destroy_p", utc_bluetooth_bt_gatt_server_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p", utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p", utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p", utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_get_service_p", utc_bluetooth_bt_gatt_server_get_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_foreach_services_p", utc_bluetooth_bt_gatt_server_foreach_services_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_register_service_p", utc_bluetooth_bt_gatt_server_register_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_service_p", utc_bluetooth_bt_gatt_server_unregister_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_all_services_p", utc_bluetooth_bt_gatt_server_unregister_all_services_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_start_p", utc_bluetooth_bt_gatt_server_start_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_hdp_set_data_received_cb_n", utc_bluetooth_bt_hdp_set_data_received_cb_n, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, {"utc_bluetooth_bt_hdp_set_data_received_cb_n1", utc_bluetooth_bt_hdp_set_data_received_cb_n1, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, {"utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n", utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, diff --git a/src/utc/bluetooth/tct-bluetooth-core_mobile.h b/src/utc/bluetooth/tct-bluetooth-core_mobile.h index 2a8c4be..441b68d 100644 --- a/src/utc/bluetooth/tct-bluetooth-core_mobile.h +++ b/src/utc/bluetooth/tct-bluetooth-core_mobile.h @@ -367,10 +367,62 @@ extern int utc_bluetooth_bt_gatt_client_foreach_services_n(void); extern int utc_bluetooth_bt_gatt_read_characteristic_value_n(void); extern int utc_bluetooth_bt_gatt_set_characteristic_value_request_n(void); extern int utc_bluetooth_bt_gatt_discover_characteristic_descriptor_n(void); +extern int utc_bluetooth_bt_gatt_service_destroy_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_destroy_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_destroy_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_get_permissions_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_get_permissions_n(void); +extern int utc_bluetooth_bt_gatt_service_create_n(void); +extern int utc_bluetooth_bt_gatt_service_add_characteristic_n(void); +extern int utc_bluetooth_bt_gatt_service_add_included_service_n(void); +extern int utc_bluetooth_bt_gatt_service_get_server_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_create_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_add_descriptor_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_create_n(void); +extern int utc_bluetooth_bt_gatt_server_initialize_n(void); +extern int utc_bluetooth_bt_gatt_server_deinitialize_n(void); +extern int utc_bluetooth_bt_gatt_server_create_n(void); +extern int utc_bluetooth_bt_gatt_server_destroy_n(void); +extern int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n(void); +extern int utc_bluetooth_bt_gatt_server_get_service_n(void); +extern int utc_bluetooth_bt_gatt_server_foreach_services_n(void); +extern int utc_bluetooth_bt_gatt_server_register_service_n(void); +extern int utc_bluetooth_bt_gatt_server_unregister_service_n(void); +extern int utc_bluetooth_bt_gatt_server_unregister_all_services_n(void); +extern int utc_bluetooth_bt_gatt_server_start_n(void); +extern int utc_bluetooth_bt_gatt_server_send_response_n(void); extern int utc_bluetooth_bt_gatt_set_characteristic_changed_cb_p(void); extern int utc_bluetooth_bt_gatt_unset_characteristic_changed_cb_p(void); extern int utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p(void); extern int utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_gatt_service_destroy_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_destroy_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_destroy_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_get_permissions_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_get_permissions_p(void); +extern int utc_bluetooth_bt_gatt_service_create_p(void); +extern int utc_bluetooth_bt_gatt_service_add_characteristic_p(void); +extern int utc_bluetooth_bt_gatt_service_add_included_service_p(void); +extern int utc_bluetooth_bt_gatt_service_get_server_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_create_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_add_descriptor_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_create_p(void); +extern int utc_bluetooth_bt_gatt_server_initialize_p(void); +extern int utc_bluetooth_bt_gatt_server_deinitialize_p(void); +extern int utc_bluetooth_bt_gatt_server_create_p(void); +extern int utc_bluetooth_bt_gatt_server_destroy_p(void); +extern int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_get_service_p(void); +extern int utc_bluetooth_bt_gatt_server_foreach_services_p(void); +extern int utc_bluetooth_bt_gatt_server_register_service_p(void); +extern int utc_bluetooth_bt_gatt_server_unregister_service_p(void); +extern int utc_bluetooth_bt_gatt_server_unregister_all_services_p(void); +extern int utc_bluetooth_bt_gatt_server_start_p(void); extern int utc_bluetooth_bt_hdp_set_data_received_cb_n(void); extern int utc_bluetooth_bt_hdp_set_data_received_cb_n1(void); extern int utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n(void); @@ -744,10 +796,62 @@ testcase tc_array[] = { {"utc_bluetooth_bt_gatt_read_characteristic_value_n", utc_bluetooth_bt_gatt_read_characteristic_value_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_set_characteristic_value_request_n", utc_bluetooth_bt_gatt_set_characteristic_value_request_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_discover_characteristic_descriptor_n", utc_bluetooth_bt_gatt_discover_characteristic_descriptor_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_destroy_n", utc_bluetooth_bt_gatt_service_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_destroy_n", utc_bluetooth_bt_gatt_characteristic_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_destroy_n", utc_bluetooth_bt_gatt_descriptor_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_get_permissions_n", utc_bluetooth_bt_gatt_characteristic_get_permissions_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_get_permissions_n", utc_bluetooth_bt_gatt_descriptor_get_permissions_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_create_n", utc_bluetooth_bt_gatt_service_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_characteristic_n", utc_bluetooth_bt_gatt_service_add_characteristic_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_included_service_n", utc_bluetooth_bt_gatt_service_add_included_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_get_server_n", utc_bluetooth_bt_gatt_service_get_server_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_create_n", utc_bluetooth_bt_gatt_characteristic_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_add_descriptor_n", utc_bluetooth_bt_gatt_characteristic_add_descriptor_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_create_n", utc_bluetooth_bt_gatt_descriptor_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_initialize_n", utc_bluetooth_bt_gatt_server_initialize_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_deinitialize_n", utc_bluetooth_bt_gatt_server_deinitialize_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_create_n", utc_bluetooth_bt_gatt_server_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_destroy_n", utc_bluetooth_bt_gatt_server_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n", utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n", utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n", utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n", utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_get_service_n", utc_bluetooth_bt_gatt_server_get_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_foreach_services_n", utc_bluetooth_bt_gatt_server_foreach_services_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_register_service_n", utc_bluetooth_bt_gatt_server_register_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_service_n", utc_bluetooth_bt_gatt_server_unregister_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_all_services_n", utc_bluetooth_bt_gatt_server_unregister_all_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_start_n", utc_bluetooth_bt_gatt_server_start_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_send_response_n", utc_bluetooth_bt_gatt_server_send_response_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_set_characteristic_changed_cb_p", utc_bluetooth_bt_gatt_set_characteristic_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_gatt_unset_characteristic_changed_cb_p", utc_bluetooth_bt_gatt_unset_characteristic_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p", utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p", utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_destroy_p", utc_bluetooth_bt_gatt_service_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_destroy_p", utc_bluetooth_bt_gatt_characteristic_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_destroy_p", utc_bluetooth_bt_gatt_descriptor_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_get_permissions_p", utc_bluetooth_bt_gatt_characteristic_get_permissions_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_get_permissions_p", utc_bluetooth_bt_gatt_descriptor_get_permissions_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_create_p", utc_bluetooth_bt_gatt_service_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_characteristic_p", utc_bluetooth_bt_gatt_service_add_characteristic_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_included_service_p", utc_bluetooth_bt_gatt_service_add_included_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_get_server_p", utc_bluetooth_bt_gatt_service_get_server_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_create_p", utc_bluetooth_bt_gatt_characteristic_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_add_descriptor_p", utc_bluetooth_bt_gatt_characteristic_add_descriptor_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_create_p", utc_bluetooth_bt_gatt_descriptor_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_initialize_p", utc_bluetooth_bt_gatt_server_initialize_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_deinitialize_p", utc_bluetooth_bt_gatt_server_deinitialize_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_create_p", utc_bluetooth_bt_gatt_server_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_destroy_p", utc_bluetooth_bt_gatt_server_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p", utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p", utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p", utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_get_service_p", utc_bluetooth_bt_gatt_server_get_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_foreach_services_p", utc_bluetooth_bt_gatt_server_foreach_services_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_register_service_p", utc_bluetooth_bt_gatt_server_register_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_service_p", utc_bluetooth_bt_gatt_server_unregister_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_all_services_p", utc_bluetooth_bt_gatt_server_unregister_all_services_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_start_p", utc_bluetooth_bt_gatt_server_start_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_hdp_set_data_received_cb_n", utc_bluetooth_bt_hdp_set_data_received_cb_n, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, {"utc_bluetooth_bt_hdp_set_data_received_cb_n1", utc_bluetooth_bt_hdp_set_data_received_cb_n1, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, {"utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n", utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, diff --git a/src/utc/bluetooth/tct-bluetooth-core_wearable.h b/src/utc/bluetooth/tct-bluetooth-core_wearable.h index 0bec48f..77034f4 100644 --- a/src/utc/bluetooth/tct-bluetooth-core_wearable.h +++ b/src/utc/bluetooth/tct-bluetooth-core_wearable.h @@ -328,8 +328,60 @@ extern int utc_bluetooth_bt_gatt_client_set_characteristic_value_changed_cb_n(vo extern int utc_bluetooth_bt_gatt_client_unset_characteristic_value_changed_cb_n(void); extern int utc_bluetooth_bt_gatt_client_get_service_n(void); extern int utc_bluetooth_bt_gatt_client_foreach_services_n(void); +extern int utc_bluetooth_bt_gatt_service_destroy_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_destroy_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_destroy_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_get_permissions_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_get_permissions_n(void); +extern int utc_bluetooth_bt_gatt_service_create_n(void); +extern int utc_bluetooth_bt_gatt_service_add_characteristic_n(void); +extern int utc_bluetooth_bt_gatt_service_add_included_service_n(void); +extern int utc_bluetooth_bt_gatt_service_get_server_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_create_n(void); +extern int utc_bluetooth_bt_gatt_characteristic_add_descriptor_n(void); +extern int utc_bluetooth_bt_gatt_descriptor_create_n(void); +extern int utc_bluetooth_bt_gatt_server_initialize_n(void); +extern int utc_bluetooth_bt_gatt_server_deinitialize_n(void); +extern int utc_bluetooth_bt_gatt_server_create_n(void); +extern int utc_bluetooth_bt_gatt_server_destroy_n(void); +extern int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n(void); +extern int utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n(void); +extern int utc_bluetooth_bt_gatt_server_get_service_n(void); +extern int utc_bluetooth_bt_gatt_server_foreach_services_n(void); +extern int utc_bluetooth_bt_gatt_server_register_service_n(void); +extern int utc_bluetooth_bt_gatt_server_unregister_service_n(void); +extern int utc_bluetooth_bt_gatt_server_unregister_all_services_n(void); +extern int utc_bluetooth_bt_gatt_server_start_n(void); +extern int utc_bluetooth_bt_gatt_server_send_response_n(void); extern int utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p(void); extern int utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_gatt_service_destroy_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_destroy_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_destroy_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_get_permissions_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_get_permissions_p(void); +extern int utc_bluetooth_bt_gatt_service_create_p(void); +extern int utc_bluetooth_bt_gatt_service_add_characteristic_p(void); +extern int utc_bluetooth_bt_gatt_service_add_included_service_p(void); +extern int utc_bluetooth_bt_gatt_service_get_server_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_create_p(void); +extern int utc_bluetooth_bt_gatt_characteristic_add_descriptor_p(void); +extern int utc_bluetooth_bt_gatt_descriptor_create_p(void); +extern int utc_bluetooth_bt_gatt_server_initialize_p(void); +extern int utc_bluetooth_bt_gatt_server_deinitialize_p(void); +extern int utc_bluetooth_bt_gatt_server_create_p(void); +extern int utc_bluetooth_bt_gatt_server_destroy_p(void); +extern int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p(void); +extern int utc_bluetooth_bt_gatt_server_get_service_p(void); +extern int utc_bluetooth_bt_gatt_server_foreach_services_p(void); +extern int utc_bluetooth_bt_gatt_server_register_service_p(void); +extern int utc_bluetooth_bt_gatt_server_unregister_service_p(void); +extern int utc_bluetooth_bt_gatt_server_unregister_all_services_p(void); +extern int utc_bluetooth_bt_gatt_server_start_p(void); extern int utc_bluetooth_bt_hdp_set_data_received_cb_n(void); extern int utc_bluetooth_bt_hdp_set_data_received_cb_n1(void); extern int utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n(void); @@ -678,8 +730,60 @@ testcase tc_array[] = { {"utc_bluetooth_bt_gatt_client_unset_characteristic_value_changed_cb_n", utc_bluetooth_bt_gatt_client_unset_characteristic_value_changed_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_client_get_service_n", utc_bluetooth_bt_gatt_client_get_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_client_foreach_services_n", utc_bluetooth_bt_gatt_client_foreach_services_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_destroy_n", utc_bluetooth_bt_gatt_service_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_destroy_n", utc_bluetooth_bt_gatt_characteristic_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_destroy_n", utc_bluetooth_bt_gatt_descriptor_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_get_permissions_n", utc_bluetooth_bt_gatt_characteristic_get_permissions_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_get_permissions_n", utc_bluetooth_bt_gatt_descriptor_get_permissions_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_create_n", utc_bluetooth_bt_gatt_service_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_characteristic_n", utc_bluetooth_bt_gatt_service_add_characteristic_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_included_service_n", utc_bluetooth_bt_gatt_service_add_included_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_service_get_server_n", utc_bluetooth_bt_gatt_service_get_server_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_create_n", utc_bluetooth_bt_gatt_characteristic_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_add_descriptor_n", utc_bluetooth_bt_gatt_characteristic_add_descriptor_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_create_n", utc_bluetooth_bt_gatt_descriptor_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_initialize_n", utc_bluetooth_bt_gatt_server_initialize_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_deinitialize_n", utc_bluetooth_bt_gatt_server_deinitialize_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_create_n", utc_bluetooth_bt_gatt_server_create_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_destroy_n", utc_bluetooth_bt_gatt_server_destroy_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n", utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n", utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n", utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n", utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_get_service_n", utc_bluetooth_bt_gatt_server_get_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_foreach_services_n", utc_bluetooth_bt_gatt_server_foreach_services_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_register_service_n", utc_bluetooth_bt_gatt_server_register_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_service_n", utc_bluetooth_bt_gatt_server_unregister_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_all_services_n", utc_bluetooth_bt_gatt_server_unregister_all_service_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_start_n", utc_bluetooth_bt_gatt_server_start_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, + {"utc_bluetooth_bt_gatt_server_send_response_n", utc_bluetooth_bt_gatt_server_send_response_n, utc_bluetooth_gatt_negative_startup, utc_bluetooth_gatt_negative_cleanup}, {"utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p", utc_bluetooth_bt_gatt_set_connection_state_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p", utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_destroy_p", utc_bluetooth_bt_gatt_service_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_destroy_p", utc_bluetooth_bt_gatt_characteristic_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_destroy_p", utc_bluetooth_bt_gatt_descriptor_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_get_permissions_p", utc_bluetooth_bt_gatt_characteristic_get_permissions_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_get_permissions_p", utc_bluetooth_bt_gatt_descriptor_get_permissions_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_create_p", utc_bluetooth_bt_gatt_service_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_characteristic_p", utc_bluetooth_bt_gatt_service_add_characteristic_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_add_included_service_p", utc_bluetooth_bt_gatt_service_add_included_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_service_get_server_p", utc_bluetooth_bt_gatt_service_get_server_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_create_p", utc_bluetooth_bt_gatt_characteristic_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_characteristic_add_descriptor_p", utc_bluetooth_bt_gatt_characteristic_add_descriptor_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_descriptor_create_p", utc_bluetooth_bt_gatt_descriptor_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_initialize_p", utc_bluetooth_bt_gatt_server_initialize_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_deinitialize_p", utc_bluetooth_bt_gatt_server_deinitialize_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_create_p", utc_bluetooth_bt_gatt_server_create_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_destroy_p", utc_bluetooth_bt_gatt_server_destroy_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p", utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p", utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p", utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_get_service_p", utc_bluetooth_bt_gatt_server_get_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_foreach_services_p", utc_bluetooth_bt_gatt_server_foreach_services_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_register_service_p", utc_bluetooth_bt_gatt_server_register_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_service_p", utc_bluetooth_bt_gatt_server_unregister_service_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_unregister_all_services_p", utc_bluetooth_bt_gatt_server_unregister_all_services_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, + {"utc_bluetooth_bt_gatt_server_start_p", utc_bluetooth_bt_gatt_server_start_p, utc_bluetooth_gatt_positive_startup, utc_bluetooth_gatt_positive_cleanup}, {"utc_bluetooth_bt_hdp_set_data_received_cb_n", utc_bluetooth_bt_hdp_set_data_received_cb_n, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, {"utc_bluetooth_bt_hdp_set_data_received_cb_n1", utc_bluetooth_bt_hdp_set_data_received_cb_n1, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, {"utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n", utc_bluetooth_bt_hdp_set_connection_state_changed_cb_n, utc_bluetooth_hdp_negative_startup, utc_bluetooth_hdp_negative_cleanup}, diff --git a/src/utc/bluetooth/utc_bluetooth_gatt_negative.c b/src/utc/bluetooth/utc_bluetooth_gatt_negative.c index 580d2df..029897f 100755 --- a/src/utc/bluetooth/utc_bluetooth_gatt_negative.c +++ b/src/utc/bluetooth/utc_bluetooth_gatt_negative.c @@ -1612,4 +1612,680 @@ int utc_bluetooth_bt_gatt_discover_characteristic_descriptor_n(void) return 0; } + +/** + * @testcase utc_bluetooth_bt_gatt_service_destroy_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then destroy the service handle, + * by using the invalid parameters and check for errors. + * @scenario Try to destroy the service handle, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_service_destroy_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_destroy(NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_service_destroy(NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_destroy_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then destroy the characteristic handle, + * by using the invalid parameters and check for errors. + * @scenario Try to destroy the characteristic handle, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_characteristic_destroy_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_destroy(NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_characteristic_destroy(NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_descriptor_destroy_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then destroy the descriptor handle, + * by using the invalid parameters and check for errors. + * @scenario Try to destroy the descriptor handle, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_descriptor_destroy_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_destroy(NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_descriptor_destroy(NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_get_permissions_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then get the characteristic's permission, + * by using the invalid parameters and check for errors. + * @scenario Try to get the characteristic's permission, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_characteristic_get_permissions_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_get_permissions(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_characteristic_get_permissions(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_descriptor_get_permissions_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then get the descriptor's permission, + * by using the invalid parameters and check for errors. + * @scenario Try to get the descriptor's permission, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_descriptor_get_permissions_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_get_permissions(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_descriptor_get_permissions(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_create_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then create the GATT service, + * by using the invalid parameters and check for errors. + * @scenario Try to create the GATT service, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_service_create_n(void) +{ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_create(NULL, service_type, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_service_create(NULL, service_type, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_add_characteristic_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then add the characteristic to the service, + * by using the invalid parameters and check for errors. + * @scenario Try to add the characteristic to the service, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_service_add_characteristic_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_add_characteristic(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_service_add_characteristic(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_add_included_service_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then add the service to the specified service as included service, + * by using the invalid parameters and check for errors. + * @scenario Try to add the service to the specified service, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_service_add_included_service_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_add_included_service(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_service_add_included_service(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_get_server_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then get the GATT server handle from the specified service, + * by using the invalid parameters and check for errors. + * @scenario Try to get the GATT server handle from the specified service, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_service_get_server_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_get_server(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_service_get_server(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_create_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then create the GATT characteristic, + * by using the invalid parameters and check for errors. + * @scenario Try to create the GATT characteristic, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_characteristic_create_n(void) +{ + int permissions = BT_GATT_PERMISSION_READ; + int properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + char char_value[1] = {80}; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(NULL, permissions, properties, char_value, sizeof(char_value), NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_characteristic_create(NULL, permissions, properties, char_value, sizeof(char_value), NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_add_descriptor_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then add the descriptor to the characteristic, + * by using the invalid parameters and check for errors. + * @scenario Try to add the descriptor to the characteristic, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_characteristic_add_descriptor_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_add_descriptor(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_characteristic_add_descriptor(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_descriptor_create_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then create the GATT descriptor, + * by using the invalid parameters and check for errors. + * @scenario Try to create the GATT descriptor, + * where the parameters passed are invalid. + */ +int utc_bluetooth_bt_gatt_descriptor_create_n(void) +{ + char desc_value[2] = {0, 0}; + int permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_create(NULL, permissions, desc_value, sizeof(desc_value), NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + } else { + ret = bt_gatt_descriptor_create(NULL, permissions, desc_value, sizeof(desc_value), NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_initialize_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * initialize the GATT server and check for errors. + * @scenario Try to initialize the GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_initialize_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_initialize(); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_initialize(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_deinitialize_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * deinitialize the GATT server and check for errors. + * @scenario Try to deinitialize the GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_deinitialize_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_deinitialize(); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_deinitialize(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_create_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * create the GATT server and check for errors. + * @scenario Try to create the GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_create_n(void) +{ + bt_gatt_server_h server = NULL; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_destroy_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * destroy the GATT server and check for errors. + * @scenario Try to destroy the GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_destroy_n(void) +{ + bt_gatt_server_h server = NULL; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_destroy(server); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_destroy(server); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * register a callback function to be invoked when a read request is issued and check for errors. + * @scenario Try to register a callback function to be invoked when a read request is issued after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_n(void) +{ + bt_gatt_h characteristic = NULL; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_set_read_value_requested_cb(characteristic, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_set_read_value_requested_cb(characteristic, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + + +/** + * @testcase utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, i + * then deinitialize the bluetooth and register a callback function to be invoked + * when the remote device enables or disables the Notification/Indication for particular characteristics and check for errors. + * @scenario Try to register a callback function to be invoked + * when the remote device enables or disables the Notification/Indication for particular characteristics and check for errors + * after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_n(void) +{ + bt_gatt_h characteristic = NULL; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * register a callback function to be invoked when a write request is issued and check for errors. + * @scenario Try to register a callback function to be invoked when a write request is issued after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_n(void) +{ + bt_gatt_h characteristic = NULL; + + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_set_write_value_requested_cb(characteristic, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_set_write_value_requested_cb(characteristic, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * notify value change of the characteristic to the remote device and check for errors. + * @scenario Try to notify value change of the characteristic to the remote device after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_notify_characteristic_changed_value_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_notify_characteristic_changed_value(NULL, NULL, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_notify_characteristic_changed_value(NULL, NULL, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_get_service_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * get a service's GATT handle which has a specific UUID and check for errors. + * @scenario Try to get a service's GATT handle which has a specific UUID after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_get_service_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_get_service(NULL, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_get_service(NULL, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_foreach_services_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * invoke a callback function on each service that belongs to be specified GATT server and check for errors. + * @scenario Try to invoke a callback function on each service that belongs to be specified GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_foreach_services_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_foreach_services(NULL, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_foreach_services(NULL, NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_register_service_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * register a GATT service handle to GATT server and check for errors. + * @scenario Try to register a GATT service handle to GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_register_service_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_register_service(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_unregister_service_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * unregister a GATT service handle from the GATT server and check for errors. + * @scenario Try to unregister a GATT service handle from the GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_unregister_service_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_unregister_service(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_unregister_service(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_unregister_all_services_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * unregister the all GATT services handle from the GATT server and check for errors. + * @scenario Try to unregister the all GATT services handle from the GATT server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_unregister_all_services_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_unregister_all_services(NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_unregister_all_services(NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_start_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * start a server and check for errors. + * @scenario Try to start a server after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_start_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_start(); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_start(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_send_response_n + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted, then deinitialize the bluetooth and + * send response and check for errors. + * @scenario Try to send response after bluetooth de-initialization. + */ +int utc_bluetooth_bt_gatt_server_send_response_n(void) +{ + if(le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_send_response(0, 0, 0, 0, NULL, -1); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + } else { + ret = bt_gatt_server_send_response(0, 0, 0, 0, NULL, -1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + + #endif diff --git a/src/utc/bluetooth/utc_bluetooth_gatt_positive.c b/src/utc/bluetooth/utc_bluetooth_gatt_positive.c index 57098fe..7eb568a 100755 --- a/src/utc/bluetooth/utc_bluetooth_gatt_positive.c +++ b/src/utc/bluetooth/utc_bluetooth_gatt_positive.c @@ -190,3 +190,963 @@ int utc_bluetooth_bt_gatt_unset_connection_state_changed_cb_p(void) return 0; } + +/** + * @testcase utc_bluetooth_bt_gatt_service_destroy_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted then the GATT service handle is destroyed + * and checked for errors. + * scenario Call to destroy GATT service handle. + */ +int utc_bluetooth_bt_gatt_service_destroy_p(void) +{ + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_destroy(service); + assert_eq(ret, BT_ERROR_NONE); + } else { + ret = bt_gatt_service_destroy(service); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_destroy_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted then the GATT characteristic handle is destroyed + * and checked for errors. + * scenario Call to destroy GATT characteristic handle. + */ +int utc_bluetooth_bt_gatt_characteristic_destroy_p(void) +{ + bt_gatt_h characteristic = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_destroy(characteristic); + assert_eq(ret, BT_ERROR_NONE); + } else { + ret = bt_gatt_characteristic_destroy(characteristic); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_descriptor_destroy_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted then the GATT descriptor handle is destroyed + * and checked for errors. + * scenario Call to destroy GATT descriptor handle. + */ +int utc_bluetooth_bt_gatt_descriptor_destroy_p(void) +{ + bt_gatt_h descriptor = NULL; + char *desc_uuid = "2902"; + char desc_value[2] = {0, 0}; /* Notification & Indication */ + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_create(desc_uuid, permissions, desc_value, sizeof(desc_value), &descriptor); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_destroy(descriptor); + assert_eq(ret, BT_ERROR_NONE); + } else { + ret = bt_gatt_descriptor_destroy(descriptor); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_get_permissions_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create characteristic's handle and get characteristic's permission then ensure there is no error. + * And then, destroy the characteristic's handle. + * Else, get characteristic's permission and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_characteristic_get_permissions and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_characteristic_get_permissions_p(void) +{ + bt_gatt_h characteristic = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_get_permissions(characteristic, &permissions); + if (ret != BT_ERROR_NONE) + bt_gatt_characteristic_destroy(characteristic); + + assert_eq(ret, BT_ERROR_NONE); + bt_gatt_characteristic_destroy(characteristic); + } else { + ret = bt_gatt_characteristic_get_permissions(characteristic, &permissions); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_descriptor_get_permissions_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create descriptor's handle and get descriptor's permission then ensure there is no error. + * And then, destroy the descriptor's handle. + * Else, get descriptor's permission and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_descriptor_get_permissions and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_descriptor_get_permissions_p(void) +{ + bt_gatt_h descriptor = NULL; + char *desc_uuid = "2902"; + char desc_value[2] = {0, 0}; /* Notification & Indication */ + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_create(desc_uuid, permissions, desc_value, sizeof(desc_value), &descriptor); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_get_permissions(descriptor, &permissions); + if (ret != BT_ERROR_NONE) + bt_gatt_descriptor_destroy(descriptor); + + assert_eq(ret, BT_ERROR_NONE); + bt_gatt_descriptor_destroy(descriptor); + } else { + ret = bt_gatt_descriptor_get_permissions(descriptor, &permissions); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_create_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted then the GATT service is created + * for specific UUID/type and checked for errors. + * scenario Create the GATT service for specific UUID and service type. + */ +int utc_bluetooth_bt_gatt_service_create_p(void) +{ + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + } else { + ret = bt_gatt_service_create(service_uuid, service_type, &service); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_add_characteristic_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create GATT service handle and characteristic handle. + * Then, add the characteristic's handle to serivce's handle and ensure there is no error. + * Else, add the characteristic's handle to serivce's handle and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_service_add_characteristic and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_service_add_characteristic_p(void) +{ + bt_gatt_h service = NULL; + bt_gatt_h characteristic = NULL; + char *service_uuid = "180f"; /* Battery Service */ + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_add_characteristic(service, characteristic); + if (ret != BT_ERROR_NONE) { + bt_gatt_characteristic_destroy(characteristic); + bt_gatt_service_destroy(service); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_characteristic_destroy(characteristic); + bt_gatt_service_destroy(service); + } else { + ret = bt_gatt_service_add_characteristic(service, characteristic); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_add_included_service_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create GATT service handle and included service handle. + * Then, add the included service handle to service handle and ensure there is no error. + * Else, add the included service handle to service handle and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_service_add_included_service and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_service_add_included_service_p(void) +{ + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + bt_gatt_h included_service = NULL; + char *included_service_uuid = "180d"; /* Heart Rate Service */ + bt_gatt_service_type_e included_service_type = BT_GATT_SERVICE_TYPE_SECONDARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(included_service_uuid, included_service_type, &included_service); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_add_included_service(service, included_service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_service_destroy(included_service); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_service_destroy(included_service); + } else { + ret = bt_gatt_service_add_included_service(service, included_service); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_service_get_server_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. Then, register service to server and get server from service and ensure there is no error. + * Else, get GATT server handle from service and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_service_get_server on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_service_get_server_p(void) +{ + bt_gatt_server_h server = NULL; + bt_gatt_server_h get_server = NULL; + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) + bt_gatt_server_destroy(server); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_get_server(service, &get_server); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_service_get_server(service, &get_server); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_create_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted then the GATT characteristic is created + * for specific UUID/property and checked for errors. + * scenario Create the GATT characteristic for specific UUID and property. + */ +int utc_bluetooth_bt_gatt_characteristic_create_p(void) +{ + bt_gatt_h characteristic = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_characteristic_destroy(characteristic); + } else { + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_characteristic_add_descriptor_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create GATT characteristic's handle and descriptor's handle. + * Then, add the descriptor's handle to characteristic's handle and ensure there is no error. + * Else, add the descriptor's handle to characteristic's handle and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_characteristic_add_descriptor and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_characteristic_add_descriptor_p(void) +{ + bt_gatt_h characteristic = NULL; + bt_gatt_h descriptor = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char *desc_uuid = "2902"; + char char_value[1] = {80}; /* 80% */ + char desc_value[2] = {0, 0}; /* Notification & Indication */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE; + ret = bt_gatt_descriptor_create(desc_uuid, permissions, desc_value, sizeof(desc_value), &descriptor); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_add_descriptor(characteristic, descriptor); + if (ret != BT_ERROR_NONE) { + bt_gatt_descriptor_destroy(descriptor); + bt_gatt_characteristic_destroy(characteristic); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_descriptor_destroy(descriptor); + bt_gatt_characteristic_destroy(characteristic); + } else { + ret = bt_gatt_characteristic_add_descriptor(characteristic, descriptor); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_descriptor_create_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted then the GATT descriptor is created + * for specific UUID/permissions and checked for errors. + * scenario Create the GATT descriptor for specific UUID and permissions. + */ +int utc_bluetooth_bt_gatt_descriptor_create_p(void) +{ + bt_gatt_h descriptor = NULL; + char *desc_uuid = "2902"; + char desc_value[2] = {0, 0}; /* Notification & Indication */ + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_descriptor_create(desc_uuid, permissions, desc_value, sizeof(desc_value), &descriptor); + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_descriptor_destroy(descriptor); + } else { + ret = bt_gatt_descriptor_create(desc_uuid, permissions, desc_value, sizeof(desc_value), &descriptor); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_initialize_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, deinitialize the GATT server and initialize the GATT server and ensure there is no error. + * Else, initialize the GATT server and verify the result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_initialize on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_initialize_p(void) +{ + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_initialize(); + assert_eq(ret, BT_ERROR_NONE); + } else { + ret = bt_gatt_server_initialize(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_deinitialize_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, deinitialize the GATT server and ensure there is no error. + * Else, deinitialize the GATT server and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_deinitialize on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_deinitialize_p(void) +{ + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + } else { + ret = bt_gatt_server_deinitialize(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_create_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create GATT server's handle and ensure there is no error. + * Else, create GATT server's handle and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_create on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_create_p(void) +{ + bt_gatt_server_h server = NULL; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_destroy_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. If yes, create GATT server's handle and destroy GATT server's handle then ensure there is no error. + * Else, destroy GATT server's handle and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_destroy on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_destroy_p(void) +{ + bt_gatt_server_h server = NULL; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_destroy(server); + assert_eq(ret, BT_ERROR_NONE); + } else { + ret = bt_gatt_server_destroy(server); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT characteristic handle. Then, register a callback function to invoked when a read request + * for a specified characteristic is issued and ensure there is no error. + * Else, register a callback function and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_set_read_value_requested_cb on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_set_read_value_requested_cb_p(void) +{ + bt_gatt_h characteristic = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_set_read_value_requested_cb(characteristic, __bt_gatt_server_read_value_requested_cb_p, NULL); + if (ret != BT_ERROR_NONE) + bt_gatt_characteristic_destroy(characteristic); + + assert_eq(ret, BT_ERROR_NONE); + bt_gatt_characteristic_destroy(characteristic); + } else { + ret = bt_gatt_server_set_read_value_requested_cb(characteristic, __bt_gatt_server_read_value_requested_cb_p, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT characteristic handle. Then, register a callback function to invoked when the remote device + * enables or disables the Notification/Indication for particular characteristics and ensure there is no error. + * Else, register a callback function and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_set_characteristic_notification_state_change_cb on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_set_characteristic_notification_state_change_cb_p(void) +{ + bt_gatt_h characteristic = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic, __bt_gatt_server_notification_state_change_cb_p, NULL); + if (ret != BT_ERROR_NONE) + bt_gatt_characteristic_destroy(characteristic); + + assert_eq(ret, BT_ERROR_NONE); + bt_gatt_characteristic_destroy(characteristic); + } else { + ret = bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic, __bt_gatt_server_notification_state_change_cb_p, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT characteristic handle. Then, register a callback function to invoked when a value of + * characteristic has been changed cnd ensure there is no error. + * Else, register a callback function and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_set_write_value_requested_cb on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_set_write_value_requested_cb_p(void) +{ + bt_gatt_h characteristic = NULL; + char *char_uuid = "2a19"; /* Battery Level */ + char char_value[1] = {80}; /* 80% */ + bt_gatt_property_e properties = BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_NOTIFY; + bt_gatt_permission_e permissions = BT_GATT_PERMISSION_READ; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_characteristic_create(char_uuid, permissions, properties, char_value, sizeof(char_value), &characteristic); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_set_write_value_requested_cb(characteristic, __bt_gatt_server_write_value_requested_cb_p, NULL); + if (ret != BT_ERROR_NONE) + bt_gatt_characteristic_destroy(characteristic); + + assert_eq(ret, BT_ERROR_NONE); + bt_gatt_characteristic_destroy(characteristic); + } else { + ret = bt_gatt_server_set_write_value_requested_cb(characteristic, __bt_gatt_server_write_value_requested_cb_p, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_get_service_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. Then, register service to server and get service from servere and ensure there is no error. + * Else, get GATT service handle from server and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_get_service on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_get_service_p(void) +{ + bt_gatt_server_h server = NULL; + bt_gatt_server_h get_server = NULL; + bt_gatt_h service = NULL; + bt_gatt_h get_service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) + bt_gatt_server_destroy(server); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_get_service(server, service_uuid, &get_service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_server_get_service(server, service_uuid, &get_service); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_foreach_services_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. + * Then, register service to server and invokes a callback function on each service that belongs to the GATT server and ensure there is no error. + * Else, invokes a callback function on each service and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_foreach_services on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_foreach_services_p(void) +{ + bt_gatt_server_h server = NULL; + bt_gatt_server_h get_server = NULL; + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) + bt_gatt_server_destroy(server); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_foreach_services(server, __bt_gatt_server_foreach_svc_cb_p, NULL); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_server_foreach_services(server, __bt_gatt_server_foreach_svc_cb_p, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_register_service_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. Then, register service to server and ensure there is no error. + * Else, register service to server and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_register_service on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_register_service_p(void) +{ + bt_gatt_server_h server = NULL; + + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) + bt_gatt_server_destroy(server); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_server_register_service(server, service); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_unregister_service_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. Then, register service to server and unregister service and ensure there is no error. + * Else, unregister service from server and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_unregister_service on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_unregister_service_p(void) +{ + bt_gatt_server_h server = NULL; + + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) + bt_gatt_server_destroy(server); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_unregister_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_server_unregister_service(server, service); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_unregister_all_services_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. Then, register service to server and unregister all services and ensure there is no error. + * Else, unregister services from server and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_unregister_all_services on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_unregister_all_services_p(void) +{ + bt_gatt_server_h server = NULL; + + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) + bt_gatt_server_destroy(server); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_unregister_all_services(server); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + } else { + ret = bt_gatt_server_unregister_all_services(server); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_gatt_server_start_p + * @since_tizen 3.0 + * @description check if bluetooth LE is supported and startup_flag is asserted. + * If yes, create GATT server's handle and GATT service. Then, register service to server and start server and ensure there is no error. + * Else, start server and verify result as BT_ERROR_NOT_SUPPORTED. + * scenario Check if bluetooth LE is supported and startup_flag is asserted. Then, call bt_gatt_server_start on the device and check for BT_ERROR_NOE. + */ +int utc_bluetooth_bt_gatt_server_start_p(void) +{ + bt_gatt_server_h server = NULL; + + bt_gatt_h service = NULL; + char *service_uuid = "180f"; /* Battery Service */ + bt_gatt_service_type_e service_type = BT_GATT_SERVICE_TYPE_PRIMARY; + + if (le_supported) { + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_gatt_server_initialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_create(&server); + if (ret != BT_ERROR_NONE) + bt_gatt_server_deinitialize(); + + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_service_create(service_uuid, service_type, &service); + if (ret != BT_ERROR_NONE) { + bt_gatt_server_destroy(server); + bt_gatt_server_deinitialize(); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_register_service(server, service); + if (ret != BT_ERROR_NONE) { + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + bt_gatt_server_deinitialize(); + } + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_gatt_server_start(); + assert_eq(ret, BT_ERROR_NONE); + + bt_gatt_service_destroy(service); + bt_gatt_server_destroy(server); + bt_gatt_server_deinitialize(); + } else { + ret = bt_gatt_server_start(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + } + + return 0; +} + + -- 2.7.4