Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
672a7af9
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看板
未验证
提交
672a7af9
编写于
7月 20, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4409 bleon扫描用例优化
Merge pull request !4409 from 黄苑/myfeature
上级
cec90372
eed5710d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
70 addition
and
65 deletion
+70
-65
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
...bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
+70
-65
未找到文件。
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
浏览文件 @
672a7af9
...
...
@@ -106,6 +106,19 @@ let MajorMinorClass = {
HEALTH_PERSONAL_MOBILITY_DEVICE
:
0x093C
};
let
ScanDuty
=
{
SCAN_MODE_LOW_POWER
:
0
,
SCAN_MODE_BALANCED
:
1
,
SCAN_MODE_LOW_LATENCY
:
2
,
};
let
MatchMode
=
{
MATCH_MODE_AGGRESSIVE
:
1
,
MATCH_MODE_STICKY
:
2
,
};
describe
(
'
bluetoothhostTest
'
,
function
()
{
...
...
@@ -209,6 +222,7 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_START_BLESCAN_WITHOUT_PARAM_0001
* @tc.name testClassicStartBLEScan
...
...
@@ -221,23 +235,21 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan1 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result1 =
'
+
JSON
.
stringify
(
data
));
except
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result1 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off1:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan1 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
bluetooth
.
BLE
.
startBLEScan
([{}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE SCAN OFF01
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_START_BLESCAN_WITHOUT_PARAM_0002
* @tc.name testClassicStartBLEScan
...
...
@@ -250,19 +262,17 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan2 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result2 =
'
+
JSON
.
stringify
(
data
));
except
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result2 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan2 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
bluetooth
.
BLE
.
startBLEScan
([{
deviceId
:
"
00:00:00:00:00:00
"
}]);
bluetooth
.
BLE
.
startBLEScan
([{
deviceId
:
"
00:11:22:33:44:55
"
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan off2
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
...
...
@@ -276,22 +286,20 @@ describe('bluetoothhostTest', function() {
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetooth_START_BLESCAN_WITHOUT_PARAM_0003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan3 test start
'
);
console
.
info
(
'
[bluetooth_js] BLE scan3 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result3 =
'
+
JSON
.
stringify
(
data
));
except
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result3 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off3:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan3 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
bluetooth
.
BLE
.
startBLEScan
([{
name
:
"
bluetooth_test
"
}]);
bluetooth
.
BLE
.
startBLEScan
([{
name
:
"
blue_test
"
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan off3
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
onReceiveEvent
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
...
...
@@ -308,19 +316,15 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan4 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result4 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off4:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan4 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
console
.
info
(
'
[bluetooth_js] BLE scan device find result4 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
bluetooth
.
BLE
.
startBLEScan
([{
serviceUuid
:
"
00001888-0000-1000-8000-00805f9b34fb
"
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan device find off4:
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFina
'
,
onReceiveEvent
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
...
...
@@ -337,26 +341,24 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan5 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result5 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off5:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan5 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
bluetooth
.
BLE
.
startBLEScan
(
[{}],
{
interval
:
500
,
dutyMode
:
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_POWER
,
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
[{}],
{
interval
:
500
,
dutyMode
:
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_POWER
,
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
);
await
sleep
(
1000
);
bluetooth
.
BLE
.
off
(
"
BLEDeviceFind
"
,
onReceiveEvent
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
...
...
@@ -393,6 +395,7 @@ describe('bluetoothhostTest', function() {
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
);
done
();
})
...
...
@@ -428,6 +431,7 @@ describe('bluetoothhostTest', function() {
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
);
done
();
})
...
...
@@ -463,6 +467,7 @@ describe('bluetoothhostTest', function() {
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_STICKY
,
}
);
done
();
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录