From f8fca6348b03fed6fb422eedeb4ad9960e943f94 Mon Sep 17 00:00:00 2001 From: quanli Date: Wed, 21 Sep 2022 11:34:53 +0800 Subject: [PATCH] quanli1@huawei.com Signed-off-by: quanli --- hdf/bluetooth/hdiService/bluetooth_hci.h | 6 +- .../bluetooth_hci_callback_impl.cpp | 2 - .../hdiService/bluetooth_hci_callback_impl.h | 4 - .../bluetooth_hci_services_test.cpp | 96 +++++++++++++++---- 4 files changed, 83 insertions(+), 25 deletions(-) diff --git a/hdf/bluetooth/hdiService/bluetooth_hci.h b/hdf/bluetooth/hdiService/bluetooth_hci.h index ecba0006..2f860329 100644 --- a/hdf/bluetooth/hdiService/bluetooth_hci.h +++ b/hdf/bluetooth/hdiService/bluetooth_hci.h @@ -16,9 +16,9 @@ #ifndef BLUETOOTH_HDI_H #define BLUETOOTH_HDI_H -#include -#include -#include +//#include +//#include +//#include #ifdef __cplusplus extern "C" { diff --git a/hdf/bluetooth/hdiService/bluetooth_hci_callback_impl.cpp b/hdf/bluetooth/hdiService/bluetooth_hci_callback_impl.cpp index 7fdccc3b..c526f5ce 100644 --- a/hdf/bluetooth/hdiService/bluetooth_hci_callback_impl.cpp +++ b/hdf/bluetooth/hdiService/bluetooth_hci_callback_impl.cpp @@ -62,5 +62,3 @@ int32_t HciCallbackImpl::OnReceivedHciPacket(BtType type, const std::vector data; int32_t ret = g_iBtHci->SendHciPacket(btType, data); EXPECT_EQ(HDF_FAILURE, ret); - } /** - * @tc.name: GetSensorList0001 - * @tc.desc: Obtains information about all sensors in the system. + * @tc.name: HdiBluetoothSend_0400 + * @tc.desc: the HCI HCI_CMD packets is sent successfully. * @tc.type: FUNC */ -HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetooth_0400, TestSize.Level1) +HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetoothSend_0400, TestSize.Level1) +{ + if (g_iBtHci == nullptr) { + ASSERT_NE(nullptr, g_iBtHci); + return; + } + BtType btType = BtType::HCI_CMD; + std::vector data; + int32_t ret = g_iBtHci->SendHciPacket(btType, data); + EXPECT_EQ(HDF_FAILURE, ret); +} + +/** + * @tc.name: HdiBluetoothSend_0500 + * @tc.desc: the HCI SCO_DATA packets is sent successfully. + * @tc.type: FUNC + */ +HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetoothSend_0500, TestSize.Level1) +{ + if (g_iBtHci == nullptr) { + ASSERT_NE(nullptr, g_iBtHci); + return; + } + BtType btType = BtType::SCO_DATA; + std::vector data; + int32_t ret = g_iBtHci->SendHciPacket(btType, data); + EXPECT_EQ(HDF_FAILURE, ret); +} + +/** + * @tc.name: HdiBluetoothSend_0600 + * @tc.desc: the HCI HCI_EVENT packets is sent successfully. + * @tc.type: FUNC + */ +HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetoothSend_0600, TestSize.Level1) +{ + if (g_iBtHci == nullptr) { + ASSERT_NE(nullptr, g_iBtHci); + return; + } + BtType btType = BtType::HCI_EVENT; + std::vector data; + int32_t ret = g_iBtHci->SendHciPacket(btType, data); + EXPECT_EQ(HDF_FAILURE, ret); +} + +/** + * @tc.name: HdiBluetoothSend_0700 + * @tc.desc: the HCI ISO_DATA packets is sent successfully. + * @tc.type: FUNC + */ +HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetoothSend_0700, TestSize.Level1) +{ + if (g_iBtHci == nullptr) { + ASSERT_NE(nullptr, g_iBtHci); + return; + } + BtType btType = BtType::ISO_DATA; + std::vector data; + int32_t ret = g_iBtHci->SendHciPacket(btType, data); + EXPECT_EQ(HDF_FAILURE, ret); +} + +/** + * @tc.name: HdiBluetoothClose_0800 + * @tc.desc: Disable the HCI interface. + * @tc.type: FUNC + */ +HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetoothClose_0800, TestSize.Level1) { if (g_iBtHci == nullptr) { ASSERT_NE(nullptr, g_iBtHci); @@ -116,8 +183,5 @@ HWTEST_F(HdfBluetoothHdiTest, SUB_DriverSystem_HdiBluetooth_0400, TestSize.Level } int32_t ret = g_iBtHci->Close(); EXPECT_EQ(HDF_SUCCESS, ret); - } - -