diff --git a/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js b/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js index d8339e9c7b914ec20d0fd127404b984161c12923..c9686491f327b33d6c6d299ebc50766e65a1305b 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js +++ b/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js @@ -21,7 +21,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' export default function bluetoothBLETest2() { describe('bluetoothBLETest2', function() { let gattServer = null; - let gattClient = null; function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) } @@ -53,7 +52,6 @@ describe('bluetoothBLETest2', function() { beforeAll(function () { console.info('beforeAll called') gattServer = bluetooth.BLE.createGattServer(); - gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00"); }) beforeEach(async function (done) { console.info('beforeEach called') @@ -79,7 +77,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 0 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0100', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -136,7 +133,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0200', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -192,8 +188,7 @@ describe('bluetoothBLETest2', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); + it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -250,7 +245,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0400', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -307,7 +301,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0500', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -364,7 +357,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -421,7 +413,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0900', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -478,7 +469,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1000', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -535,7 +525,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1100', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -592,7 +581,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1200', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -649,7 +637,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1400', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -706,7 +693,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1500', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -763,7 +749,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 1 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1600', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -820,7 +805,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -877,7 +861,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -929,7 +912,6 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -982,7 +964,6 @@ describe('bluetoothBLETest2', function() { it('SUB_COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400', 0, function () { let isRet = true; try{ - let gattServer =bluetooth.BLE.createGattServer(); gattServer.stopAdvertising(); expect(isRet).assertTrue(); }catch(error){ @@ -995,4 +976,3 @@ describe('bluetoothBLETest2', function() { }) } - diff --git a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js b/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js index c18c9c4aa0cefd2de17907791de4e273c28ca3e2..03f58999a5674f6b720aacf54fc1520a6d14cd76 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js +++ b/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js @@ -18,7 +18,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' export default function bluetoothBLETest() { describe('bluetoothBLETest', function() { - let gattServer = null; let gattClient = null; function sleep(delay) { @@ -64,7 +63,7 @@ describe('bluetoothBLETest', function() { }) afterAll(function () { console.info('afterAll called') - gattServer.close(); + gattClient.close(); }) /** @@ -539,7 +538,7 @@ describe('bluetoothBLETest', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300', 0, async function (done) { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); cccValue[0] = 1011; @@ -685,7 +684,7 @@ describe('bluetoothBLETest', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300', 0, async function (done) { let arrayBufferDesc = new ArrayBuffer(8); let descValue = new Uint8Array(arrayBufferDesc); function WriteDescriptorReq(DescriptorWriteReq) { @@ -696,7 +695,6 @@ describe('bluetoothBLETest', function() { let needRsp = DescriptorWriteReq.needRsp; let value = new Uint8Array(DescriptorWriteReq.value); let descriptorUuid = DescriptorWriteReq.descriptorUuid; - descValue[0] = value[0]; let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc}; @@ -720,7 +718,7 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. * @tc.size MEDIUM @@ -756,7 +754,7 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. * @tc.size MEDIUM @@ -792,7 +790,7 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. * @tc.size MEDIUM @@ -807,7 +805,7 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0400 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400 * @tc.name test BLECharacteristicChangeON * @tc.desc Test On and off api. * @tc.size MEDIUM @@ -850,12 +848,12 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0300 - * @tc.name testSetNotifyCharacteristicChanged - * @tc.desc Test SetNotifyCharacteristicChanged api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GattClose_0100 + * @tc.name test gattClient close + * @tc.desc Test close api. * @tc.size MEDIUM * @tc.type Function - * @tc.level Level 2 + * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattClose_0100', 0, async function (done) { let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); @@ -868,3 +866,4 @@ describe('bluetoothBLETest', function() { }) } + diff --git a/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js b/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js index ac5f196886d718efed4a182210abf2c05ad6a13e..77adbf950877cadced522516f0829a23d48a9f7a 100644 --- a/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js +++ b/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js @@ -584,7 +584,7 @@ describe('bluetoothhostTest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1800 * @tc.name test gatt connect and disconnect * @tc.desc Test connect and disconnect api . * @tc.size MEDIUM @@ -592,7 +592,7 @@ describe('bluetoothhostTest', function() { * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1800', 0, async function (done) { async function onReceiveEvent(ScanResult) { console.info('[bluetooth_js] BLEscan device result12'+JSON.stringify(ScanResult)