未验证 提交 6fc5a758 编写于 作者: O openharmony_ci 提交者: Gitee

!9539 【XTS】【communication】BT、LBS问题优化

Merge pull request !9539 from 权力/myfeature
......@@ -51,7 +51,7 @@ describe('btManagerGattManagerTest', function() {
beforeAll(function () {
console.info('beforeAll called')
gattServer = bluetooth.BLE.createGattServer();
gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
gattClient = bluetooth.BLE.createGattClientDevice("92:3A:C0:3A:4C:28");
})
beforeEach(async function(done) {
console.info('beforeEach called')
......@@ -300,8 +300,8 @@ describe('btManagerGattManagerTest', function() {
it('SUB_COMMUNICATION_BTMANAGER_GETSERVICE_0200', 0, async function (done) {
try {
gattClient.getServices((code, data)=> {
if(code.code==0){
console.info("bluetooth services size is ", data.length)
if(code.code == 0) {
console.info("bluetooth services size is ", data.length);
expect(true).assertEqual(data.length >= 0);
} else {
console.info('[bluetooth_js] get services code ' + JSON.stringify(code));
......@@ -310,11 +310,11 @@ describe('btManagerGattManagerTest', function() {
done();
});
} catch (error) {
console.error(`[bluetooth_js]GetService_0200 failed, code is ${error.code},
message is ${error.message}`);
console.error(`[bluetooth_js]GetService_0200 failed, code is ${error.code},message is ${error.message}`);
expect(true).assertFalse();
done()
done();
}
done();
})
......@@ -467,11 +467,14 @@ describe('btManagerGattManagerTest', function() {
it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_2000', 0, async function(done) {
try {
function readCcc(code, BLECharacteristic) {
console.log('bluetooth characteristic code:'+ code.code);
if (code.code != 0) {
return;
}
console.log('bluetooth characteristic uuid:'+ BLECharacteristic.characteristicUuid);
expect(true).assertEqual(data==null);
console.log('bluetooth characteristic serviceUuid:'+ BLECharacteristic.serviceUuid);
console.log('bluetooth characteristic characteristicUuid:'+ BLECharacteristic.characteristicUuid);
console.log('bluetooth characteristic characteristicValue:'+ BLECharacteristic.characteristicValue);
console.log('bluetooth characteristic descriptors:'+ BLECharacteristic.descriptors);
let value = new Uint8Array(BLECharacteristic.characteristicValue);
console.log('bluetooth characteristic value: '
+ value[0] +','+ value[1]+','+ value[2]+','+ value[3]);
......@@ -492,15 +495,13 @@ describe('btManagerGattManagerTest', function() {
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
characteristicValue: arrayBufferCCC, descriptors:descriptors};
gattClient.readCharacteristicValue(characteristic,readCcc);
expect(true).assertFalse();
done()
done();
} catch (error) {
console.error(`[bluetooth_js]readDescrValue20 failed, code is ${error.code},
message is ${error.message}`);
console.error(`[bluetooth_js]readDescrValue20 failed, code is ${error.code},message is ${error.message}`);
expect(error.code).assertEqual('401');
done()
done();
}
done();
})
/**
......
......@@ -1656,6 +1656,35 @@ export default function geolocationTest_geo7() {
done();
})
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_3500
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario..
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_3500', 0, async function (done) {
let currentLocationRequest = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 0 };
try {
geolocationm.getCurrentLocation(currentLocationRequest, (err, result) => {
if (err) {
console.info("[lbs_js] getCurrentLocation callback err: " + JSON.stringify(err));
expect(err.code).assertEqual(3301200);
console.info('[lbs_js] getCurrentLocationCallback reject after')
} else {
console.info("[lbs_js] getCurrentLocation callback, result: " + JSON.stringify(result));
expect(true).assertEqual(result != null);
}
});
} catch (error) {
console.info("[lbs_js] getCurrentLocation callback try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null);
}
await sleep(1000);
done();
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册