Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
09d17dea
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看板
未验证
提交
09d17dea
编写于
7月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4569 【communication】修改BT 添加新接口
Merge pull request !4569 from 权力/myfeature
上级
1ac02fb3
3059ccd4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
159 addition
and
1 deletion
+159
-1
communication/bluetooth_on/src/main/js/test/BluetoothOn.test.js
...ication/bluetooth_on/src/main/js/test/BluetoothOn.test.js
+139
-1
communication/bluetooth_profile/src/main/js/test/BluetoothHid.test.js
...n/bluetooth_profile/src/main/js/test/BluetoothHid.test.js
+20
-0
未找到文件。
communication/bluetooth_on/src/main/js/test/BluetoothOn.test.js
浏览文件 @
09d17dea
...
...
@@ -505,6 +505,144 @@ describe('bluetoothhostTest', function() {
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0011
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0011
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan11 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result11 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
bluetooth
.
BLE
.
startBLEScan
([{
serviceUuid
:
"
00001812-0000-1000-8000-00805F9B34FB
"
,
serviceUuidMask
:
"
0000FFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
"
,
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan off11
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0012
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0012
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan14 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result12 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
bluetooth
.
BLE
.
startBLEScan
([{
serviceSolicitationUuid
:
"
00000101-0000-1000-8000-00805F9B34FB
"
,
serviceSolicitationUuidMask
:
"
FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
"
,
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan off12
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0013
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0013
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan13 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result13 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
const
serviceDataArrayBuffer
=
new
ArrayBuffer
(
1
);
const
serviceDataMaskArrayBuffer
=
new
ArrayBuffer
(
1
);
const
serviceDataValue
=
new
Uint8Array
(
serviceDataArrayBuffer
);
const
serviceDataMaskValue
=
new
Uint8Array
(
serviceDataMaskArrayBuffer
);
serviceDataValue
[
0
]
=
'
0xFF
'
;
serviceDataMaskValue
[
0
]
=
'
0xFF
'
;
bluetooth
.
BLE
.
startBLEScan
([{
serviceData
:
serviceDataValue
,
serviceDataMask
:
serviceDataMaskValue
,
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan off13
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0014
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0014
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan18 test start
'
);
await
sleep
(
1000
);
await
tryToEnableBt
();
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result14 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
const
manufactureDataArrayBuffer
=
new
ArrayBuffer
(
29
);
const
manufactureDataMaskArrayBuffer
=
new
ArrayBuffer
(
29
);
const
manufactureDataValue
=
new
Uint8Array
(
manufactureDataArrayBuffer
);
const
manufactureDataMaskValue
=
new
Uint8Array
(
manufactureDataMaskArrayBuffer
);
for
(
let
i
=
0
;
i
<
29
;
i
++
)
{
manufactureDataValue
[
i
]
=
'
0xFF
'
;
}
for
(
let
i
=
0
;
i
<
29
;
i
++
)
{
manufactureDataMaskValue
[
i
]
=
'
0xFF
'
;
}
bluetooth
.
BLE
.
startBLEScan
([{
manufactureData
:
manufactureDataValue
,
manufactureDataMask
:
manufactureDataMaskValue
,
}]);
await
sleep
(
1000
);
console
.
info
(
'
[bluetooth_js] BLE scan off14
'
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_PAIR_DEVICE_0001
...
...
@@ -555,7 +693,7 @@ describe('bluetoothhostTest', function() {
BOND_STATE_BONDING
:
1
,
BOND_STATE_BONDED
:
2
};
let
enable4
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
)
expect
(
BondState
.
BOND_STATE_INVALID
==
0
).
assertTrue
();
expect
(
BondState
.
BOND_STATE_BONDING
==
1
).
assertTrue
();
expect
(
BondState
.
BOND_STATE_BONDED
==
2
).
assertTrue
();
...
...
communication/bluetooth_profile/src/main/js/test/BluetoothHid.test.js
浏览文件 @
09d17dea
...
...
@@ -227,4 +227,24 @@ describe('bluetoothhostTest_host_2', function () {
})
/**
* @tc.number SUB_COMMUNACATION_bluetoothble_PANProfile_Tethering_0001
* @tc.name testonsppReadOn
* @tc.desc Test sppReadOn api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetoothble_PANProfile_Tethering_0001
'
,
0
,
async
function
(
done
)
{
await
tryToEnableBt
();
console
.
info
(
'
[bluetooth_js] tethering test start
'
);
let
panProfile
=
bluetooth
.
getProfile
(
bluetooth
.
ProfileId
.
PROFILE_PAN_NETWORK
);
let
ret
=
panProfile
.
setTethering
(
false
);
console
.
info
(
"
[bluetooth_js] setTethering false result
"
+
JSON
.
stringify
(
ret
));
let
result
=
panProfile
.
isTetheringOn
();
console
.
info
(
"
[bluetooth_js] setTethering getTetheringOn result1 false==
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertFalse
();
done
();
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录