diff --git a/communication/BUILD.gn b/communication/BUILD.gn index a732eb404bf19af3338b4c9936a57ee98b2c1bcd..74a75e273c533ccc507a42e6aded7613809b9f39 100644 --- a/communication/BUILD.gn +++ b/communication/BUILD.gn @@ -27,6 +27,7 @@ group("communication") { "dsoftbus/rpc_request:ActsRpcRequestJsTest", "nfc_Controller:ActsNFCJSTest", "nfc_ErrorCode:ActsNFCErrorJSTest", + "nfc_SecureElement:ActsnfcSEServiceTest", "wifi_ErrorCode201:ActsErrorcode201Test", "wifi_ErrorCode202:ActsErrorcode202Test", "wifi_ErrorCode401:ActsErrorcode401Test", diff --git a/communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js index 18c2f2ba72a3e87c145252bb6623c318d83d8f95..4fe2c84f6f06d2c0784bae98760d731728d91062 100644 --- a/communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js @@ -102,6 +102,7 @@ describe('btManagerGattAdvertTest', function() { serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", serviceValue:serviceValueBuffer.buffer }], + includeDeviceName:false, } let advResponse ={ serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], diff --git a/communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js index d6ccdd26fb92a180377c570c21d9b5b724908b90..ec41ddde6f2338b0344830d1c0067ba0dd7bdc77 100644 --- a/communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js @@ -475,6 +475,14 @@ describe('btManagerGattManagerTest', function() { console.log('bluetooth characteristic characteristicUuid:'+ BLECharacteristic.characteristicUuid); console.log('bluetooth characteristic characteristicValue:'+ BLECharacteristic.characteristicValue); console.log('bluetooth characteristic descriptors:'+ BLECharacteristic.descriptors); + console.log('bluetooth characteristic properties:'+ BLECharacteristic.properties); + + console.log('bluetooth BLECharacteristic write:'+ BLECharacteristic.properties.write); + console.log('bluetooth BLECharacteristic writeNoResponse:'+ BLECharacteristic.properties.writeNoResponse); + console.log('bluetooth BLECharacteristic read:'+ BLECharacteristic.properties.read); + console.log('bluetooth BLECharacteristic notify:'+ BLECharacteristic.properties.notify); + console.log('bluetooth BLECharacteristic indicate:'+ BLECharacteristic.properties.indicate); + let value = new Uint8Array(BLECharacteristic.characteristicValue); console.log('bluetooth characteristic value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); diff --git a/communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js index c730b80f524eeb655bfcc0561bbe6398e60fcdb0..4dc93e1ea6e85331751503b932b1c2a959b74615 100644 --- a/communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js @@ -56,7 +56,7 @@ describe('btManagerGattServiceTest', function() { console.info('beforeAll called') await tryToEnableBt() gattServer = bluetooth.BLE.createGattServer(); - gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); + gattClient = bluetooth.BLE.createGattClientDevice("92:3A:C0:3A:4C:28"); done() }) beforeEach(async function(done) { diff --git a/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js index 3a812967d727444592372c6de92ed772f8b10f3c..0f2e20ad9bea0b219dd24367eef63129a3c91834 100644 --- a/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js @@ -67,8 +67,6 @@ describe('btManagerPairTest', function() { * @tc.number SUB_COMMUNICATION_BTMANAGER_PAIR_0100 * @tc.name Test pinRequired and setDevicePairing true * @tc.desc Test pinRequired off api - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ @@ -85,5 +83,68 @@ describe('btManagerPairTest', function() { } done(); }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_PAIR_0200 + * @tc.name Test setDevicePinCode callback + * @tc.desc Test setDevicePinCode api10 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BTMANAGER_PAIR_0200', 0, async function (done) { + try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => { + console.info('setDevicePinCode callback,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data)); + }); + } catch (err) { + console.error("setDevicePinCode callback errCode:" + err.code + ",errMessage:" + err.message); + expect(err.code).assertEqual('2900099'); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_PAIR_0300 + * @tc.name Test setDevicePinCode promise + * @tc.desc Test setDevicePinCode api10 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BTMANAGER_PAIR_0300', 0, async function (done) { + try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => { + console.info('setDevicePinCode promise'); + }, error => { + console.info('setDevicePinCode promise: errCode:' + error.code + ',errMessage' + error.message); + }) + + } catch (err) { + console.error("setDevicePinCode promise errCode:" + err.code + ",errMessage:" + err.message); + expect(err.code).assertEqual('2900099'); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_PAIR_0400 + * @tc.name Test BluetoothTransport + * @tc.desc Test BluetoothTransport api10 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BTMANAGER_PAIR_0400', 0, async function (done) { + try { + let TRANSPORT_BR_EDR = bluetoothManager.BluetoothTransport.TRANSPORT_BR_EDR; + console.info("[bluetooth_js]TRANSPORT_BR_EDR : " + JSON.stringify(TRANSPORT_BR_EDR)); + expect(true).assertTrue(TRANSPORT_BR_EDR == 0); + + let TRANSPORT_LE = bluetoothManager.BluetoothTransport.TRANSPORT_LE; + console.info("[bluetooth_js]TRANSPORT_LE : " + JSON.stringify(TRANSPORT_LE)); + expect(true).assertTrue(TRANSPORT_LE == 1); + } catch (err) { + console.error("BluetoothTransport errCode:" + err.code + ",errMessage:" + err.message); + } + done(); + }) }) } \ No newline at end of file