Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
09859d49
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
09859d49
编写于
8月 19, 2022
作者:
Q
quanli
提交者:
权力
8月 24, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
05e1aadc
from
https://gitee.com/quanli125/xts_acts/pulls/5177
quanli1@huawei.com Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
46bb5b4b
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
143 addition
and
657 deletion
+143
-657
communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js
...ion/bluetooth_ble/src/main/js/test/BleGattManager.test.js
+68
-48
communication/bluetooth_ble/src/main/js/test/BleService.test.js
...ication/bluetooth_ble/src/main/js/test/BleService.test.js
+0
-548
communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js
...ation/bluetooth_on/src/main/js/test/BluetoothPair.test.js
+2
-2
communication/bluetooth_standard/src/main/js/test/BRSpp.test.js
...ication/bluetooth_standard/src/main/js/test/BRSpp.test.js
+71
-58
location/geolocation_standard/src/main/js/default/test/LocationTest.test.js
...on_standard/src/main/js/default/test/LocationTest.test.js
+2
-1
未找到文件。
communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js
浏览文件 @
09859d49
...
...
@@ -119,11 +119,11 @@ describe('bluetoothBLETest', function() {
console
.
info
(
'
[bluetooth_js] gattClient getrssi2 connect
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assertTrue
();
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
;
expect
(
rssiLength
).
assertEqual
(
0
);
}).
catch
(
err
=>
{
console
.
error
(
'
bluetooth getRssiValue has error:
'
+
err
);
}).
catch
(
err
or
=>
{
console
.
info
(
'
bluetooth getRssiValue has error:
'
+
JSON
.
stringify
(
error
)
);
expect
(
true
).
assertEqual
(
true
);
});
let
disconnect
=
gattClient
.
disconnect
();
...
...
@@ -146,15 +146,17 @@ describe('bluetoothBLETest', function() {
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gattClient getRssi connect
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assertTrue
();
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertNull
();
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt getrssi1 disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
});
await
sleep
(
2000
);
done
();
let
promise
=
new
Promise
((
resolve
)
=>
{
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertNull
();
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt getrssi1 disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
});
resolve
()
})
await
promise
.
then
(
done
)
})
/**
...
...
@@ -353,37 +355,40 @@ describe('bluetoothBLETest', function() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100
'
,
0
,
async
function
(
done
)
{
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100
'
,
0
,
async
function
(
done
)
{
let
promise
=
new
Promise
((
resolve
)
=>
{
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
descriptors
[
0
]
=
descriptor
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
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
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
11:22:33:44:55:66
"
);
await
gattClient
.
readCharacteristicValue
(
characteristic
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
console
.
error
(
'
bluetooth readCharacteristicValue promise object :
'
+
JSON
.
stringify
(
object
));
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
gattClient
.
readCharacteristicValue
(
characteristic
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
}
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
);
}
else
{
console
.
info
(
'
[bluetooth_js] readCharacValue promise null:
'
+
JSON
.
stringify
(
object
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
error
=>
{
console
.
error
(
'
[bluetooth_js] readCharacteristicValue promise has error:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
true
);
done
();
done
();
});
resolve
()
})
await
promise
.
then
(
done
)
})
/**
...
...
@@ -400,6 +405,7 @@ describe('bluetoothBLETest', function() {
return
;
}
console
.
log
(
'
bluetooth characteristic uuid:
'
+
BLECharacteristic
.
characteristicUuid
);
expect
(
true
).
assertEqual
(
data
==
null
);
let
value
=
new
Uint8Array
(
BLECharacteristic
.
characteristicValue
);
console
.
log
(
'
bluetooth characteristic value:
'
+
value
[
0
]
+
'
,
'
+
value
[
1
]
+
'
,
'
+
value
[
2
]
+
'
,
'
+
value
[
3
]);
...
...
@@ -408,7 +414,8 @@ describe('bluetoothBLETest', function() {
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
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
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
32
;
...
...
@@ -416,9 +423,7 @@ describe('bluetoothBLETest', function() {
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptor
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
11:22:33:44:55:66
"
);
let
data
=
await
gattClient
.
readCharacteristicValue
(
characteristic
,
readCcc
);
console
.
log
(
'
[bluetooth_js] readCharacteristicValue callback:
'
+
JSON
.
stringify
(
data
))
expect
(
true
).
assertEqual
(
data
==
null
);
gattClient
.
readCharacteristicValue
(
characteristic
,
readCcc
);
done
()
})
...
...
@@ -435,7 +440,8 @@ describe('bluetoothBLETest', function() {
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
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
"
);
await
gattClient
.
readDescriptorValue
(
descriptor
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
...
...
@@ -443,12 +449,12 @@ describe('bluetoothBLETest', function() {
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js]readDescrip
tor
Value null:
'
+
JSON
.
stringify
(
object
));
console
.
info
(
'
[bluetooth_js]readDescripValue null:
'
+
JSON
.
stringify
(
object
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
or
=>
{
console
.
error
(
'
[bluetooth_js]readDescr
iptorValue promise error:
'
+
JSON
.
stringify
(
erro
r
));
}).
catch
(
err
=>
{
console
.
error
(
'
[bluetooth_js]readDescr
Value promise err:
'
+
JSON
.
stringify
(
er
r
));
expect
(
true
).
assertEqual
(
true
);
done
();
})
...
...
@@ -466,7 +472,7 @@ describe('bluetoothBLETest', function() {
function
readDesc
(
code
,
BLEDescriptor
)
{
if
(
code
.
code
!=
0
)
{
console
.
info
(
'
[bluetooth_js] descriptor code:
'
+
BLEDescriptor
.
descriptorUuid
);
return
;
expect
(
true
).
assertEqual
(
BLEDescriptor
.
descriptorUuid
==
null
)
;
}
console
.
info
(
'
[bluetooth_js] descriptor uuid:
'
+
BLEDescriptor
.
descriptorUuid
);
let
value
=
new
Uint8Array
(
BLEDescriptor
.
descriptorValue
);
...
...
@@ -479,9 +485,7 @@ describe('bluetoothBLETest', function() {
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
11:22:33:44:55:66
"
);
let
data1
=
await
gattClient
.
readDescriptorValue
(
descriptor
,
readDesc
);
console
.
log
(
'
[bluetooth_js] readDescriptorValue callback:
'
+
JSON
.
stringify
(
data1
))
expect
(
true
).
assertEqual
(
data1
==
null
);
gattClient
.
readDescriptorValue
(
descriptor
,
readDesc
);
done
()
})
...
...
@@ -653,6 +657,22 @@ describe('bluetoothBLETest', function() {
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
();
})
})
}
communication/bluetooth_ble/src/main/js/test/BleService.test.js
浏览文件 @
09859d49
此差异已折叠。
点击以展开。
communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js
浏览文件 @
09859d49
...
...
@@ -226,7 +226,7 @@ describe('bluetoothhostTest2', function() {
bluetooth
.
BLE
.
on
(
'
pinRequired
'
,
PinRequiredParam
);
let
result
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
);
console
.
info
(
"
[bluetooth_js] onStartpair007 ->
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assert
Tru
e
();
expect
(
result
).
assert
Fals
e
();
bluetooth
.
BLE
.
off
(
'
pinRequired
'
,
PinRequiredParam
);
done
()
})
...
...
@@ -248,7 +248,7 @@ describe('bluetoothhostTest2', function() {
bluetooth
.
BLE
.
on
(
'
pinRequired
'
,
PinRequiredParam
);
let
result
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
);
console
.
info
(
"
[bluetooth_js] onStartpair008 ->
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assert
Tru
e
();
expect
(
result
).
assert
Fals
e
();
bluetooth
.
BLE
.
off
(
'
pinRequired
'
,
PinRequiredParam
);
done
()
})
...
...
communication/bluetooth_standard/src/main/js/test/BRSpp.test.js
浏览文件 @
09859d49
...
...
@@ -79,9 +79,10 @@ describe('bluetoothhostTest4', function() {
secure
:
true
,
type
:
SppType
.
SPP_RFCOMM
};
let
serverNumber
=
-
1
;
function
serverSocket
(
code
,
number
)
{
console
.
log
(
'
bluetooth error code:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
bluetooth serverSocket Number:
'
+
number
);
if
(
code
)
{
console
.
log
(
'
bluetooth error code:
'
+
code
);
}
else
{
console
.
log
(
'
bluetooth serverSocket Number:
'
+
JSON
.
stringify
(
number
));
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
number
!=
null
);
}
...
...
@@ -103,11 +104,12 @@ describe('bluetoothhostTest4', function() {
secure
:
false
,
type
:
0
};
let
serverNumber
=
-
1
;
function
serverSocket
(
code
,
number
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js] serverSocket Number:
'
+
number
);
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
number
!=
null
);
if
(
code
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
);
}
else
{
console
.
log
(
'
[bluetooth_js] serverSocket Number:
'
+
JSON
.
stringify
(
number
));
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
number
!=
null
);
}
}
bluetooth
.
sppListen
(
'
server1
'
,
sppOption
,
serverSocket
);
...
...
@@ -127,12 +129,15 @@ describe('bluetoothhostTest4', function() {
secure
:
true
,
type
:
0
};
let
serverNumber
=
-
1
;
function
serverSocket
(
code
,
number
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js] serverSocket Number:
'
+
number
);
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
number
!=
null
);
}
if
(
code
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
);
}
else
{
console
.
log
(
'
[bluetooth_js] serverSocket Number:
'
+
JSON
.
stringify
(
number
));
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
serverNumber
!=
null
);
}
}
bluetooth
.
sppListen
(
'
server1
'
,
sppOption
,
serverSocket
);
done
();
...
...
@@ -151,11 +156,14 @@ describe('bluetoothhostTest4', function() {
secure
:
false
,
type
:
0
};
let
serverNumber
=
-
1
;
function
serverSocket
(
code
,
number
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js] serverSocket Number:
'
+
number
);
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
number
!=
null
);
if
(
code
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
);
}
else
{
console
.
log
(
'
[bluetooth_js] serverSocket Number:
'
+
JSON
.
stringify
(
number
));
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
serverNumber
!=
null
);
}
}
bluetooth
.
sppListen
(
'
server1
'
,
sppOption
,
serverSocket
);
...
...
@@ -172,11 +180,13 @@ describe('bluetoothhostTest4', function() {
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0500
'
,
0
,
async
function
(
done
)
{
function
acceptClientSocket
(
code
,
number
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js] clientSocket Number:
'
+
number
);
expect
(
true
).
assertEqual
(
number
!=
null
);
}
if
(
code
)
{
console
.
log
(
'
[bluetooth_js] error code:
'
+
code
);
}
else
{
console
.
log
(
'
[bluetooth_js] clientSocket Number:
'
+
JSON
.
stringify
(
number
));
expect
(
true
).
assertEqual
(
number
!=
null
);
}
}
bluetooth
.
sppAccept
(
0
,
acceptClientSocket
);
done
();
...
...
@@ -191,13 +201,13 @@ describe('bluetoothhostTest4', function() {
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0600
'
,
0
,
async
function
(
done
)
{
bluetooth
.
sppAccept
(
-
1
,
function
(
code
,
clientSocketNumber
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js]sppAccept Number:
'
+
clientSocketNumber
);
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
bluetooth
.
sppAccept
(
-
1
,
function
(
code
,
clientSocketNumber
)
{
if
(
code
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
);
}
else
{
expect
(
true
).
assertEqual
(
false
);
console
.
log
(
'
[bluetooth_js]sppAccept Number:
'
+
JSON
.
stringify
(
clientSocketNumber
));
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
}
});
done
();
...
...
@@ -215,12 +225,12 @@ describe('bluetoothhostTest4', function() {
let
sppOption
=
{
uuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
secure
:
true
,
type
:
0
};
bluetooth
.
sppConnect
(
'
00:11:22:33:44:55
'
,
sppOption
,
function
(
code
,
clientSocketNumber
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js]sppConnect Number:
'
+
clientSocketNumber
);
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
if
(
code
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
);
}
else
{
expect
(
true
).
assertEqual
(
false
);
console
.
log
(
'
[bluetooth_js]sppConnect Number:
'
+
JSON
.
stringify
(
clientSocketNumber
));
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
}
});
done
();
...
...
@@ -238,12 +248,12 @@ describe('bluetoothhostTest4', function() {
let
sppOption
=
{
uuid
:
'
0000
'
,
secure
:
false
,
type
:
0
};
bluetooth
.
sppConnect
(
'
ABC
'
,
sppOption
,
function
(
code
,
clientSocketNumber
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js]sppConnect Number
'
+
clientSocketNumber
);
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
if
(
code
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
);
}
else
{
expect
(
true
).
assertEqual
(
false
);
console
.
log
(
'
[bluetooth_js]sppConnect Number
'
+
JSON
.
stringify
(
clientSocketNumber
));
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
}
});
done
();
...
...
@@ -261,12 +271,12 @@ describe('bluetoothhostTest4', function() {
let
sppOption
=
{
uuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
secure
:
true
,
type
:
0
};
bluetooth
.
sppConnect
(
'
BT
'
,
sppOption
,
function
(
code
,
clientSocketNumber
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js]sppConnect Number
'
+
clientSocketNumber
);
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
if
(
code
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
);
}
else
{
expect
(
true
).
assertEqual
(
false
);
console
.
log
(
'
[bluetooth_js]sppConnect Number
'
+
JSON
.
stringify
(
clientSocketNumber
));
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
}
});
done
();
...
...
@@ -283,11 +293,14 @@ describe('bluetoothhostTest4', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000
'
,
0
,
async
function
(
done
)
{
let
serverNumber
=
-
1
;
function
serverSocket
(
code
,
number
)
{
console
.
log
(
'
bluetooth error code:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
bluetooth serverSocket Number:
'
+
number
);
if
(
code
)
{
console
.
log
(
'
bluetooth error code:
'
+
code
);
}
else
{
console
.
log
(
'
bluetooth serverSocket Number:
'
+
JSON
.
stringify
(
number
));
serverNumber
=
number
;
expect
(
true
).
assertEqual
(
serverNumber
!=
null
);
}
}
let
SppOption
=
{
uuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
secure
:
true
,
type
:
0
};
...
...
@@ -307,13 +320,13 @@ describe('bluetoothhostTest4', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1100
'
,
0
,
async
function
(
done
)
{
let
clientNumber
=
-
1
;
bluetooth
.
sppAccept
(
-
1
,
function
(
code
,
clientSocketNumber
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js]sppAccept Number:
'
+
clientSocketNumber
);
if
(
code
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
);
}
else
{
console
.
log
(
'
[bluetooth_js]sppAccept Number:
'
+
JSON
.
stringify
(
clientSocketNumber
));
clientNumber
=
clientSocketNumber
;
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
}
else
{
expect
(
true
).
assertEqual
(
false
);
}
});
bluetooth
.
sppCloseClientSocket
(
clientNumber
);
...
...
@@ -331,13 +344,13 @@ describe('bluetoothhostTest4', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1200
'
,
0
,
async
function
(
done
)
{
let
clientNumber
=
-
1
;
bluetooth
.
sppAccept
(
-
1
,
function
(
code
,
clientSocketNumber
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
.
code
);
if
(
code
.
code
==
0
)
{
console
.
log
(
'
[bluetooth_js]sppAccept Number:
'
+
clientSocketNumber
);
if
(
code
)
{
console
.
info
(
'
[bluetooth_js] code is:
'
+
code
);
}
else
{
console
.
log
(
'
[bluetooth_js]sppAccept Number:
'
+
JSON
.
stringify
(
clientSocketNumber
));
clientNumber
=
clientSocketNumber
;
expect
(
true
).
assertEqual
(
clientSocketNumber
!=
null
);
}
else
{
expect
(
true
).
assertEqual
(
false
);
}
});
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
...
...
location/geolocation_standard/src/main/js/default/test/LocationTest.test.js
浏览文件 @
09859d49
...
...
@@ -888,7 +888,8 @@ describe('geolocationTest_geo3', function () {
'
longitude:
'
+
result
.
longitude
+
'
altitude:
'
+
result
.
altitude
+
'
accuracy:
'
+
result
.
accuracy
+
'
speed:
'
+
result
.
speed
+
'
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
)
=>
{
console
.
info
(
"
[lbs_js] getLastLocation promise then error:
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录