未验证 提交 9f6d4c01 编写于 作者: O openharmony_ci 提交者: Gitee

!9593 【XTS】【communication】BT蓝牙接口覆盖新增,NFC修改

Merge pull request !9593 from 权力/myfeature3
......@@ -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",
......
......@@ -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"],
......
......@@ -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]);
......
......@@ -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) {
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册