[ITC][Bluetooth][ACR-1787] TCs added for advertising APIs 60/298760/4
authorShobhit Verma <shobhit.v@samsung.com>
Wed, 13 Sep 2023 07:42:56 +0000 (13:12 +0530)
committerShobhit Verma <shobhit.v@samsung.com>
Wed, 13 Sep 2023 09:21:29 +0000 (14:51 +0530)
Change-Id: Ifa06f8fd0aaceb14406babbc86db33be5200ed77
Signed-off-by: Shobhit Verma <shobhit.v@samsung.com>
src/itc/bluetooth/ITs-bluetooth-adapter.c
src/itc/bluetooth/ITs-bluetooth-common.c
src/itc/bluetooth/ITs-bluetooth-common.h
src/itc/bluetooth/tct-bluetooth-native_mobile.h
src/itc/bluetooth/tct-bluetooth-native_tizeniot.h
src/itc/bluetooth/tct-bluetooth-native_tv.h
src/itc/bluetooth/tct-bluetooth-native_wearable.h

index 0655be9126e3efd31a20bb00c47bdb20e86ff921..7a8274199b33f4b92236791b98d76bfe4aa32ac8 100755 (executable)
@@ -32,6 +32,19 @@ static GMainLoop *mainloop = NULL;
 /**
 * @brief Callback funtions
 */
+
+static void Bluetooth_adapter_le_new_scan_result_cb(int nResult, bt_new_scan_result_h handle, void *user_data)
+{
+       FPRINTF("[Line : %d][%s] Callback invoked for LE  Start Scan\\n", __LINE__, API_NAMESPACE);
+       FPRINTF("[Line : %d][%s] Result value: %d\\n", __LINE__, API_NAMESPACE, nResult);
+       g_bCallbackResult = true;
+       if ( g_pMainLoop )
+       {
+               g_main_loop_quit(g_pMainLoop);
+       }
+}
+
+
 static void Bluetooth_adapter_state_changed_cb_p(int nResult, bt_adapter_state_e adapter_state, void *user_data)
 {
        FPRINTF("[Line : %d][%s] Callback invoked for Adapter state change\\n", __LINE__, API_NAMESPACE);
@@ -212,6 +225,7 @@ void ITs_bluetooth_startup(void)
 #if (defined(MOBILE) || defined(WEARABLE)  || defined(TIZENIOT)) //Starts MOBILE or WEARABLE or TIZENIOT
        g_bBluetoothIsSupported = TCTCheckSystemInfoFeatureSupported(BLUETOOTH_FEATURE, API_NAMESPACE);
        g_bBluetoothIsOOBSupported = TCTCheckSystemInfoFeatureSupported(BLUETOOTH_OOB_FEATURE, API_NAMESPACE);
+       g_bBluetoothIsLEAdvExtSupported = TCTCheckSystemInfoFeatureSupported(BLUETOOTH_LE_ADV_EXT_FEATURE, API_NAMESPACE);
 #else
        g_bBluetoothIsSupported = true;
 #endif  // End MOBILE or WEARABLE or TIZENIOT
@@ -977,3 +991,344 @@ int ITc_bluetooth_adapter_bt_adapter_get_local_oob_ext_data_p(void)
 }
 
 
+//& purpose: Starts the LE scan to find LE advertisement
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Starts the LE scan to find LE advertisement, If a LE advertisement is found, calback will be invoked
+* @scenario                            Call bt_adapter_le_start_scan_new API and check is callback is invoked in case LE advertisement found
+* @apicovered                  bt_adapter_le_start_scan_new
+* @passcase                            When bt_adapter_le_start_scan_new is successful
+* @failcase                            If target APIs bt_adapter_le_start_scan_new fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p(void)
+{
+       START_TEST;
+
+       //Target API
+       int nRetVal = bt_adapter_le_start_scan_new(Bluetooth_adapter_le_new_scan_result_cb, NULL);
+       if (g_bBluetoothIsLEAdvExtSupported == false)
+       {
+               PRINT_RESULT(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_start_scan_new", BluetoothGetError(nRetVal));
+               return 0;
+       }
+       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_start_scan_new", BluetoothGetError(nRetVal));
+       wait_for_async();
+
+       bt_adapter_le_stop_scan();
+       return 0;
+}
+
+//& purpose: Sets Bluetooth LE scan role
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Sets Bluetooth LE scan role
+* @scenario                            Sets Bluetooth LE scan role
+* @apicovered                  bt_adapter_le_set_scan_role
+* @passcase                            When bt_adapter_le_set_scan_role is successful
+* @failcase                            If target APIs bt_adapter_le_set_scan_role fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p(void)
+{
+       START_TEST;
+
+       int nRetVal = 0;
+       bt_adapter_le_scan_role_e eScanRole[]=
+       {
+               BT_ADAPTER_LE_SCAN_ALL,
+               BT_ADAPTER_LE_SCAN_LEGACY_ONLY,
+               BT_ADAPTER_LE_SCAN_EXTENDED_ONLY
+       };
+       int nEnumSize = sizeof(eScanRole) / sizeof(eScanRole[0]);
+
+       for (int enum_counter =0; enum_counter< nEnumSize; enum_counter++)
+       {
+               FPRINTF("[Line : %d][%s] bt_adapter_le_set_scan_role API called for enum: [ %s ]\\n", __LINE__, API_NAMESPACE, BluetoothGetLEScanRoleEnumString(eScanRole[enum_counter]));
+               nRetVal = bt_adapter_le_set_scan_role(eScanRole[enum_counter]);
+               if (g_bBluetoothIsLEAdvExtSupported == false)
+               {
+                       PRINT_RESULT(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_set_scan_role", BluetoothGetError(nRetVal));
+               }
+               else
+               {
+                       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_set_scan_role", BluetoothGetError(nRetVal));
+               }
+       }
+       return 0;
+}
+
+
+//& purpose: Sets Bluetooth LE scan phy
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Sets Bluetooth LE scan phy
+* @scenario                            Sets Bluetooth LE scan phy
+* @apicovered                  bt_adapter_le_set_scan_phy
+* @passcase                            When bt_adapter_le_set_scan_phy is successful
+* @failcase                            If target APIs bt_adapter_le_set_scan_phy fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p(void)
+{
+       START_TEST;
+
+       int nRetVal = 0;
+       bt_adapter_le_phy_e eScanPhy[]=
+       {
+               BT_LE_ALL_PHY,
+               BT_LE_1M_PHY,
+               BT_LE_2M_PHY,
+               BT_LE_CODED_PHY
+       };
+       int nEnumSize = sizeof(eScanPhy) / sizeof(eScanPhy[0]);
+       for (int enum_counter =0; enum_counter< nEnumSize; enum_counter++)
+       {
+               FPRINTF("[Line : %d][%s] bt_adapter_le_set_scan_phy API is called for enum: [ %s ]\\n", __LINE__, API_NAMESPACE, BluetoothGetLEScanPhyEnumString(eScanPhy[enum_counter]));
+               nRetVal = bt_adapter_le_set_scan_phy(eScanPhy[enum_counter]);
+               if (g_bBluetoothIsLEAdvExtSupported == false)
+               {
+                       PRINT_RESULT(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_set_scan_phy", BluetoothGetError(nRetVal));
+               }
+               else
+               {
+                       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_set_scan_phy", BluetoothGetError(nRetVal));
+               }
+       }
+       return 0;
+}
+
+
+//& purpose: Sets Bluetooth LE advertising legacy mode
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Sets Bluetooth LE advertising legacy mode
+* @scenario                            Create advertiser and sets Bluetooth LE advertising legacy mode
+* @apicovered                  bt_adapter_le_create_advertiser, bt_adapter_le_set_advertising_legacy_mode and bt_adapter_le_destroy_advertiser
+* @passcase                            When bt_adapter_le_set_advertising_legacy_mode is successful
+* @failcase                            If target APIs bt_adapter_le_set_advertising_legacy_mode fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p(void)
+{
+       START_TEST;
+       bt_advertiser_h hAdvertiser = NULL;
+       int nRetVal = 0;
+
+       nRetVal = bt_adapter_le_create_advertiser(&hAdvertiser);
+       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_create_advertiser", BluetoothGetError(nRetVal));
+       CHECK_HANDLE(hAdvertiser,"bt_adapter_le_create_advertiser");
+
+       if (g_bBluetoothIsLEAdvExtSupported == false)
+       {
+               nRetVal = bt_adapter_le_set_advertising_legacy_mode(hAdvertiser, true);
+               PRINT_RESULT_CLEANUP(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_set_advertising_legacy_mode", BluetoothGetError(nRetVal), bt_adapter_le_destroy_advertiser(hAdvertiser));
+               bt_adapter_le_destroy_advertiser(hAdvertiser);
+               return 0;
+       }
+
+       nRetVal = bt_adapter_le_set_advertising_legacy_mode(hAdvertiser, true);
+       PRINT_RESULT_CLEANUP(BT_ERROR_NONE, nRetVal, "bt_adapter_le_set_advertising_legacy_mode", BluetoothGetError(nRetVal), bt_adapter_le_destroy_advertiser(hAdvertiser));
+
+       nRetVal = bt_adapter_le_destroy_advertiser(hAdvertiser);
+       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_destroy_advertiser", BluetoothGetError(nRetVal));
+
+       return 0;
+}
+
+
+//& purpose: Sets Bluetooth LE advertising primary and secondary phy
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Sets Bluetooth LE advertising primary & secondary phy
+* @scenario                            Sets Bluetooth LE advertising primary & secondary phy
+* @apicovered                  bt_adapter_le_set_advertising_primary_phy and bt_adapter_le_set_advertising_secondary_phy
+* @passcase                            When bt_adapter_le_set_advertising_primary_phy and bt_adapter_le_set_advertising_secondary_phy is successful
+* @failcase                            If target APIs bt_adapter_le_set_advertising_primary_phy Or bt_adapter_le_set_advertising_secondary_phy fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p(void)
+{
+       START_TEST;
+       bt_advertiser_h hAdvertiser = NULL;
+       int nRetVal = 0;
+       bt_adapter_le_phy_e eScanPhy[]=
+       {
+               BT_LE_ALL_PHY,
+               BT_LE_1M_PHY,
+               BT_LE_2M_PHY,
+               BT_LE_CODED_PHY
+       };
+       int nEnumSize = sizeof(eScanPhy) / sizeof(eScanPhy[0]);
+
+       nRetVal = bt_adapter_le_create_advertiser(&hAdvertiser);
+       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_create_advertiser", BluetoothGetError(nRetVal));
+       CHECK_HANDLE(hAdvertiser,"bt_adapter_le_create_advertiser");
+
+       for (int enum_counter =0; enum_counter< nEnumSize; enum_counter++)
+       {
+                       if (g_bBluetoothIsLEAdvExtSupported == false)
+                       {
+                               FPRINTF("[Line : %d][%s] bt_adapter_le_set_advertising_primary_phy API is called for enum: [ %s ]\\n", __LINE__, API_NAMESPACE, BluetoothGetLEScanPhyEnumString(eScanPhy[enum_counter]));
+                               nRetVal = bt_adapter_le_set_advertising_primary_phy(hAdvertiser, eScanPhy[enum_counter]);
+                               PRINT_RESULT_CLEANUP(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_set_advertising_primary_phy", BluetoothGetError(nRetVal), bt_adapter_le_destroy_advertiser(hAdvertiser));
+
+                               FPRINTF("[Line : %d][%s] bt_adapter_le_set_advertising_secondary_phy API is called for enum: [ %s ]\\n", __LINE__, API_NAMESPACE, BluetoothGetLEScanPhyEnumString(eScanPhy[enum_counter]));
+                               nRetVal = bt_adapter_le_set_advertising_secondary_phy(hAdvertiser, eScanPhy[enum_counter]);
+                               PRINT_RESULT_CLEANUP(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_set_advertising_secondary_phy", BluetoothGetError(nRetVal), bt_adapter_le_destroy_advertiser(hAdvertiser));
+                       }
+                       else
+                       {
+                               FPRINTF("[Line : %d][%s] bt_adapter_le_set_advertising_primary_phy API is called for enum: [ %s ]\\n", __LINE__, API_NAMESPACE, BluetoothGetLEScanPhyEnumString(eScanPhy[enum_counter]));                               
+                               nRetVal = bt_adapter_le_set_advertising_primary_phy(hAdvertiser, eScanPhy[enum_counter]);
+                               PRINT_RESULT_CLEANUP(BT_ERROR_NONE, nRetVal, "bt_adapter_le_set_advertising_primary_phy", BluetoothGetError(nRetVal), bt_adapter_le_destroy_advertiser(hAdvertiser));
+
+                               FPRINTF("[Line : %d][%s] bt_adapter_le_set_advertising_secondary_phy API is called for enum: [ %s ]\\n", __LINE__, API_NAMESPACE, BluetoothGetLEScanPhyEnumString(eScanPhy[enum_counter]));
+                               nRetVal = bt_adapter_le_set_advertising_secondary_phy(hAdvertiser, eScanPhy[enum_counter]);
+                               PRINT_RESULT_CLEANUP(BT_ERROR_NONE, nRetVal, "bt_adapter_le_set_advertising_secondary_phy", BluetoothGetError(nRetVal), bt_adapter_le_destroy_advertiser(hAdvertiser));
+                       }
+       }
+
+       nRetVal = bt_adapter_le_destroy_advertiser(hAdvertiser);
+       PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_destroy_advertiser", BluetoothGetError(nRetVal));
+
+       return 0;
+}
+
+
+
+//& purpose: Checks if LE Extended Advertising feature is supported or not
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Check LE Extended Advertising feature is supported or not
+* @scenario                            Check LE Extended Advertising feature is supported or not
+* @apicovered                  bt_adapter_le_is_extended_advertising_supported
+* @passcase                            When bt_adapter_le_is_extended_advertising_supported is successful
+* @failcase                            If target APIs bt_adapter_le_is_extended_advertising_supported fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p(void)
+{
+       START_TEST;
+       int nRetVal = 0;
+       bool bIsSupported = false;
+
+       nRetVal = bt_adapter_le_is_extended_advertising_supported(&bIsSupported);
+       if (g_bBluetoothIsLEAdvExtSupported == false)
+       {
+               PRINT_RESULT(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_is_extended_advertising_supported", BluetoothGetError(nRetVal));
+       }
+       else
+       {
+               PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_is_extended_advertising_supported", BluetoothGetError(nRetVal));
+       }
+
+       return 0;
+}
+
+
+//& purpose: Checks if LE Extended Scan feature is supported or not
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Check LE Extended Scan feature is supported or not
+* @scenario                            Check LE Extended Scan feature is supported or not
+* @apicovered                  bt_adapter_le_is_extended_scan_supported
+* @passcase                            When bt_adapter_le_is_extended_scan_supported is successful
+* @failcase                            If target APIs bt_adapter_le_is_extended_scan_supported fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p(void)
+{
+       START_TEST;
+       int nRetVal = 0;
+       bool bIsSupported = false;
+
+       nRetVal = bt_adapter_le_is_extended_scan_supported(&bIsSupported);
+       if (g_bBluetoothIsLEAdvExtSupported == false)
+       {
+               PRINT_RESULT(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_is_extended_scan_supported", BluetoothGetError(nRetVal));
+       }
+       else
+       {
+               PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_is_extended_scan_supported", BluetoothGetError(nRetVal));
+       }
+
+       return 0;
+}
+
+//& purpose: Gets maximum advertisement data length supported by controller.
+//& type: auto
+/**
+* @testcase                    ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p
+* @since                               8.0
+* @author                              SRID(shobhit.v)
+* @reviewer                            SRID(tarun1.kumar)
+* @type                                        auto
+* @description                 Gets maximum advertisement data length supported by controller.
+* @scenario                            Gets maximum advertisement data length supported by controller.
+* @apicovered                  bt_adapter_le_get_maximum_advertising_data_length
+* @passcase                            When bt_adapter_le_get_maximum_advertising_data_length is successful
+* @failcase                            If target APIs bt_adapter_le_get_maximum_advertising_data_length fails
+* @precondition                        Bluetooth must be initialized
+* @postcondition               Bluetooth must be de-initialized
+*/
+int ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p(void)
+{
+       START_TEST;
+       int nRetVal = 0;
+       int nLength = 0;
+
+       nRetVal = bt_adapter_le_get_maximum_advertising_data_length(&nLength);
+       if (g_bBluetoothIsLEAdvExtSupported == false)
+       {
+               PRINT_RESULT(BT_ERROR_NOT_SUPPORTED, nRetVal, "bt_adapter_le_get_maximum_advertising_data_length", BluetoothGetError(nRetVal));
+       }
+       else
+       {
+               PRINT_RESULT(BT_ERROR_NONE, nRetVal, "bt_adapter_le_get_maximum_advertising_data_length", BluetoothGetError(nRetVal));
+       }
+
+       return 0;
+}
\ No newline at end of file
index d80d8fb9aec7286da4183556874a10423d0c971b..64016c055eb9c9e57e9269cb93ed5bfc7fefba3e 100755 (executable)
@@ -125,15 +125,15 @@ char* BluetoothGetEnumString(bt_adapter_visibility_mode_e enum_discoverable_mode
        char *pszEnumString = "UNKNOWN";
        switch ( enum_discoverable_mode )
        {
-       case BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE: 
-               pszEnumString = "BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE"; 
-               break;  
-       case BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE: 
-               pszEnumString = "BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE"; 
-               break;  
-       case BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE: 
-               pszEnumString = "BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE"; 
-               break;  
+       case BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE:
+               pszEnumString = "BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE";
+               break;
+       case BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE:
+               pszEnumString = "BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE";
+               break;
+       case BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE:
+               pszEnumString = "BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE";
+               break;
        }
        return pszEnumString;
 }
@@ -151,18 +151,74 @@ char* BluetoothGetPacketTypeEnumString(int nRet)
        switch ( nRet )
        {
        case BT_ADAPTER_LE_PACKET_ADVERTISING:
-               pszEnumString = "BT_ADAPTER_LE_PACKET_ADVERTISING"; 
+               pszEnumString = "BT_ADAPTER_LE_PACKET_ADVERTISING";
                break;
        case BT_ADAPTER_LE_PACKET_SCAN_RESPONSE:
-               pszEnumString = "BT_ADAPTER_LE_PACKET_SCAN_RESPONSE"; 
+               pszEnumString = "BT_ADAPTER_LE_PACKET_SCAN_RESPONSE";
                break;
-       default : 
-               pszEnumString = "UNKNOWN"; 
+       default :
+               pszEnumString = "UNKNOWN";
                break;
        }
        return pszEnumString;
 }
 
+/**
+* @function            BluetoothGetLEScanRoleEnumString
+* @description         Maps type enums to string values
+* @parameter[IN]       enum_scan_role: enum value
+* @return                      pszEnumString: enum value as a string
+*/
+char* BluetoothGetLEScanRoleEnumString(bt_adapter_le_scan_role_e enum_scan_role)
+{
+       char *pszEnumString = NULL;
+       switch ( enum_scan_role )
+       {
+       case BT_ADAPTER_LE_SCAN_ALL:
+               pszEnumString = "BT_ADAPTER_LE_SCAN_ALL";
+               break;
+       case BT_ADAPTER_LE_SCAN_LEGACY_ONLY:
+               pszEnumString = "BT_ADAPTER_LE_SCAN_LEGACY_ONLY";
+               break;
+       case BT_ADAPTER_LE_SCAN_EXTENDED_ONLY:
+               pszEnumString = "BT_ADAPTER_LE_SCAN_EXTENDED_ONLY";
+               break;
+       default :
+               pszEnumString = "UNKNOWN";
+               break;
+       }
+       return pszEnumString;
+}
+
+/**
+* @function            BluetoothGetLEScanPhyEnumString
+* @description         Maps type enums to string values
+* @parameter[IN]       enum_scan_phy: enum value
+* @return                      pszEnumString: enum value as a string
+*/
+char* BluetoothGetLEScanPhyEnumString(bt_adapter_le_phy_e enum_scan_phy)
+{
+       char *pszEnumString = NULL;
+       switch ( enum_scan_phy )
+       {
+       case BT_LE_ALL_PHY:
+               pszEnumString = "BT_LE_ALL_PHY";
+               break;
+       case BT_LE_1M_PHY:
+               pszEnumString = "BT_LE_1M_PHY";
+               break;
+       case BT_LE_2M_PHY:
+               pszEnumString = "BT_LE_2M_PHY";
+               break;
+       case BT_LE_CODED_PHY:
+               pszEnumString = "BT_LE_CODED_PHY";
+               break;
+       default :
+               pszEnumString = "UNKNOWN";
+               break;
+       }
+       return pszEnumString;
+}
 /**
 * @function            BluetoothInitAudio
 * @description         Initialize bluetooth audio and create device bond
index da2686db6242b17b9126fa76020904d498358f59..72bcbce7feb2f5fb96e866e1732a7dcfb9c5c44b 100755 (executable)
@@ -51,6 +51,7 @@
 #define BLUETOOTH_OOB_FEATURE                  "http://tizen.org/feature/network.bluetooth.oob"
 #define BLUETOOTH_LE5_FEATURE                  "http://tizen.org/feature/network.bluetooth.le.5_0"
 #define BLUETOOTH_LE_COC_FEATURE                       "http://tizen.org/feature/network.bluetooth.le.coc"
+#define BLUETOOTH_LE_ADV_EXT_FEATURE                   "http://tizen.org/feature/network.bluetooth.le.adv_ext"
 
 bool g_bBluetoothInit;
 bool g_bBluetoothMismatch;
@@ -60,6 +61,7 @@ bool g_bBluetoothIsOPPSupported;
 bool g_bBluetoothIsAudioSupported;
 bool g_bBluetoothIsLESupported;
 bool g_bBluetoothIsOOBSupported;
+bool g_bBluetoothIsLEAdvExtSupported;
 
 
 bool g_bCallbackResult;
@@ -140,5 +142,8 @@ void BluetoothDeinitAudio(char *pszRemoteDeviceAddress);
 bool BluetoothGetStorageDownloadsPath(char *pszPath);
 bool BluetoothGetDataPath(char* pPath);
 char* StorageGetError(storage_error_e nRet);
+char* BluetoothGetLEScanPhyEnumString(bt_adapter_le_phy_e enum_scan_phy);
+char* BluetoothGetLEScanRoleEnumString(bt_adapter_le_scan_role_e enum_scan_role);
+
 /** @} */
 #endif  //_ITS_BLUETOOTH_COMMON_H_
index a1c3265b611511c3cc48dbe3e14eb6c778ae0981..119e8112312dc4dbea03b2e93a3e9e14579d6501 100755 (executable)
@@ -107,6 +107,14 @@ extern int ITc_bluetooth_bt_socket_get_l2cap_psm_p(void);
 extern int ITc_bluetooth_bt_socket_listen_l2cap_channel_p(void);
 extern int ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p(void);
 extern int ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p(void);
 
 testcase tc_array[] = {
        {"ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p",ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p,ITs_bluetooth_audio_startup,ITs_bluetooth_audio_cleanup},
@@ -182,6 +190,14 @@ testcase tc_array[] = {
        {"ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p", ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p, ITs_bluetooth_l2cap_channel_startup, ITs_bluetooth_l2cap_channel_cleanup},
        {"ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p", ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p, ITs_bluetooth_l2cap_channel_startup, ITs_bluetooth_l2cap_channel_cleanup},
        {"ITc_bt_adapter_le_set_advertising_flags_p", ITc_bt_adapter_le_set_advertising_flags_p, ITs_bluetooth_adapter_le_startup, ITs_bluetooth_adapter_le_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p", ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},       
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup}, 
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p", ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
        {NULL, NULL}
 };
 
index a1c3265b611511c3cc48dbe3e14eb6c778ae0981..119e8112312dc4dbea03b2e93a3e9e14579d6501 100755 (executable)
@@ -107,6 +107,14 @@ extern int ITc_bluetooth_bt_socket_get_l2cap_psm_p(void);
 extern int ITc_bluetooth_bt_socket_listen_l2cap_channel_p(void);
 extern int ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p(void);
 extern int ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p(void);
 
 testcase tc_array[] = {
        {"ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p",ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p,ITs_bluetooth_audio_startup,ITs_bluetooth_audio_cleanup},
@@ -182,6 +190,14 @@ testcase tc_array[] = {
        {"ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p", ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p, ITs_bluetooth_l2cap_channel_startup, ITs_bluetooth_l2cap_channel_cleanup},
        {"ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p", ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p, ITs_bluetooth_l2cap_channel_startup, ITs_bluetooth_l2cap_channel_cleanup},
        {"ITc_bt_adapter_le_set_advertising_flags_p", ITc_bt_adapter_le_set_advertising_flags_p, ITs_bluetooth_adapter_le_startup, ITs_bluetooth_adapter_le_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p", ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},       
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup}, 
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p", ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
        {NULL, NULL}
 };
 
index 5f74f5cc85776d45bdcfe456915548c92c004ac9..0bab3c8147c5b081c4ab8faeff0ed9448043a459 100755 (executable)
@@ -98,6 +98,14 @@ extern int ITc_bt_adapter_le_scan_filter_set_manufacturer_data_with_mask_p(void)
 extern int ITc_bt_adapter_le_is_2m_phy_supported_p(void);
 extern int ITc_bt_adapter_le_is_coded_phy_supported_p(void);
 extern int ITc_bt_adapter_le_is_discovering_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p(void);
 
 testcase tc_array[] = {
        {"ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p",ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p,ITs_bluetooth_audio_startup,ITs_bluetooth_audio_cleanup},
@@ -166,6 +174,14 @@ testcase tc_array[] = {
        {"ITc_bt_adapter_le_is_2m_phy_supported_p", ITc_bt_adapter_le_is_2m_phy_supported_p, ITs_bluetooth_adapter_le_startup, ITs_bluetooth_adapter_le_cleanup},
        {"ITc_bt_adapter_le_is_coded_phy_supported_p", ITc_bt_adapter_le_is_coded_phy_supported_p, ITs_bluetooth_adapter_le_startup, ITs_bluetooth_adapter_le_cleanup},
        {"ITc_bt_adapter_le_is_discovering_p", ITc_bt_adapter_le_is_discovering_p, ITs_bluetooth_adapter_le_startup, ITs_bluetooth_adapter_le_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p", ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},       
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup}, 
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p", ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
        {NULL, NULL}
 };
 
index 714be238adae0b93a16c64b7637264d847b82f1f..ef6cdf6c1f2e49825960c04f522282b0a2d30ad4 100755 (executable)
@@ -107,6 +107,14 @@ extern int ITc_bluetooth_bt_socket_get_l2cap_psm_p(void);
 extern int ITc_bluetooth_bt_socket_listen_l2cap_channel_p(void);
 extern int ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p(void);
 extern int ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p(void);
+extern int ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p(void);
 
 testcase tc_array[] = {
        {"ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p",ITc_bluetooth_audio_bt_audio_initialize_deinitialize_p,ITs_bluetooth_audio_startup,ITs_bluetooth_audio_cleanup},
@@ -182,6 +190,14 @@ testcase tc_array[] = {
        {"ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p", ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_requested_cb_p, ITs_bluetooth_l2cap_channel_startup, ITs_bluetooth_l2cap_channel_cleanup},
        {"ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p", ITc_bluetooth_bt_socket_set_unset_l2cap_channel_connection_state_changed_cb_p, ITs_bluetooth_l2cap_channel_startup, ITs_bluetooth_l2cap_channel_cleanup},
        {"ITc_bt_adapter_le_set_advertising_flags_p", ITc_bt_adapter_le_set_advertising_flags_p, ITs_bluetooth_adapter_le_startup, ITs_bluetooth_adapter_le_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p", ITc_bluetooth_adapter_bt_adapter_le_start_scan_new_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_role_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_scan_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},       
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_legacy_mode_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup}, 
+       {"ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p", ITc_bluetooth_adapter_bt_adapter_le_set_advertising_primary_secondary_phy_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_advertising_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p", ITc_bluetooth_adapter_bt_adapter_le_is_extended_scan_supported_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
+       {"ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p", ITc_bluetooth_adapter_bt_adapter_le_get_maximum_advertising_data_length_p, ITs_bluetooth_startup, ITs_bluetooth_cleanup},
        {NULL, NULL}
 };