Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ee1cab27
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看板
未验证
提交
ee1cab27
编写于
5月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8779 【XTS】【communication】【Beta1】修改蓝牙流水线问题
Merge pull request !8779 from 权力/myfeature3
上级
af31a8c7
6614382d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
81 addition
and
47 deletion
+81
-47
communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js
...ion/bluetooth_ble/src/main/js/test/BleGattManager.test.js
+47
-30
communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js
...bluetooth_manager/src/main/js/test/BleGattManager.test.js
+34
-17
未找到文件。
communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js
浏览文件 @
ee1cab27
...
@@ -143,28 +143,34 @@ describe('bluetoothBLETest', function() {
...
@@ -143,28 +143,34 @@ 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
();
try
{
try
{
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
);
done
();
done
();
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
bluetooth getRssiValue has error:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
bluetooth getRssiValue has error:
'
+
JSON
.
stringify
(
error
));
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
let
b
=
false
;
done
();
if
(
err
.
code
==
2900099
||
err
.
code
==-
1
)
});
{
}
catch
(
error
)
{
b
=
true
console
.
error
(
`[bluetooth_js]GetRssiValue_0100 error, code is
${
error
.
code
}
,
}
message is
${
error
.
message
}
`
);
expect
(
true
).
assertEqual
(
b
);
}
done
();
let
disconnect
=
gattClient
.
disconnect
();
});
console
.
info
(
'
[bluetooth_js] gatt getrssi disconnect:
'
+
disconnect
);
let
disconnect
=
gattClient
.
disconnect
();
expect
(
disconnect
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] gatt getrssi disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]GetRssiValue_0100 error, code is
${
error
.
code
}
,
message is
${
error
.
message
}
`
);
}
done
()
done
()
})
})
/**
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200
* @tc.name testgetRssiValue
* @tc.name testgetRssiValue
* @tc.desc Test testGetDeviceName api by callback.
* @tc.desc Test testGetDeviceName api by callback.
...
@@ -177,17 +183,28 @@ describe('bluetoothBLETest', function() {
...
@@ -177,17 +183,28 @@ 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
();
let
promise
=
new
Promise
((
resolve
)
=>
{
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
err
));
let
b
=
false
;
if
(
err
.
code
==
2900099
||
err
.
code
==-
1
)
{
b
=
true
}
expect
(
true
).
assertEqual
(
b
);
}
else
{
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertNull
();
expect
(
true
).
assertEqual
(
data
!=
null
)
let
disconnect
=
gattClient
.
disconnect
();
}
console
.
info
(
'
[bluetooth_js] gatt getrssi1 disconnect:
'
+
disconnect
);
}
);
expect
(
disconnect
).
assertEqual
(
false
);
let
disconnect
=
gattClient
.
disconnect
(
);
}
);
console
.
info
(
'
[bluetooth_js] gatt getrssi1 disconnect:
'
+
disconnect
);
resolve
()
expect
(
disconnect
).
assertEqual
(
false
);
})
await
sleep
(
3000
);
await
promise
.
then
(
done
)
done
(
)
})
})
/**
/**
...
...
communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js
浏览文件 @
ee1cab27
...
@@ -157,18 +157,23 @@ describe('bluetoothBLETest', function() {
...
@@ -157,18 +157,23 @@ describe('bluetoothBLETest', function() {
try
{
try
{
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
;
expect
(
true
).
assertEqual
(
data
!=
null
);
console
.
info
(
'
[bluetooth_js] BLE read rssi:
'
+
JSON
.
stringify
(
rssiLength
));
expect
(
rssiLength
).
assertEqual
(
0
);
done
();
done
();
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
info
(
'
bluetooth getRssiValue has error:
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
bluetooth getRssiValue has error:
'
+
JSON
.
stringify
(
err
));
// expect(true).assertEqual(error.code==2900099||error.code==-1);
let
b
=
false
;
if
(
err
.
code
==
2900099
||
err
.
code
==-
1
)
{
b
=
true
}
expect
(
true
).
assertEqual
(
b
);
done
();
done
();
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]GetRssiValue_0100 error, code is
${
error
.
code
}
,
console
.
error
(
`[bluetooth_js]GetRssiValue_0100 error, code is
${
error
.
code
}
,
message is
${
error
.
message
}
`
);
message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
expect
(
false
).
assertEqual
(
true
);
done
()
done
()
}
}
...
@@ -185,23 +190,35 @@ describe('bluetoothBLETest', function() {
...
@@ -185,23 +190,35 @@ describe('bluetoothBLETest', function() {
*/
*/
it
(
'
COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200
'
,
0
,
async
function
(
done
)
{
try
{
try
{
let
promise
=
new
Promise
((
resolve
)
=>
{
function
getRssi
()
{
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
err
)
{
gattClient
.
getRssiValue
((
err
,
data
)
=>
{
console
.
error
(
'
getRssi failed
'
);
if
(
err
)
{
}
console
.
error
(
'
getRssi failed
'
);
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
data
));
let
b
=
false
;
expect
(
true
).
assertFalse
();
if
(
err
.
code
==
2900099
||
err
.
code
==-
1
)
{
b
=
true
}
expect
(
true
).
assertEqual
(
b
);
}
else
{
console
.
info
(
'
[bluetooth_js]getRssi value:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
}
resolve
();
});
});
});
resolve
()
}
})
await
getRssi
();
await
promise
.
then
(
done
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]GetRssiValue_0200 error, code is
${
error
.
code
}
,
console
.
error
(
`[bluetooth_js]GetRssiValue_0200 error, code is
${
error
.
code
}
,
message is
${
error
.
message
}
`
);
message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
expect
(
false
).
assertEqual
(
true
);
done
()
}
}
await
sleep
(
2000
);
done
();
})
})
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录