提交 05e1aadc 编写于 作者: Q quanli

quanli1@huawei.com

Signed-off-by: Nquanli <quanli1@huawei.com>
上级 fa80cf79
...@@ -119,11 +119,11 @@ describe('bluetoothBLETest', function() { ...@@ -119,11 +119,11 @@ describe('bluetoothBLETest', function() {
console.info('[bluetooth_js] gattClient getrssi2 connect' + JSON.stringify(ret)) console.info('[bluetooth_js] gattClient getrssi2 connect' + JSON.stringify(ret))
expect(ret).assertTrue(); expect(ret).assertTrue();
await gattClient.getRssiValue().then((data) => { await gattClient.getRssiValue().then((data) => {
console.info('[bluetooth_js] BLE read rssi ' + JSON.stringify(data)); console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data));
let rssiLength = Object.keys(data).length; let rssiLength = Object.keys(data).length;
expect(rssiLength).assertEqual(0); expect(rssiLength).assertEqual(0);
}).catch(err => { }).catch(error => {
console.error('bluetooth getRssiValue has error: '+ err); console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error));
expect(true).assertEqual(true); expect(true).assertEqual(true);
}); });
let disconnect = gattClient.disconnect(); let disconnect = gattClient.disconnect();
...@@ -146,15 +146,17 @@ describe('bluetoothBLETest', function() { ...@@ -146,15 +146,17 @@ describe('bluetoothBLETest', function() {
let ret = gattClient.connect(); let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret)) console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret))
expect(ret).assertTrue(); expect(ret).assertTrue();
gattClient.getRssiValue((err, data)=> { let promise = new Promise((resolve) => {
console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); gattClient.getRssiValue((err, data)=> {
expect(data).assertNull(); console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data));
let disconnect = gattClient.disconnect(); expect(data).assertNull();
console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect); let disconnect = gattClient.disconnect();
expect(disconnect).assertEqual(false); console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect);
}); expect(disconnect).assertEqual(false);
await sleep(2000); });
done(); resolve()
})
await promise.then(done)
}) })
/** /**
...@@ -353,37 +355,40 @@ describe('bluetoothBLETest', function() { ...@@ -353,37 +355,40 @@ describe('bluetoothBLETest', function() {
* @tc.type Function * @tc.type Function
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) {
let descriptors = []; let promise = new Promise((resolve) => {
let arrayBuffer = new ArrayBuffer(8); let descriptors = [];
let desValue = new Uint8Array(arrayBuffer); let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
desValue[0] = 11; desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB',
descriptorValue: arrayBuffer};
descriptors[0] = descriptor; descriptors[0] = descriptor;
let arrayBufferCCC = new ArrayBuffer(8); let arrayBufferCCC = new ArrayBuffer(8);
let cccValue = new Uint8Array(arrayBufferCCC); let cccValue = new Uint8Array(arrayBufferCCC);
cccValue[0] = 32; cccValue[0] = 32;
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
characteristicValue: arrayBufferCCC, descriptors:descriptors}; characteristicValue: arrayBufferCCC, descriptors:descriptors};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); let gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00");
await gattClient.readCharacteristicValue(characteristic).then((object) => { gattClient.readCharacteristicValue(characteristic).then((object) => {
if (object != null) { if (object != null) {
console.error('bluetooth readCharacteristicValue promise object :' expect(true).assertEqual(true);
+JSON.stringify(object)); } else {
console.info('[bluetooth_js] readCharacValue promise data:'
+ JSON.stringify(data));
expect(null).assertFail();
}
done();
}).catch(err => {
console.error(`bluetooth readCharacteValue promise has error: ${err}`);
expect(true).assertEqual(true); expect(true).assertEqual(true);
} else { done();
console.info('[bluetooth_js] readCharacValue promise null:' + JSON.stringify(object)); });
expect(null).assertFail(); resolve()
}
done();
}).catch(error => {
console.error('[bluetooth_js] readCharacteristicValue promise has error:'
+JSON.stringify(error));
expect(true).assertEqual(true);
done();
}) })
await promise.then(done)
}) })
/** /**
...@@ -400,6 +405,7 @@ describe('bluetoothBLETest', function() { ...@@ -400,6 +405,7 @@ describe('bluetoothBLETest', function() {
return; return;
} }
console.log('bluetooth characteristic uuid:'+ BLECharacteristic.characteristicUuid); console.log('bluetooth characteristic uuid:'+ BLECharacteristic.characteristicUuid);
expect(true).assertEqual(data==null);
let value = new Uint8Array(BLECharacteristic.characteristicValue); let value = new Uint8Array(BLECharacteristic.characteristicValue);
console.log('bluetooth characteristic value: ' console.log('bluetooth characteristic value: '
+ value[0] +','+ value[1]+','+ value[2]+','+ value[3]); + value[0] +','+ value[1]+','+ value[2]+','+ value[3]);
...@@ -408,7 +414,8 @@ describe('bluetoothBLETest', function() { ...@@ -408,7 +414,8 @@ describe('bluetoothBLETest', function() {
let desValue = new Uint8Array(arrayBuffer); let desValue = new Uint8Array(arrayBuffer);
desValue[0] = 11; desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue:arrayBuffer}; descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB',
descriptorValue:arrayBuffer};
let arrayBufferCCC = new ArrayBuffer(8); let arrayBufferCCC = new ArrayBuffer(8);
let cccValue = new Uint8Array(arrayBufferCCC); let cccValue = new Uint8Array(arrayBufferCCC);
cccValue[0] = 32; cccValue[0] = 32;
...@@ -416,9 +423,7 @@ describe('bluetoothBLETest', function() { ...@@ -416,9 +423,7 @@ describe('bluetoothBLETest', function() {
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
characteristicValue: arrayBufferCCC, descriptors:descriptor}; characteristicValue: arrayBufferCCC, descriptors:descriptor};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let data = await gattClient.readCharacteristicValue(characteristic,readCcc); gattClient.readCharacteristicValue(characteristic,readCcc);
console.log('[bluetooth_js] readCharacteristicValue callback: ' + JSON.stringify(data))
expect(true).assertEqual(data==null);
done() done()
}) })
...@@ -435,7 +440,8 @@ describe('bluetoothBLETest', function() { ...@@ -435,7 +440,8 @@ describe('bluetoothBLETest', function() {
let desValue = new Uint8Array(arrayBuffer); let desValue = new Uint8Array(arrayBuffer);
desValue[0] = 11; desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB',
descriptorValue: arrayBuffer};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
await gattClient.readDescriptorValue(descriptor).then((object) => { await gattClient.readDescriptorValue(descriptor).then((object) => {
if (object != null) { if (object != null) {
...@@ -443,12 +449,12 @@ describe('bluetoothBLETest', function() { ...@@ -443,12 +449,12 @@ describe('bluetoothBLETest', function() {
expect(true).assertEqual(true); expect(true).assertEqual(true);
} else { } else {
console.info('[bluetooth_js]readDescriptorValue null:' + JSON.stringify(object)); console.info('[bluetooth_js]readDescripValue null:' + JSON.stringify(object));
expect(null).assertFail(); expect(null).assertFail();
} }
done(); done();
}).catch(error => { }).catch(err => {
console.error('[bluetooth_js]readDescriptorValue promise error:'+JSON.stringify(error)); console.error('[bluetooth_js]readDescrValue promise err:'+JSON.stringify(err));
expect(true).assertEqual(true); expect(true).assertEqual(true);
done(); done();
}) })
...@@ -466,7 +472,7 @@ describe('bluetoothBLETest', function() { ...@@ -466,7 +472,7 @@ describe('bluetoothBLETest', function() {
function readDesc(code, BLEDescriptor) { function readDesc(code, BLEDescriptor) {
if (code.code != 0) { if (code.code != 0) {
console.info('[bluetooth_js] descriptor code: ' + BLEDescriptor.descriptorUuid); console.info('[bluetooth_js] descriptor code: ' + BLEDescriptor.descriptorUuid);
return; expect(true).assertEqual(BLEDescriptor.descriptorUuid==null);
} }
console.info('[bluetooth_js] descriptor uuid: ' + BLEDescriptor.descriptorUuid); console.info('[bluetooth_js] descriptor uuid: ' + BLEDescriptor.descriptorUuid);
let value = new Uint8Array(BLEDescriptor.descriptorValue); let value = new Uint8Array(BLEDescriptor.descriptorValue);
...@@ -479,9 +485,7 @@ describe('bluetoothBLETest', function() { ...@@ -479,9 +485,7 @@ describe('bluetoothBLETest', function() {
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let data1 = await gattClient.readDescriptorValue(descriptor,readDesc); gattClient.readDescriptorValue(descriptor,readDesc);
console.log('[bluetooth_js] readDescriptorValue callback: ' + JSON.stringify(data1))
expect(true).assertEqual(data1==null);
done() done()
}) })
...@@ -653,6 +657,22 @@ describe('bluetoothBLETest', function() { ...@@ -653,6 +657,22 @@ describe('bluetoothBLETest', function() {
done(); done();
}) })
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0300
* @tc.name testSetNotifyCharacteristicChanged
* @tc.desc Test SetNotifyCharacteristicChanged api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattClose_0100', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.close();
console.info('[bluetooth_js] gattClient close ret:' + ret);
expect(ret).assertEqual(true);
done();
})
}) })
} }
...@@ -226,7 +226,7 @@ describe('bluetoothhostTest2', function() { ...@@ -226,7 +226,7 @@ describe('bluetoothhostTest2', function() {
bluetooth.BLE.on('pinRequired', PinRequiredParam); bluetooth.BLE.on('pinRequired', PinRequiredParam);
let result = bluetooth.pairDevice("00:00:00:00:00:00"); let result = bluetooth.pairDevice("00:00:00:00:00:00");
console.info("[bluetooth_js] onStartpair007 -> " + JSON.stringify(result)); console.info("[bluetooth_js] onStartpair007 -> " + JSON.stringify(result));
expect(result).assertTrue(); expect(result).assertFalse();
bluetooth.BLE.off('pinRequired', PinRequiredParam); bluetooth.BLE.off('pinRequired', PinRequiredParam);
done() done()
}) })
...@@ -248,7 +248,7 @@ describe('bluetoothhostTest2', function() { ...@@ -248,7 +248,7 @@ describe('bluetoothhostTest2', function() {
bluetooth.BLE.on('pinRequired', PinRequiredParam); bluetooth.BLE.on('pinRequired', PinRequiredParam);
let result = bluetooth.pairDevice("00:00:00:00:00:00"); let result = bluetooth.pairDevice("00:00:00:00:00:00");
console.info("[bluetooth_js] onStartpair008 -> " + JSON.stringify(result)); console.info("[bluetooth_js] onStartpair008 -> " + JSON.stringify(result));
expect(result).assertTrue(); expect(result).assertFalse();
bluetooth.BLE.off('pinRequired', PinRequiredParam); bluetooth.BLE.off('pinRequired', PinRequiredParam);
done() done()
}) })
......
...@@ -79,9 +79,10 @@ describe('bluetoothhostTest4', function() { ...@@ -79,9 +79,10 @@ describe('bluetoothhostTest4', function() {
secure: true, type: SppType.SPP_RFCOMM}; secure: true, type: SppType.SPP_RFCOMM};
let serverNumber = -1; let serverNumber = -1;
function serverSocket(code, number) { function serverSocket(code, number) {
console.log('bluetooth error code: ' + code.code); if (code) {
if (code.code == 0) { console.log('bluetooth error code: ' + code);
console.log('bluetooth serverSocket Number: ' + number); }else{
console.log('bluetooth serverSocket Number:' + JSON.stringify(number));
serverNumber = number; serverNumber = number;
expect(true).assertEqual(number!=null); expect(true).assertEqual(number!=null);
} }
...@@ -103,11 +104,12 @@ describe('bluetoothhostTest4', function() { ...@@ -103,11 +104,12 @@ describe('bluetoothhostTest4', function() {
secure: false, type: 0}; secure: false, type: 0};
let serverNumber = -1; let serverNumber = -1;
function serverSocket(code, number) { function serverSocket(code, number) {
console.log('[bluetooth_js] error code: ' + code.code); if (code) {
if (code.code == 0) { console.log('[bluetooth_js] error code: ' + code);
console.log('[bluetooth_js] serverSocket Number: ' + number); }else{
serverNumber = number; console.log('[bluetooth_js] serverSocket Number: ' + JSON.stringify(number));
expect(true).assertEqual(number!=null); serverNumber = number;
expect(true).assertEqual(number!=null);
} }
} }
bluetooth.sppListen('server1', sppOption, serverSocket); bluetooth.sppListen('server1', sppOption, serverSocket);
...@@ -127,12 +129,15 @@ describe('bluetoothhostTest4', function() { ...@@ -127,12 +129,15 @@ describe('bluetoothhostTest4', function() {
secure: true, type: 0}; secure: true, type: 0};
let serverNumber = -1; let serverNumber = -1;
function serverSocket(code, number) { function serverSocket(code, number) {
console.log('[bluetooth_js] error code: ' + code.code);
if (code.code == 0) { if (code) {
console.log('[bluetooth_js] serverSocket Number: ' + number); console.log('[bluetooth_js] error code: ' + code);
serverNumber = number;
expect(true).assertEqual(number!=null); }else{
} console.log('[bluetooth_js] serverSocket Number: '+JSON.stringify(number));
serverNumber = number;
expect(true).assertEqual(serverNumber!=null);
}
} }
bluetooth.sppListen('server1', sppOption, serverSocket); bluetooth.sppListen('server1', sppOption, serverSocket);
done(); done();
...@@ -151,11 +156,14 @@ describe('bluetoothhostTest4', function() { ...@@ -151,11 +156,14 @@ describe('bluetoothhostTest4', function() {
secure: false, type: 0}; secure: false, type: 0};
let serverNumber = -1; let serverNumber = -1;
function serverSocket(code, number) { function serverSocket(code, number) {
console.log('[bluetooth_js] error code: ' + code.code);
if (code.code == 0) { if (code) {
console.log('[bluetooth_js] serverSocket Number: ' + number); console.log('[bluetooth_js] error code: ' + code);
serverNumber = number;
expect(true).assertEqual(number!=null); }else{
console.log('[bluetooth_js] serverSocket Number:'+ JSON.stringify(number));
serverNumber = number;
expect(true).assertEqual(serverNumber!=null);
} }
} }
bluetooth.sppListen('server1', sppOption, serverSocket); bluetooth.sppListen('server1', sppOption, serverSocket);
...@@ -172,11 +180,13 @@ describe('bluetoothhostTest4', function() { ...@@ -172,11 +180,13 @@ describe('bluetoothhostTest4', function() {
*/ */
it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0500', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0500', 0, async function (done) {
function acceptClientSocket(code, number) { function acceptClientSocket(code, number) {
console.log('[bluetooth_js] error code: ' + code.code);
if (code.code == 0) { if (code) {
console.log('[bluetooth_js] clientSocket Number: ' + number); console.log('[bluetooth_js] error code: ' + code);
expect(true).assertEqual(number!=null); }else{
} console.log('[bluetooth_js] clientSocket Number:' + JSON.stringify(number));
expect(true).assertEqual(number!=null);
}
} }
bluetooth.sppAccept(0, acceptClientSocket); bluetooth.sppAccept(0, acceptClientSocket);
done(); done();
...@@ -191,13 +201,13 @@ describe('bluetoothhostTest4', function() { ...@@ -191,13 +201,13 @@ describe('bluetoothhostTest4', function() {
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0600', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0600', 0, async function (done) {
bluetooth.sppAccept(-1, function(code, clientSocketNumber) { bluetooth.sppAccept(-1, function(code, clientSocketNumber) {
console.info('[bluetooth_js] code is: ' + code.code); if (code) {
if (code.code == 0) { console.info('[bluetooth_js] code is: ' + code);
console.log('[bluetooth_js]sppAccept Number:' + clientSocketNumber);
expect(true).assertEqual(clientSocketNumber!=null);
} else { } else {
expect(true).assertEqual(false); console.log('[bluetooth_js]sppAccept Number:'
+ JSON.stringify(clientSocketNumber));
expect(true).assertEqual(clientSocketNumber!=null);
} }
}); });
done(); done();
...@@ -215,12 +225,12 @@ describe('bluetoothhostTest4', function() { ...@@ -215,12 +225,12 @@ describe('bluetoothhostTest4', function() {
let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB',
secure: true, type: 0}; secure: true, type: 0};
bluetooth.sppConnect('00:11:22:33:44:55', sppOption, function(code, clientSocketNumber) { bluetooth.sppConnect('00:11:22:33:44:55', sppOption, function(code, clientSocketNumber) {
console.info('[bluetooth_js] code is: ' + code.code); if (code) {
if (code.code == 0) { console.info('[bluetooth_js] code is: ' + code);
console.log('[bluetooth_js]sppConnect Number:' + clientSocketNumber);
expect(true).assertEqual(clientSocketNumber!=null);
} else { } else {
expect(true).assertEqual(false); console.log('[bluetooth_js]sppConnect Number:'
+ JSON.stringify(clientSocketNumber));
expect(true).assertEqual(clientSocketNumber!=null);
} }
}); });
done(); done();
...@@ -238,12 +248,12 @@ describe('bluetoothhostTest4', function() { ...@@ -238,12 +248,12 @@ describe('bluetoothhostTest4', function() {
let sppOption = {uuid: '0000', let sppOption = {uuid: '0000',
secure: false, type: 0}; secure: false, type: 0};
bluetooth.sppConnect('ABC', sppOption, function(code, clientSocketNumber) { bluetooth.sppConnect('ABC', sppOption, function(code, clientSocketNumber) {
console.info('[bluetooth_js] code is: ' + code.code); if (code) {
if (code.code == 0) { console.info('[bluetooth_js] code is: ' + code);
console.log('[bluetooth_js]sppConnect Number' + clientSocketNumber);
expect(true).assertEqual(clientSocketNumber!=null);
} else { } else {
expect(true).assertEqual(false); console.log('[bluetooth_js]sppConnect Number'
+ JSON.stringify(clientSocketNumber));
expect(true).assertEqual(clientSocketNumber!=null);
} }
}); });
done(); done();
...@@ -261,12 +271,12 @@ describe('bluetoothhostTest4', function() { ...@@ -261,12 +271,12 @@ describe('bluetoothhostTest4', function() {
let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB',
secure: true, type: 0}; secure: true, type: 0};
bluetooth.sppConnect('BT', sppOption, function(code, clientSocketNumber) { bluetooth.sppConnect('BT', sppOption, function(code, clientSocketNumber) {
console.info('[bluetooth_js] code is: ' + code.code); if (code) {
if (code.code == 0) { console.info('[bluetooth_js] code is: ' + code);
console.log('[bluetooth_js]sppConnect Number' + clientSocketNumber);
expect(true).assertEqual(clientSocketNumber!=null);
} else { } else {
expect(true).assertEqual(false); console.log('[bluetooth_js]sppConnect Number'
+ JSON.stringify(clientSocketNumber));
expect(true).assertEqual(clientSocketNumber!=null);
} }
}); });
done(); done();
...@@ -283,11 +293,14 @@ describe('bluetoothhostTest4', function() { ...@@ -283,11 +293,14 @@ describe('bluetoothhostTest4', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000', 0, async function (done) {
let serverNumber = -1; let serverNumber = -1;
function serverSocket(code, number) { function serverSocket(code, number) {
console.log('bluetooth error code: ' + code.code); if (code) {
if (code.code == 0) { console.log('bluetooth error code: ' + code);
console.log('bluetooth serverSocket Number: ' + number); }else{
console.log('bluetooth serverSocket Number:'+ JSON.stringify(number));
serverNumber = number; serverNumber = number;
expect(true).assertEqual(serverNumber!=null);
} }
} }
let SppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', let SppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB',
secure: true, type: 0}; secure: true, type: 0};
...@@ -307,13 +320,13 @@ describe('bluetoothhostTest4', function() { ...@@ -307,13 +320,13 @@ describe('bluetoothhostTest4', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1100', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1100', 0, async function (done) {
let clientNumber = -1; let clientNumber = -1;
bluetooth.sppAccept(-1, function(code, clientSocketNumber) { bluetooth.sppAccept(-1, function(code, clientSocketNumber) {
console.info('[bluetooth_js] code is: ' + code.code); if (code) {
if (code.code == 0) { console.info('[bluetooth_js] code is: ' + code);
console.log('[bluetooth_js]sppAccept Number:' + clientSocketNumber); } else {
console.log('[bluetooth_js]sppAccept Number:'
+ JSON.stringify(clientSocketNumber));
clientNumber =clientSocketNumber; clientNumber =clientSocketNumber;
expect(true).assertEqual(clientSocketNumber!=null); expect(true).assertEqual(clientSocketNumber!=null);
} else {
expect(true).assertEqual(false);
} }
}); });
bluetooth.sppCloseClientSocket(clientNumber); bluetooth.sppCloseClientSocket(clientNumber);
...@@ -331,13 +344,13 @@ describe('bluetoothhostTest4', function() { ...@@ -331,13 +344,13 @@ describe('bluetoothhostTest4', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1200', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1200', 0, async function (done) {
let clientNumber = -1; let clientNumber = -1;
bluetooth.sppAccept(-1, function(code, clientSocketNumber) { bluetooth.sppAccept(-1, function(code, clientSocketNumber) {
console.info('[bluetooth_js] code is: ' + code.code); if (code) {
if (code.code == 0) { console.info('[bluetooth_js] code is: ' + code);
console.log('[bluetooth_js]sppAccept Number:' + clientSocketNumber); } else {
console.log('[bluetooth_js]sppAccept Number:'
+ JSON.stringify(clientSocketNumber));
clientNumber =clientSocketNumber; clientNumber =clientSocketNumber;
expect(true).assertEqual(clientSocketNumber!=null); expect(true).assertEqual(clientSocketNumber!=null);
} else {
expect(true).assertEqual(false);
} }
}); });
let arrayBuffer = new ArrayBuffer(8); let arrayBuffer = new ArrayBuffer(8);
......
...@@ -888,7 +888,8 @@ describe('geolocationTest_geo3', function () { ...@@ -888,7 +888,8 @@ describe('geolocationTest_geo3', function () {
' longitude: ' + result.longitude +' altitude: ' + result.altitude ' longitude: ' + result.longitude +' altitude: ' + result.altitude
+' accuracy: ' + result.accuracy+' speed: ' + result.speed + +' accuracy: ' + result.accuracy+' speed: ' + result.speed +
'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: ' 'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: '
+ result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize); + result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize
+'isFromMock'+ result.isFromMock);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getLastLocation promise then error:" + JSON.stringify(error)); console.info("[lbs_js] getLastLocation promise then error:" + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册