Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9c431fd8
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看板
提交
9c431fd8
编写于
8月 01, 2023
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
6b5d174e
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
53 addition
and
43 deletion
+53
-43
communication/bluetooth_gatt/src/main/js/test/BtGattManager.test.js
...ion/bluetooth_gatt/src/main/js/test/BtGattManager.test.js
+12
-12
communication/bluetooth_gatt/src/main/js/test/BtGattService.test.js
...ion/bluetooth_gatt/src/main/js/test/BtGattService.test.js
+2
-2
communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js
...etooth_gatt/src/main/js/test/BtManagerGattService.test.js
+3
-5
communication/bluetooth_scanpairing/src/main/js/test/BtPair.test.js
...ion/bluetooth_scanpairing/src/main/js/test/BtPair.test.js
+33
-21
communication/nfc_Controller/src/main/js/test/ATagSession.test.js
...ation/nfc_Controller/src/main/js/test/ATagSession.test.js
+3
-3
未找到文件。
communication/bluetooth_gatt/src/main/js/test/BtGattManager.test.js
浏览文件 @
9c431fd8
...
...
@@ -78,11 +78,11 @@ describe('btGattManagerTest', function() {
let
ret
=
gattClient
.
connect
();
await
sleep
(
2000
);
console
.
info
(
'
[bluetooth_js] gattClient connect
'
+
ret
)
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
done
()
done
()
;
})
/**
...
...
@@ -96,7 +96,7 @@ describe('btGattManagerTest', function() {
let
result
=
bluetooth
.
BLE
.
getConnectedBLEDevices
();
console
.
info
(
"
[bluetooth_js] getConnDev:
"
+
JSON
.
stringify
(
result
)
+
"
length:
"
+
result
.
length
);
expect
(
result
.
length
).
assertEqual
(
0
);
expect
(
true
).
assertEqual
(
result
.
length
>=
0
);
})
/**
...
...
@@ -116,11 +116,11 @@ describe('btGattManagerTest', function() {
await
gattClient
.
on
(
'
BLEConnectionStateChange
'
,
ConnectStateChanged
);
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gattClient connect
'
+
ret
)
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
gattClient
.
disconnect
();
await
sleep
(
2000
);
await
gattClient
.
off
(
"
BLEConnectionStateChange
"
);
done
()
done
()
;
})
/**
...
...
@@ -133,7 +133,7 @@ describe('btGattManagerTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_GETRSSIVALUE_0100
'
,
0
,
async
function
(
done
)
{
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gattClient getrssi connect:
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
try
{
await
gattClient
.
getRssiValue
().
then
((
data
)
=>
{
console
.
info
(
'
[bluetooth_js] BLE read rssi:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -171,7 +171,7 @@ describe('btGattManagerTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_GETRSSIVALUE_0200
'
,
0
,
async
function
(
done
)
{
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gattClient getRssi connect
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
if
(
err
)
{
...
...
@@ -206,14 +206,14 @@ describe('btGattManagerTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_GETDEVICENAME_0100
'
,
0
,
async
function
(
done
)
{
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gattClient getname2 connect
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
await
gattClient
.
getDeviceName
().
then
((
data
)
=>
{
console
.
info
(
'
[bluetooth_js] device name
'
+
JSON
.
stringify
(
data
))
expect
(
true
).
assertEqual
(
data
!=
null
);
done
();
}).
catch
(
err
=>
{
console
.
error
(
'
bluetooth getDeviceName has error:
'
+
err
);
expect
(
true
).
assertEqual
(
true
);
expect
(
err
.
code
).
assertEqual
(
2900099
);
done
();
});
let
disconnect
=
gattClient
.
disconnect
();
...
...
@@ -233,15 +233,15 @@ describe('btGattManagerTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_GETDEVICENAME_0200
'
,
0
,
async
function
(
done
)
{
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gattClient getname1 connect
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
gattClient
.
getDeviceName
((
err
,
data
)
=>
{
console
.
info
(
'
[bluetooth_js]getname value:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[bluetooth_js]getname err code:
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertEqual
(
data
!=
null
);
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt getname1 disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
});
await
sleep
(
2000
);
done
();
})
...
...
@@ -255,7 +255,7 @@ describe('btGattManagerTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_GETSERVICE_0100
'
,
0
,
async
function
(
done
)
{
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js]gattClient getservices1 connect
'
+
JSON
.
stringify
(
ret
))
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
await
gattClient
.
getServices
().
then
((
GattService
)
=>
{
console
.
info
(
'
[bluetooth_js] getServices successfully:
'
+
JSON
.
stringify
(
GattService
));
expect
(
GattService
).
assertNull
();
...
...
communication/bluetooth_gatt/src/main/js/test/BtGattService.test.js
浏览文件 @
9c431fd8
...
...
@@ -87,9 +87,9 @@ describe('btGattServiceTest', function() {
let
ret
=
gattClient
.
connect
();
await
sleep
(
2000
);
console
.
info
(
'
[bluetooth_js] gattClient connect
'
+
ret
)
expect
(
ret
).
assert
Tru
e
();
expect
(
ret
).
assert
Fals
e
();
await
gattServer
.
off
(
"
connectStateChange
"
);
done
()
done
()
;
})
/**
...
...
communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js
浏览文件 @
9c431fd8
...
...
@@ -93,13 +93,11 @@ describe('btManagerGattServiceTest', function() {
gattClient
.
connect
();
await
sleep
(
2000
);
await
gattServer
.
off
(
"
connectStateChange
"
);
done
()
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]Connect_0100 failed, code is
${
error
.
code
}
,
message is
${
error
.
message
}
`
);
expect
(
true
).
assertFalse
();
console
.
error
(
`[bluetooth_js]Connect_0100 failed, code is
${
error
.
code
}
,message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
}
done
();
})
/**
...
...
communication/bluetooth_scanpairing/src/main/js/test/BtPair.test.js
浏览文件 @
9c431fd8
...
...
@@ -72,11 +72,15 @@ describe('btPairTest', function() {
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_PAIR_0100
'
,
0
,
async
function
(
done
)
{
try
{
let
result
=
bluetooth
.
pairDevice
(
"
11:22:55:66:33:44
"
);
await
sleep
(
32000
);
console
.
info
(
"
[bluetooth_js] onStartpair001 ->
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertTrue
();
done
()
await
sleep
(
3000
);
expect
(
true
).
assertEqual
(
result
==
false
);
}
catch
(
err
)
{
console
.
error
(
"
pairDevice errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
'
2900099
'
);
}
done
();
})
/**
...
...
@@ -225,15 +229,19 @@ describe('btPairTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_PAIR_0700
'
,
0
,
async
function
(
done
)
{
function
PinRequiredParam
(
data
)
{
console
.
info
(
"
[bluetooth_js] pinRequired on:
"
+
JSON
.
stringify
(
data
));
bluetooth
.
setDevicePairingConfirmation
(
data
.
deviceId
,
false
);
bluetooth
.
setDevicePairingConfirmation
(
data
.
deviceId
,
false
);
}
try
{
bluetooth
.
BLE
.
on
(
'
pinRequired
'
,
PinRequiredParam
);
let
result
=
bluetooth
.
pairDevice
(
"
11:22:55:66:33:44
"
);
await
sleep
(
32000
);
console
.
info
(
"
[bluetooth_js] onStartpair007 ->
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertTrue
();
await
sleep
(
2000
);
expect
(
true
).
assertEqual
(
result
==
false
);
bluetooth
.
BLE
.
off
(
'
pinRequired
'
,
PinRequiredParam
);
done
()
}
catch
(
err
)
{
console
.
error
(
"
errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
'
2900099
'
);
}
done
();
})
/**
...
...
@@ -246,15 +254,19 @@ describe('btPairTest', function() {
it
(
'
SUB_COMMUNICATION_BLUETOOTH_PAIR_0800
'
,
0
,
async
function
(
done
)
{
function
PinRequiredParam
(
data
)
{
console
.
info
(
"
[bluetooth_js] pinRequired on:
"
+
JSON
.
stringify
(
data
));
bluetooth
.
setDevicePairingConfirmation
(
data
.
deviceId
,
true
);
bluetooth
.
setDevicePairingConfirmation
(
data
.
deviceId
,
true
);
}
try
{
bluetooth
.
BLE
.
on
(
'
pinRequired
'
,
PinRequiredParam
);
let
result
=
bluetooth
.
pairDevice
(
"
11:22:55:66:33:44
"
);
await
sleep
(
32000
);
console
.
info
(
"
[bluetooth_js] onStartpair008 ->
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertTrue
();
await
sleep
(
2000
);
expect
(
true
).
assertEqual
(
result
==
false
);
bluetooth
.
BLE
.
off
(
'
pinRequired
'
,
PinRequiredParam
);
done
()
}
catch
(
err
)
{
console
.
error
(
"
errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
'
2900099
'
);
}
done
();
})
/**
...
...
communication/nfc_Controller/src/main/js/test/ATagSession.test.js
浏览文件 @
9c431fd8
...
...
@@ -411,9 +411,9 @@ export default function nfcATagSessionTest() {
let
settime
;
try
{
let
timeoutMs
=
1000
;
settime
=
getAtag
.
setTimeout
(
timeoutMs
);
console
.
info
(
"
[NFC_test] tagsession14 setTimeout
:
"
+
settime
);
expect
(
settim
e
).
assertTrue
();
getAtag
.
setTimeout
(
timeoutMs
);
console
.
info
(
"
[NFC_test] tagsession14 setTimeout
success
"
);
expect
(
tru
e
).
assertTrue
();
}
catch
(
error
)
{
console
.
info
(
'
[NFC_test] tagsession14 setTimeout error
'
+
error
)
expect
(
3100201
).
assertEqual
(
error
.
code
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录