From: Anuj Jain Date: Sat, 23 Apr 2022 18:41:54 +0000 (+0530) Subject: [UTC][bluetooth][ACR-1694] Add test cases for LE L2CAP socket. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ecf29c602a199d47c1b1f1a53234e062a7c16f4;p=test%2Ftct%2Fnative%2Fapi.git [UTC][bluetooth][ACR-1694] Add test cases for LE L2CAP socket. Change-Id: I36290a7db429f30bce1090a27dcdc1aec76e0b00 Signed-off-by: Anuj Jain --- diff --git a/src/utc/bluetooth/CMakeLists.txt b/src/utc/bluetooth/CMakeLists.txt index 0be0fb690..5549b9f5b 100755 --- a/src/utc/bluetooth/CMakeLists.txt +++ b/src/utc/bluetooth/CMakeLists.txt @@ -30,6 +30,8 @@ utc_bluetooth_service_search_negative.c utc_bluetooth_service_search_positive.c utc_bluetooth_socket_negative.c utc_bluetooth_socket_positive.c +utc_bluetooth_le_l2cap_negative.c +utc_bluetooth_le_l2cap_positive.c utc_bluetooth_pbap_negative.c utc_bluetooth_pbap_positive.c utc_bluetooth_avrcp_control_positive.c @@ -62,6 +64,8 @@ utc_bluetooth_service_search_negative.c utc_bluetooth_service_search_positive.c utc_bluetooth_socket_negative.c utc_bluetooth_socket_positive.c +utc_bluetooth_le_l2cap_negative.c +utc_bluetooth_le_l2cap_positive.c utc_bluetooth_avrcp_control_positive.c utc_bluetooth_avrcp_control_negative.c ) @@ -92,6 +96,8 @@ utc_bluetooth_service_search_negative.c utc_bluetooth_service_search_positive.c utc_bluetooth_socket_negative.c utc_bluetooth_socket_positive.c +utc_bluetooth_le_l2cap_negative.c +utc_bluetooth_le_l2cap_positive.c utc_bluetooth_avrcp_control_positive.c utc_bluetooth_avrcp_control_negative.c ) diff --git a/src/utc/bluetooth/tct-bluetooth-core_mobile.h b/src/utc/bluetooth/tct-bluetooth-core_mobile.h index 3ce7a10a9..0211283d6 100755 --- a/src/utc/bluetooth/tct-bluetooth-core_mobile.h +++ b/src/utc/bluetooth/tct-bluetooth-core_mobile.h @@ -67,6 +67,10 @@ extern void utc_bluetooth_socket_negative_startup(void); extern void utc_bluetooth_socket_negative_cleanup(void); extern void utc_bluetooth_bt_socket_positive_startup(void); extern void utc_bluetooth_bt_socket_positive_cleanup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_negative_startup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_positive_startup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup(void); extern void utc_bluetooth_avrcp_control_positive_startup(void); extern void utc_bluetooth_avrcp_control_positive_cleanup(void); extern void utc_bluetooth_avrcp_control_negative_startup(void); @@ -486,6 +490,31 @@ extern int utc_bluetooth_bt_socket_unset_data_received_cb_p(void); extern int utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p(void); extern int utc_bluetooth_bt_socket_set_connection_requested_cb_p(void); extern int utc_bluetooth_bt_socket_unset_connection_requested_cb_p(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_n1(void); +extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_listen_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_accept_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_reject_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_get_l2cap_psm_n(void); +extern int utc_bluetooth_bt_socket_connect_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_disconnect_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_send_data_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_listen_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_get_l2cap_psm_p(void); +extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p(void); extern int utc_bluetooth_bt_avrcp_control_initialize_p(void); extern int utc_bluetooth_bt_avrcp_control_deinitialize_p(void); extern int utc_bluetooth_bt_avrcp_control_connect_n(void); @@ -919,6 +948,31 @@ testcase tc_array[] = { {"utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, {"utc_bluetooth_bt_socket_set_connection_requested_cb_p",utc_bluetooth_bt_socket_set_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, {"utc_bluetooth_bt_socket_unset_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_n",utc_bluetooth_bt_socket_create_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_n1",utc_bluetooth_bt_socket_create_l2cap_channel_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_destroy_l2cap_channel_n",utc_bluetooth_bt_socket_destroy_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_listen_l2cap_channel_n",utc_bluetooth_bt_socket_listen_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_accept_l2cap_channel_n",utc_bluetooth_bt_socket_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_reject_l2cap_channel_n",utc_bluetooth_bt_socket_reject_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_get_l2cap_psm_n",utc_bluetooth_bt_socket_get_l2cap_psm_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_connect_l2cap_channel_n",utc_bluetooth_bt_socket_connect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_disconnect_l2cap_channel_n",utc_bluetooth_bt_socket_disconnect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_send_data_l2cap_channel_n",utc_bluetooth_bt_socket_send_data_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_p",utc_bluetooth_bt_socket_create_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_listen_l2cap_channel_p",utc_bluetooth_bt_socket_listen_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_get_l2cap_psm_p",utc_bluetooth_bt_socket_get_l2cap_psm_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_destroy_l2cap_channel_p",utc_bluetooth_bt_socket_destroy_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, {"utc_bluetooth_bt_avrcp_control_initialize_p",utc_bluetooth_bt_avrcp_control_initialize_p,utc_bluetooth_avrcp_control_positive_startup,utc_bluetooth_avrcp_control_positive_cleanup}, {"utc_bluetooth_bt_avrcp_control_deinitialize_p",utc_bluetooth_bt_avrcp_control_deinitialize_p,utc_bluetooth_avrcp_control_positive_startup,utc_bluetooth_avrcp_control_positive_cleanup}, {"utc_bluetooth_bt_avrcp_control_connect_n",utc_bluetooth_bt_avrcp_control_connect_n,utc_bluetooth_avrcp_control_negative_startup,utc_bluetooth_avrcp_control_negative_cleanup}, diff --git a/src/utc/bluetooth/tct-bluetooth-core_tizeniot.h b/src/utc/bluetooth/tct-bluetooth-core_tizeniot.h index 3ce7a10a9..0211283d6 100644 --- a/src/utc/bluetooth/tct-bluetooth-core_tizeniot.h +++ b/src/utc/bluetooth/tct-bluetooth-core_tizeniot.h @@ -67,6 +67,10 @@ extern void utc_bluetooth_socket_negative_startup(void); extern void utc_bluetooth_socket_negative_cleanup(void); extern void utc_bluetooth_bt_socket_positive_startup(void); extern void utc_bluetooth_bt_socket_positive_cleanup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_negative_startup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_positive_startup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup(void); extern void utc_bluetooth_avrcp_control_positive_startup(void); extern void utc_bluetooth_avrcp_control_positive_cleanup(void); extern void utc_bluetooth_avrcp_control_negative_startup(void); @@ -486,6 +490,31 @@ extern int utc_bluetooth_bt_socket_unset_data_received_cb_p(void); extern int utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p(void); extern int utc_bluetooth_bt_socket_set_connection_requested_cb_p(void); extern int utc_bluetooth_bt_socket_unset_connection_requested_cb_p(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_n1(void); +extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_listen_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_accept_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_reject_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_get_l2cap_psm_n(void); +extern int utc_bluetooth_bt_socket_connect_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_disconnect_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_send_data_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_listen_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_get_l2cap_psm_p(void); +extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p(void); extern int utc_bluetooth_bt_avrcp_control_initialize_p(void); extern int utc_bluetooth_bt_avrcp_control_deinitialize_p(void); extern int utc_bluetooth_bt_avrcp_control_connect_n(void); @@ -919,6 +948,31 @@ testcase tc_array[] = { {"utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, {"utc_bluetooth_bt_socket_set_connection_requested_cb_p",utc_bluetooth_bt_socket_set_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, {"utc_bluetooth_bt_socket_unset_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_n",utc_bluetooth_bt_socket_create_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_n1",utc_bluetooth_bt_socket_create_l2cap_channel_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_destroy_l2cap_channel_n",utc_bluetooth_bt_socket_destroy_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_listen_l2cap_channel_n",utc_bluetooth_bt_socket_listen_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_accept_l2cap_channel_n",utc_bluetooth_bt_socket_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_reject_l2cap_channel_n",utc_bluetooth_bt_socket_reject_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_get_l2cap_psm_n",utc_bluetooth_bt_socket_get_l2cap_psm_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_connect_l2cap_channel_n",utc_bluetooth_bt_socket_connect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_disconnect_l2cap_channel_n",utc_bluetooth_bt_socket_disconnect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_send_data_l2cap_channel_n",utc_bluetooth_bt_socket_send_data_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_p",utc_bluetooth_bt_socket_create_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_listen_l2cap_channel_p",utc_bluetooth_bt_socket_listen_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_get_l2cap_psm_p",utc_bluetooth_bt_socket_get_l2cap_psm_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_destroy_l2cap_channel_p",utc_bluetooth_bt_socket_destroy_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, {"utc_bluetooth_bt_avrcp_control_initialize_p",utc_bluetooth_bt_avrcp_control_initialize_p,utc_bluetooth_avrcp_control_positive_startup,utc_bluetooth_avrcp_control_positive_cleanup}, {"utc_bluetooth_bt_avrcp_control_deinitialize_p",utc_bluetooth_bt_avrcp_control_deinitialize_p,utc_bluetooth_avrcp_control_positive_startup,utc_bluetooth_avrcp_control_positive_cleanup}, {"utc_bluetooth_bt_avrcp_control_connect_n",utc_bluetooth_bt_avrcp_control_connect_n,utc_bluetooth_avrcp_control_negative_startup,utc_bluetooth_avrcp_control_negative_cleanup}, diff --git a/src/utc/bluetooth/tct-bluetooth-core_wearable.h b/src/utc/bluetooth/tct-bluetooth-core_wearable.h index f4acbdfd5..bce0bbb26 100644 --- a/src/utc/bluetooth/tct-bluetooth-core_wearable.h +++ b/src/utc/bluetooth/tct-bluetooth-core_wearable.h @@ -67,6 +67,10 @@ extern void utc_bluetooth_socket_negative_startup(void); extern void utc_bluetooth_socket_negative_cleanup(void); extern void utc_bluetooth_bt_socket_positive_startup(void); extern void utc_bluetooth_bt_socket_positive_cleanup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_negative_startup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_positive_startup(void); +extern void utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup(void); extern void utc_bluetooth_pbap_negative_startup(void); extern void utc_bluetooth_pbap_negative_cleanup(void); extern void utc_bluetooth_pbap_positive_startup(void); @@ -502,6 +506,31 @@ extern int utc_bluetooth_bt_socket_unset_data_received_cb_p(void); extern int utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p(void); extern int utc_bluetooth_bt_socket_set_connection_requested_cb_p(void); extern int utc_bluetooth_bt_socket_unset_connection_requested_cb_p(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_n1(void); +extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_listen_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_accept_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_reject_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_get_l2cap_psm_n(void); +extern int utc_bluetooth_bt_socket_connect_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_disconnect_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_send_data_l2cap_channel_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_socket_create_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_listen_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_get_l2cap_psm_p(void); +extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_p(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p(void); +extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p(void); +extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p(void); extern int utc_bluetooth_bt_pbap_client_initialize_n(void); extern int utc_bluetooth_bt_pbap_client_deinitialize_n(void); extern int utc_bluetooth_bt_pbap_client_set_connection_state_changed_cb_n(void); @@ -962,6 +991,31 @@ testcase tc_array[] = { {"utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, {"utc_bluetooth_bt_socket_set_connection_requested_cb_p",utc_bluetooth_bt_socket_set_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, {"utc_bluetooth_bt_socket_unset_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_n",utc_bluetooth_bt_socket_create_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_n1",utc_bluetooth_bt_socket_create_l2cap_channel_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_destroy_l2cap_channel_n",utc_bluetooth_bt_socket_destroy_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_listen_l2cap_channel_n",utc_bluetooth_bt_socket_listen_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_accept_l2cap_channel_n",utc_bluetooth_bt_socket_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_reject_l2cap_channel_n",utc_bluetooth_bt_socket_reject_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_get_l2cap_psm_n",utc_bluetooth_bt_socket_get_l2cap_psm_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_connect_l2cap_channel_n",utc_bluetooth_bt_socket_connect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_disconnect_l2cap_channel_n",utc_bluetooth_bt_socket_disconnect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_send_data_l2cap_channel_n",utc_bluetooth_bt_socket_send_data_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_create_l2cap_channel_p",utc_bluetooth_bt_socket_create_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_listen_l2cap_channel_p",utc_bluetooth_bt_socket_listen_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_get_l2cap_psm_p",utc_bluetooth_bt_socket_get_l2cap_psm_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_destroy_l2cap_channel_p",utc_bluetooth_bt_socket_destroy_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, + {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup}, {"utc_bluetooth_bt_pbap_client_initialize_n",utc_bluetooth_bt_pbap_client_initialize_n,utc_bluetooth_pbap_negative_startup,utc_bluetooth_pbap_negative_cleanup}, {"utc_bluetooth_bt_pbap_client_deinitialize_n",utc_bluetooth_bt_pbap_client_deinitialize_n,utc_bluetooth_pbap_negative_startup,utc_bluetooth_pbap_negative_cleanup}, {"utc_bluetooth_bt_pbap_client_set_connection_state_changed_cb_n",utc_bluetooth_bt_pbap_client_set_connection_state_changed_cb_n,utc_bluetooth_pbap_negative_startup,utc_bluetooth_pbap_negative_cleanup}, diff --git a/src/utc/bluetooth/utc_bluetooth_le_l2cap_negative.c b/src/utc/bluetooth/utc_bluetooth_le_l2cap_negative.c new file mode 100755 index 000000000..049e7a5e5 --- /dev/null +++ b/src/utc/bluetooth/utc_bluetooth_le_l2cap_negative.c @@ -0,0 +1,520 @@ +// +// Copyright (c) 2022 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "assert.h" +#include +#include +#include +#include +#include +#include + +static int startup_flag = BT_ERROR_NONE; +static int ret = BT_ERROR_NONE; +static const char *data = "dts_test"; +static char *address = "D8:90:E8:EE:2B:3A"; +static bool bt_supported = false; +static bool le_supported = false; +static bool le_coc_supported = false; + +/** + * @function utc_bluetooth_bt_socket_l2cap_channel_negative_startup + * @description Get system information to check for the support of Bluetooth. If BT is supported on the device, + * then intialize the bluetooth on the device successfully. + * @parameter NA + * @return NA + */ +void utc_bluetooth_bt_socket_l2cap_channel_negative_startup(void) +{ + bt_supported = false; + system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth", &bt_supported); + + le_supported = false; + system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le", &le_supported); + + le_coc_supported = false; + system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le.coc", &le_coc_supported); + + startup_flag = BT_ERROR_NONE; + + if(bt_supported && le_supported && le_coc_supported) { + ret = bt_initialize(); + if(BT_ERROR_NONE != ret) { + fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__); + fprintf(stderr, "bt_initialize failed (code: %d)\n", ret); + startup_flag = ret; + return; + } + } +} + +/** + * @function utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup + * @description Get system information to check for the support of Bluetooth. If BT is supported on the device, + * then deintialize the bluetooth on the device successfully. + * @parameter NA + * @return NA + */ +void utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup(void) +{ + if(bt_supported && le_supported && le_coc_supported) + bt_deinitialize(); +} + +/** + * @testcase utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, set the connection + * state changed callback and check for error. If bluetooth is initialized, set connection state changed callback with NULL params. + * @senario Check if BT is supported and then set bt_socket_l2cap_channel_set_connection_state_changed_cb with NULL parameters. + * Check for error BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_l2cap_channel_set_connection_state_changed_cb_n1 + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, set the connection + * state changed callback and check for error. If bluetooth is initialized, set connection state changed callback with NULL params. + * @senario Check if BT is supported and then set bt_socket_l2cap_channel_set_connection_state_changed_cb with NULL parameters. + * Check for error BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_l2cap_channel_unset_connection_state_changed_cb_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * unset the connection state changed callback and check for error. If bluetooth is initialized, deinitialize + * bluetooth and unset connection state changed callback. + * @senario Check if BT is supported and then deinitialize bt and unset connection state changed callback on the device + * and check for BT_ERROR_NOT_INITIALIZED. + */ +int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb(); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_create_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, create l2cap channel + * and check for error. If bluetooth is initialized, deinitialize bt and create l2cap channel with NULL parameters. + * @senario Check if BT is supported and then deinitialize bluetooth and create l2cap channel on the device and check for BT_ERROR_NOT_INITIALIZED. + */ +int utc_bluetooth_bt_socket_create_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_create_l2cap_channel(0, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(0, NULL); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_create_l2cap_channel_n1 + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, create l2cap channel + * and check for error. If bluetooth is initialized, create l2cap channel with NULL parameters. + * @senario Check if BT is supported then create l2cap channel on the device and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_create_l2cap_channel_n1(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_create_l2cap_channel(0, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(0, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_destroy_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * destroy the l2cap channel and check for error. If bluetooth is initialized, then destroy l2cap channel + * with invalid parameter. + * @senario Check if BT is supported and then call bt_socket_destroy_l2cap_channel on the device with invalid parameter. + * Check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_destroy_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_destroy_l2cap_channel(-1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_destroy_l2cap_channel(-1); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_listen_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_listen_l2cap_channel and check for error. If bluetooth is initialized, then + * listen for l2cap connection with invalid paramters. + * @senario Check if BT is supported and then call bt_socket_listen_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_listen_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_listen_l2cap_channel(1, 1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_listen_l2cap_channel(1, 1); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_accept_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_accept_l2cap_channel and check for error. If bluetooth is initialized, then + * accept l2cap connection with invalid paramters. + * @senario Check if BT is supported and then call bt_socket_accept_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_accept_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_accept_l2cap_channel(1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_accept_l2cap_channel(1); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_reject_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_reject_l2cap_channel and check for error. If bluetooth is initialized, then + * reject l2cap connection with invalid paramters. + * @senario Check if BT is supported and then call bt_socket_reject_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_reject_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_reject_l2cap_channel(1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_reject_l2cap_channel(1); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_listen_and_accept_l2cap_channel and check for error. If bluetooth is initialized, then + * listen and accept for l2cap connection with invalid paramters. + * @senario Check if BT is supported and then call bt_socket_listen_and_accept_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_listen_and_accept_l2cap_channel(1, 1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_listen_and_accept_l2cap_channel(1, 1); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_get_l2cap_psm_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_get_l2cap_psm and check for error. If bluetooth is initialized, then + * get psm for l2cap connection with invalid paramters. + * @senario Check if BT is supported and then call bt_socket_get_l2cap_psm on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_get_l2cap_psm_n(void) +{ + int psm = -1; + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_get_l2cap_psm(1, &psm); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_get_l2cap_psm(1, &psm); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_connect_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_connect_l2cap_channel and check for error. If bluetooth is initialized, then + * call l2cap connect api with invalid paramters. + * @senario Check if BT is supported and then call bt_socket_connect_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_connect_l2cap_channel_n(void) +{ + int psm = -1; + + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_connect_l2cap_channel(address, psm); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_connect_l2cap_channel(address, psm); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_disconnect_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_disconnect_l2cap_channel and check for error. If bluetooth is initialized, then call + * l2cap disconnect api with invalid paramter. + * @senario Check if BT is supported and then call bt_socket_disconnect_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_disconnect_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_disconnect_l2cap_channel(-1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_disconnect_l2cap_channel(-1); + + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_send_data_l2cap_channel_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_send_data_l2cap_channel and check for error. If bluetooth is initialized, then call send data over l2cap channel + * with invalid paramter. + * @senario Check if BT is supported and then call bt_socket_send_data_l2cap_channel on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_send_data_l2cap_channel_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_send_data_l2cap_channel(1, data, strlen(data)); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_send_data_l2cap_channel(1, data, strlen(data)); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * set bt_socket_set_l2cap_channel_connection_requested_cb and check for error. If bluetooth is initialized, then + * set connected requested callback with invalid paramter. + * @senario Check if BT is supported and then call bt_socket_set_l2cap_channel_connection_requested_cb on the device with invalid parameters + * and check for BT_ERROR_INVALID_PARAMETER. + */ +int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_set_l2cap_channel_connection_requested_cb(NULL, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_requested_cb(NULL, NULL); + assert_eq(ret, BT_ERROR_INVALID_PARAMETER); + + return 0; +} + +static void bt_socket_connection_requested_cb_func (int socket_fd, const char *remote_address, void *user_data) { +} + +/** + * @testcase utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_unset_l2cap_channel_connection_requested_cb and check for error. If bluetooth is initialized, then deinitlaize bluetooth and + * unset connected requested callbackr. + * @senario Check if BT is supported then deinitialize bluetooth and call bt_socket_unset_l2cap_channel_connection_requested_cb on the device + * and check for BT_ERROR_NOT_INITIALIZED. + */ +int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_unset_l2cap_channel_connection_requested_cb(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_deinitialize(); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_unset_l2cap_channel_connection_requested_cb(); + assert_eq(ret, BT_ERROR_NOT_INITIALIZED); + + bt_deinitialize(); + bt_socket_unset_l2cap_channel_connection_requested_cb(); + + return 0; +} diff --git a/src/utc/bluetooth/utc_bluetooth_le_l2cap_positive.c b/src/utc/bluetooth/utc_bluetooth_le_l2cap_positive.c new file mode 100755 index 000000000..590642d4c --- /dev/null +++ b/src/utc/bluetooth/utc_bluetooth_le_l2cap_positive.c @@ -0,0 +1,350 @@ +// +// Copyright (c) 2022 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "assert.h" +#include +#include +#include +#include +#include +#include + +static int startup_flag = BT_ERROR_NONE; +static int socket_fd = 0; +static int ret = BT_ERROR_NONE; +static int l2cap_test_psm = 37; +static bool bt_supported = false; +static bool le_supported = false; +static bool le_coc_supported = false; + +static void socket_l2cap_channel_connection_state_changed_cb_for_socket_p(int result, + bt_socket_connection_state_e connection_state, + bt_socket_l2cap_le_connection_s *connection, void *user_data) +{ +} + +/** + * @function utc_bluetooth_bt_socket_l2cap_channel_positive_startup + * @description Get system information to check for the support of Bluetooth. If BT is supported on the device, + * then intialize the bluetooth on the device successfully and retrieve the adapter state. + * @parameter NA + * @return NA + */ +void utc_bluetooth_bt_socket_l2cap_channel_positive_startup(void) +{ + bt_supported = false; + system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth", &bt_supported); + + le_supported = false; + system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le", &le_supported); + + le_coc_supported = false; + system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le.coc", &le_coc_supported); + + startup_flag = BT_ERROR_NONE; + + if(bt_supported && le_supported && le_coc_supported) { + ret = bt_initialize(); + if(BT_ERROR_NONE != ret) { + fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__); + fprintf(stderr, "bt_initialize failed (code: %d)\n", ret); + startup_flag = ret; + return; + } + + bt_adapter_state_e adapter_state = BT_ADAPTER_DISABLED; + + ret = bt_adapter_get_state(&adapter_state); + if (adapter_state != BT_ADAPTER_ENABLED) { + fprintf(stdout, "BT is not enabled!!"); + startup_flag = BT_ERROR_NOT_ENABLED; + } + } +} + +/** + * @function utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup + * @description Get system information to check for the support of Bluetooth. If BT is supported on the device, + * then deintialize the bluetooth on the device successfully. + * @parameter NA + * @return NA + */ +void utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup(void) +{ + if(bt_supported && le_supported && le_coc_supported) + bt_deinitialize(); +} + +/** + * @testcase utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, set the connection + * state changed callback and check for error. If bluetooth is initialized, set and unset connection state changed callback successfully. + * @senario Check if BT is supported and then set bt_socket_set_l2cap_channel_connection_state_changed_cb on the device and check for expected result. + */ +int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(socket_l2cap_channel_connection_state_changed_cb_for_socket_p, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(socket_l2cap_channel_connection_state_changed_cb_for_socket_p, NULL); + assert_eq(ret, BT_ERROR_NONE); + + bt_socket_unset_l2cap_channel_connection_state_changed_cb(); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_create_l2cap_channel_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, create l2cap channel + * and check for error. If bluetooth is initialized, then create l2cap channel successfully. + * @senario Check if BT is supported and then call bt_socket_create_l2cap_channel on the device and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_create_l2cap_channel_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_destroy_l2cap_channel(socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_listen_l2cap_channel_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_listen_l2cap_channel and check for error. If bluetooth is initialized, then create l2cap channel + * and listen for l2cap connection successfully. + * @senario Check if BT is supported and then call bt_socket_create_l2cap_channel and bt_socket_listen_l2cap_channel on the device + * and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_listen_l2cap_channel_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_listen_l2cap_channel(socket_fd, 1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_listen_l2cap_channel(socket_fd, 1); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_destroy_l2cap_channel(socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_listen_and_accept_l2cap_channel and check for error. If bluetooth is initialized, then create l2cap channel + * and listen and accept for l2cap connection successfully. + * @senario Check if BT is supported and then call bt_socket_create_l2cap_channel and bt_socket_listen_and_accept_l2cap_channel on the device + * and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_listen_and_accept_l2cap_channel(socket_fd, 1); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_listen_and_accept_l2cap_channel(socket_fd, 1); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_destroy_l2cap_channel(socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_get_l2cap_psm_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * call bt_socket_get_l2cap_psm and check for error. If bluetooth is initialized, then create l2cap channel + * and get psm for l2cap channel successfully. + * @senario Check if BT is supported and then call bt_socket_create_l2cap_channel, bt_socket_listen_and_accept_l2cap_channel + * and bt_socket_get_l2cap_psm on the device and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_get_l2cap_psm_p(void) +{ + int psm = -1; + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_get_l2cap_psm(socket_fd, &psm); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_listen_and_accept_l2cap_channel(socket_fd, 1); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_get_l2cap_psm(socket_fd, &psm); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_destroy_l2cap_channel(socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_destroy_l2cap_channel_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * destroy the l2cap channel and check for error. If bluetooth is initialized, then create l2cap channel + * and destroy l2cap channel successfully. + * @senario Check if BT is supported and then call bt_socket_create_l2cap_channel and bt_socket_destroy_l2cap_channel on the device + * and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_destroy_l2cap_channel_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_destroy_l2cap_channel(socket_fd); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_destroy_l2cap_channel(socket_fd); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * unset the connection state changed callback and check for error. If bluetooth is initialized, then set + * connection state changed callback and unset connection state changed successfully. + * @senario Check if BT is supported and then set and unset connection state changed callback on the device + * and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(socket_l2cap_channel_connection_state_changed_cb_for_socket_p, NULL); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb(); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +} + +static void bt_socket_connection_requested_cb_func(int socket_fd, const char *remote_address, void *user_data) { +} + +/** + * @testcase utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * set the connection requested callback and check for error. If bluetooth is initialized, then set + * connection requested callback and unset connection requested callback successfully. + * @senario Check if BT is supported and then set and unset connection requested callback on the device + * and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL); + assert_eq(ret, BT_ERROR_NONE); + + bt_socket_unset_l2cap_channel_connection_requested_cb(); + + return 0; +} + +/** + * @testcase utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p + * @since_tizen 7.0 + * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device, + * unset the connection requested callback and check for error. If bluetooth is initialized, then set + * connection requested callback and unset connection requested callback successfully and check for error. + * @senario Check if BT is supported and then set and unset connection requested callback on the device + * and check for BT_ERROR_NONE. + */ +int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p(void) +{ + if(!bt_supported || !le_supported || !le_coc_supported) { + ret = bt_socket_unset_l2cap_channel_connection_requested_cb(); + assert_eq(ret, BT_ERROR_NOT_SUPPORTED); + return 0; + } + + assert_eq(startup_flag, BT_ERROR_NONE); + + ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL); + assert_eq(ret, BT_ERROR_NONE); + + ret = bt_socket_unset_l2cap_channel_connection_requested_cb(); + assert_eq(ret, BT_ERROR_NONE); + + return 0; +}