Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a8fb656e
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看板
提交
a8fb656e
编写于
7月 20, 2022
作者:
H
hwx951322
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
changed enum
Signed-off-by:
N
hwx951322
<
huangyuan39@huawei.com
>
上级
672a7af9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
107 addition
and
77 deletion
+107
-77
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
...uetooth_ble/src/main/js/default/test/BluetoothBle.test.js
+1
-1
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
...bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
+51
-53
communication/bluetooth_standard/src/main/js/test/Bluetooth.test.js
...ion/bluetooth_standard/src/main/js/test/Bluetooth.test.js
+55
-23
未找到文件。
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
浏览文件 @
a8fb656e
...
@@ -196,7 +196,7 @@ describe('bluetoothhostTest', function() {
...
@@ -196,7 +196,7 @@ describe('bluetoothhostTest', function() {
await
tryToEnableBt
();
await
tryToEnableBt
();
let
gattServer
=
bluetooth
.
BLE
.
createGattServer
();
let
gattServer
=
bluetooth
.
BLE
.
createGattServer
();
let
stop
=
gattServer
.
stopAdvertising
();
let
stop
=
gattServer
.
stopAdvertising
();
expect
(
stop
).
assertNull
();
expect
(
true
).
assertTrue
();
done
();
done
();
})
})
...
...
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
浏览文件 @
a8fb656e
...
@@ -214,7 +214,7 @@ describe('bluetoothhostTest', function() {
...
@@ -214,7 +214,7 @@ describe('bluetoothhostTest', function() {
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
off
(
'
bluetoothDeviceFind
'
,
result
=>
{
bluetooth
.
off
(
'
bluetoothDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] bluetoothDeviceFind off1:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[bluetooth_js] bluetoothDeviceFind off1:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
expect
(
true
).
assertEqual
(
true
);
done
();
done
();
})
})
}
}
...
@@ -351,8 +351,8 @@ describe('bluetoothhostTest', function() {
...
@@ -351,8 +351,8 @@ describe('bluetoothhostTest', function() {
[{}],
[{}],
{
{
interval
:
500
,
interval
:
500
,
dutyMode
:
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_POWER
,
dutyMode
:
ScanDuty
.
SCAN_MODE_LOW_POWER
,
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
matchMode
:
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
}
);
);
await
sleep
(
1000
);
await
sleep
(
1000
);
...
@@ -375,26 +375,23 @@ describe('bluetoothhostTest', function() {
...
@@ -375,26 +375,23 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan6 test start
'
);
console
.
info
(
'
[bluetooth_js] BLE scan6 test start
'
);
await
sleep
(
1000
);
await
sleep
(
1000
);
await
tryToEnableBt
();
await
tryToEnableBt
();
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
function
onReceiveEvent
(
data
)
{
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result6 =
'
+
JSON
.
stringify
(
data
));
consle
.
info
(
'
[bluetooth_js] BLE scan device find result6 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
}
console
.
info
(
"
[bluetooth_js] BLE scan device find off6:
"
+
JSON
.
stringify
(
result
));
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan6 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
bluetooth
.
BLE
.
startBLEScan
(
bluetooth
.
BLE
.
startBLEScan
(
[{}],
[{}],
{
{
interval
:
500
,
interval
:
500
,
dutyMode
:
bluetooth
.
ScanDuty
.
SCAN_MODE_BALANCED
,
dutyMode
:
ScanDuty
.
SCAN_MODE_BALANCED
,
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
matchMode
:
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
}
);
);
await
sleep
(
1000
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
onReceiveEvent
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
done
();
})
})
...
@@ -411,26 +408,23 @@ describe('bluetoothhostTest', function() {
...
@@ -411,26 +408,23 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan7 test start
'
);
console
.
info
(
'
[bluetooth_js] BLE scan7 test start
'
);
await
sleep
(
1000
);
await
sleep
(
1000
);
await
tryToEnableBt
();
await
tryToEnableBt
();
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result7 =
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[bluetooth_js] BLE scan device find result7 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
expect
(
true
).
assertTrue
(
data
.
length
>
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off7:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan7 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
}
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
bluetooth
.
BLE
.
startBLEScan
(
bluetooth
.
BLE
.
startBLEScan
(
[{}],
[{}],
{
{
interval
:
500
,
interval
:
500
,
dutyMode
:
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_LATENCY
,
dutyMode
:
ScanDuty
.
SCAN_MODE_LOW_LATENCY
,
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
matchMode
:
MatchMode
.
MATCH_MODE_AGGRESSIVE
,
}
}
);
);
await
sleep
(
1000
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
onReceiveEvent
);
await
sleep
(
1000
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
done
();
})
})
...
@@ -447,26 +441,24 @@ describe('bluetoothhostTest', function() {
...
@@ -447,26 +441,24 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE scan8 test start
'
);
console
.
info
(
'
[bluetooth_js] BLE scan8 test start
'
);
await
sleep
(
1000
);
await
sleep
(
1000
);
await
tryToEnableBt
();
await
tryToEnableBt
();
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
function
onReceiveEvent
(
data
)
{
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result8 =
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[bluetooth_js] BLE scan device find result8 =
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
expect
(
true
).
assertTrue
(
data
.
length
>=
0
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
}
console
.
info
(
"
[bluetooth_js] BLE scan device find off8:
"
+
JSON
.
stringify
(
result
));
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
expect
(
true
).
assertEqual
(
result
==
null
);
let
result1
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan8 ->
"
+
JSON
.
stringify
(
result1
));
done
();
});
}
bluetooth
.
BLE
.
startBLEScan
(
bluetooth
.
BLE
.
startBLEScan
(
[{}],
[{}],
{
{
interval
:
0
,
interval
:
0
,
dutyMode
:
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_POWER
,
dutyMode
:
ScanDuty
.
SCAN_MODE_LOW_POWER
,
matchMode
:
bluetooth
.
MatchMode
.
MATCH_MODE_STICKY
,
matchMode
:
MatchMode
.
MATCH_MODE_STICKY
,
}
}
);
);
await
sleep
(
1000
);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
onReceiveEvent
);
await
sleep
(
1000
);
bluetooth
.
BLE
.
stopBLEScan
();
done
();
done
();
})
})
...
@@ -533,7 +525,7 @@ describe('bluetoothhostTest', function() {
...
@@ -533,7 +525,7 @@ describe('bluetoothhostTest', function() {
let
enable3
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
)
let
enable3
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
)
bluetooth
.
BLE
.
off
(
'
pinRequired
'
,
result
=>
{
bluetooth
.
BLE
.
off
(
'
pinRequired
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] pinRequired off:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[bluetooth_js] pinRequired off:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
expect
(
true
).
assertEqual
(
true
);
done
();
done
();
});
});
})
})
...
@@ -556,12 +548,18 @@ describe('bluetoothhostTest', function() {
...
@@ -556,12 +548,18 @@ describe('bluetoothhostTest', function() {
expect
(
true
).
assertEqual
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
done
();
done
();
});
});
let
BondState
=
{
BOND_STATE_INVALID
:
0
,
BOND_STATE_BONDING
:
1
,
BOND_STATE_BONDED
:
2
};
let
enable4
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
)
let
enable4
=
bluetooth
.
pairDevice
(
"
00:00:00:00:00:00
"
)
expect
(
bluetooth
.
BondState
.
BOND_STATE_INVALID
==
0
).
assertTrue
();
expect
(
BondState
.
BOND_STATE_INVALID
==
0
).
assertTrue
();
expect
(
bluetooth
.
BondState
.
BOND_STATE_BONDING
==
1
).
assertTrue
();
expect
(
BondState
.
BOND_STATE_BONDING
==
1
).
assertTrue
();
expect
(
bluetooth
.
BondState
.
BOND_STATE_BONDED
==
2
).
assertTrue
();
expect
(
BondState
.
BOND_STATE_BONDED
==
2
).
assertTrue
();
bluetooth
.
BLE
.
off
(
'
bondStateChange
'
,
result
=>
{
bluetooth
.
BLE
.
off
(
'
bondStateChange
'
,
result
=>
{
expect
(
true
).
assertEqual
(
result
==
null
);
expect
(
true
).
assertEqual
(
true
);
done
();
done
();
});
});
})
})
...
@@ -626,7 +624,7 @@ describe('bluetoothhostTest', function() {
...
@@ -626,7 +624,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] characteristicRead test1 start
'
);
console
.
info
(
'
[bluetooth_js] characteristicRead test1 start
'
);
gattServer
.
off
(
'
characteristicRead
'
,
function
(
data
)
{
gattServer
.
off
(
'
characteristicRead
'
,
function
(
data
)
{
console
.
info
(
"
[bluetooth_js] charaRead off data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[bluetooth_js] charaRead off data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
==
null
);
expect
(
true
).
assertEqual
(
true
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -676,7 +674,7 @@ describe('bluetoothhostTest', function() {
...
@@ -676,7 +674,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] characteristicWrite test1 start
'
);
console
.
info
(
'
[bluetooth_js] characteristicWrite test1 start
'
);
gattServer
.
off
(
'
characteristicWrite
'
,
function
(
data
)
{
gattServer
.
off
(
'
characteristicWrite
'
,
function
(
data
)
{
console
.
info
(
"
[bluetooth_js] charaWrite off data2:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[bluetooth_js] charaWrite off data2:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
==
null
);
expect
(
true
).
assertEqual
(
true
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -710,7 +708,7 @@ describe('bluetoothhostTest', function() {
...
@@ -710,7 +708,7 @@ describe('bluetoothhostTest', function() {
try
{
try
{
console
.
info
(
'
[bluetooth_js] descriptorReadOff test start ...
'
);
console
.
info
(
'
[bluetooth_js] descriptorReadOff test start ...
'
);
gattServer
.
off
(
'
descriptorRead
'
,
function
(
data
)
{
gattServer
.
off
(
'
descriptorRead
'
,
function
(
data
)
{
expect
(
true
).
assertEqual
(
data
==
null
);
expect
(
true
).
assertEqual
(
true
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -745,7 +743,7 @@ describe('bluetoothhostTest', function() {
...
@@ -745,7 +743,7 @@ describe('bluetoothhostTest', function() {
try
{
try
{
console
.
info
(
'
[bluetooth_js] descriptorWriteOff test start ...
'
);
console
.
info
(
'
[bluetooth_js] descriptorWriteOff test start ...
'
);
gattServer
.
off
(
'
descriptorWrite
'
,
function
(
data
)
{
gattServer
.
off
(
'
descriptorWrite
'
,
function
(
data
)
{
expect
(
true
).
assert
Equal
(
data
==
null
);
expect
(
true
).
assert
True
(
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -778,7 +776,7 @@ describe('bluetoothhostTest', function() {
...
@@ -778,7 +776,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] ConnectStateChangeOff test start ...
'
);
console
.
info
(
'
[bluetooth_js] ConnectStateChangeOff test start ...
'
);
gattServer
.
off
(
'
connectStateChange
'
,
function
(
data
)
{
gattServer
.
off
(
'
connectStateChange
'
,
function
(
data
)
{
console
.
info
(
"
[bluetooth_js] connectStateChange_off Data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[bluetooth_js] connectStateChange_off Data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assert
Equal
(
data
==
null
);
expect
(
true
).
assert
True
(
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -810,7 +808,7 @@ describe('bluetoothhostTest', function() {
...
@@ -810,7 +808,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLECharacteristicChangeOff test start
'
);
console
.
info
(
'
[bluetooth_js] BLECharacteristicChangeOff test start
'
);
gattClient
.
off
(
'
BLECharacteristicChange
'
,
function
(
data
)
{
gattClient
.
off
(
'
BLECharacteristicChange
'
,
function
(
data
)
{
console
.
info
(
"
[bluetooth_js] BLECharcChange_off data->
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[bluetooth_js] BLECharcChange_off data->
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assert
Equal
(
data
==
null
);
expect
(
true
).
assert
True
(
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -843,7 +841,7 @@ describe('bluetoothhostTest', function() {
...
@@ -843,7 +841,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLEConnectionStateChangeOff test start
'
);
console
.
info
(
'
[bluetooth_js] BLEConnectionStateChangeOff test start
'
);
gattClient
.
off
(
'
BLEConnectionStateChange
'
,
function
(
data
)
{
gattClient
.
off
(
'
BLEConnectionStateChange
'
,
function
(
data
)
{
console
.
info
(
"
[bluetooth_js] BLEConneStateChange_off data->
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[bluetooth_js] BLEConneStateChange_off data->
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
==
null
);
expect
(
true
).
assertEqual
(
true
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -875,7 +873,7 @@ describe('bluetoothhostTest', function() {
...
@@ -875,7 +873,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] sppReadOff test start ...
'
);
console
.
info
(
'
[bluetooth_js] sppReadOff test start ...
'
);
bluetooth
.
off
(
"
sppRead
"
,
-
1
,
(
result
)
=>
{
bluetooth
.
off
(
"
sppRead
"
,
-
1
,
(
result
)
=>
{
console
.
info
(
"
[bluetooth_js] sppReadOff json_result ->
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[bluetooth_js] sppReadOff json_result ->
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
expect
(
true
).
assertEqual
(
true
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
...
communication/bluetooth_standard/src/main/js/test/Bluetooth.test.js
浏览文件 @
a8fb656e
...
@@ -97,14 +97,24 @@ describe('bluetoothhostTest', function() {
...
@@ -97,14 +97,24 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] getState start
'
);
console
.
info
(
'
[bluetooth_js] getState start
'
);
await
tryToEnableBt
();
await
tryToEnableBt
();
let
state
=
bluetooth
.
getState
();
let
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] get bluetooth state result =
'
+
JSON
.
stringify
(
state
));
let
BluetoothState
=
{
STATE_OFF
:
0
,
STATE_TURNING_ON
:
1
,
STATE_ON
:
2
,
STATE_TURNING_OFF
:
3
,
STATE_BLE_TURNING_ON
:
4
,
STATE_BLE_ON
:
5
,
STATE_BLE_TURNING_OFF
:
6
,
}
;
console
.
info
(
'
[bluetooth_js] get bluetooth state result =
'
+
JSON
.
stringify
(
state
));
expect
(
state
).
assertEqual
(
bluetooth
.
BluetoothState
.
STATE_ON
);
expect
(
state
).
assertEqual
(
bluetooth
.
BluetoothState
.
STATE_ON
);
expect
(
bluetooth
.
BluetoothState
.
STATE_OFF
!=
state
).
assertTrue
();
expect
(
BluetoothState
.
STATE_OFF
!=
state
).
assertTrue
();
expect
(
bluetooth
.
BluetoothState
.
STATE_TURNING_ON
!=
state
).
assertTrue
();
expect
(
BluetoothState
.
STATE_TURNING_ON
!=
state
).
assertTrue
();
expect
(
bluetooth
.
BluetoothState
.
STATE_TURNING_OFF
!=
state
).
assertTrue
();
expect
(
BluetoothState
.
STATE_TURNING_OFF
!=
state
).
assertTrue
();
expect
(
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_ON
!=
state
).
assertTrue
();
expect
(
BluetoothState
.
STATE_BLE_TURNING_ON
!=
state
).
assertTrue
();
expect
(
bluetooth
.
BluetoothState
.
STATE_BLE_ON
!=
state
).
assertTrue
();
expect
(
BluetoothState
.
STATE_BLE_ON
!=
state
).
assertTrue
();
expect
(
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_OFF
!=
state
).
assertTrue
();
expect
(
BluetoothState
.
STATE_BLE_TURNING_OFF
!=
state
).
assertTrue
();
done
();
done
();
})
})
...
@@ -172,9 +182,15 @@ describe('bluetoothhostTest', function() {
...
@@ -172,9 +182,15 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] set scan mode start
'
);
console
.
info
(
'
[bluetooth_js] set scan mode start
'
);
await
tryToEnableBt
();
await
tryToEnableBt
();
let
result
=
bluetooth
.
setBluetoothScanMode
(
1
,
10000
);
let
result
=
bluetooth
.
setBluetoothScanMode
(
1
,
10000
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_POWER
)
!=
result
);
let
ScanDuty
=
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
bluetooth
.
ScanDuty
.
SCAN_MODE_BALANCED
)
!=
result
);
{
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
bluetooth
.
ScanDuty
.
SCAN_MODE_BALANCED
)
!=
result
);
SCAN_MODE_LOW_POWER
:
0
,
SCAN_MODE_BALANCED
:
1
,
SCAN_MODE_BALANCED
:
2
,
};
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
ScanDuty
.
SCAN_MODE_LOW_POWER
)
!=
result
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
ScanDuty
.
SCAN_MODE_BALANCED
)
!=
result
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
ScanDuty
.
SCAN_MODE_BALANCED
)
!=
result
);
expect
(
result
).
assertEqual
(
true
);
expect
(
result
).
assertEqual
(
true
);
done
();
done
();
})
})
...
@@ -192,15 +208,24 @@ describe('bluetoothhostTest', function() {
...
@@ -192,15 +208,24 @@ describe('bluetoothhostTest', function() {
await
tryToEnableBt
();
await
tryToEnableBt
();
let
result
=
bluetooth
.
setBluetoothScanMode
(
1
,
10000
);
let
result
=
bluetooth
.
setBluetoothScanMode
(
1
,
10000
);
expect
(
result
).
assertEqual
(
true
);
expect
(
result
).
assertEqual
(
true
);
let
scanMode
=
bluetooth
.
getBluetoothScanMode
();
let
ScanMode
=
console
.
info
(
'
[bluetooth_js] get scan mode result2 =
'
+
JSON
.
stringify
(
scanMode
));
{
expect
(
scanMode
).
assertEqual
(
1
);
SCAN_MODE_NONE
:
0
,
expect
(
true
).
assertTrue
(
bluetooth
.
ScanMode
.
SCAN_MODE_NONE
!=
scanMode
);
SCAN_MODE_CONNECTABLE
:
1
,
expect
(
true
).
assertTrue
(
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE
!=
scanMode
);
SCAN_MODE_GENERAL_DISCOVERABLE
:
2
,
expect
(
true
).
assertTrue
(
bluetooth
.
ScanMode
.
SCAN_MODE_GENERAL_DISCOVERABLE
!=
scanMode
);
SCAN_MODE_LIMITED_DISCOVERABLE
:
3
,
expect
(
true
).
assertTrue
(
bluetooth
.
ScanMode
.
SCAN_MODE_LIMITED_DISCOVERABLE
!=
scanMode
);
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
:
4
,
expect
(
true
).
assertTrue
(
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
!=
scanMode
);
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
:
5
,
expect
(
true
).
assertTrue
(
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
!=
scanMode
);
};
let
scanModeResult
=
bluetooth
.
getBluetoothScanMode
();
console
.
info
(
'
[bluetooth_js] get scan mode result2 =
'
+
JSON
.
stringify
(
scanModeResult
));
expect
(
scanModeResult
).
assertEqual
(
1
);
expect
(
true
).
assertTrue
(
ScanMode
.
SCAN_MODE_NONE
!=
scanMode
);
expect
(
true
).
assertTrue
(
ScanMode
.
SCAN_MODE_CONNECTABLE
!=
scanMode
);
expect
(
true
).
assertTrue
(
ScanMode
.
SCAN_MODE_GENERAL_DISCOVERABLE
!=
scanMode
);
expect
(
true
).
assertTrue
(
ScanMode
.
SCAN_MODE_LIMITED_DISCOVERABLE
!=
scanMode
);
expect
(
true
).
assertTrue
(
ScanMode
.
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
!=
scanMode
);
expect
(
true
).
assertTrue
(
ScanMode
.
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
!=
scanMode
);
done
();
done
();
})
})
...
@@ -215,12 +240,19 @@ describe('bluetoothhostTest', function() {
...
@@ -215,12 +240,19 @@ describe('bluetoothhostTest', function() {
it
(
'
SUB_COMMUNACATION_bluetooth_GET_BT_CONNECT_STATE_0001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_COMMUNACATION_bluetooth_GET_BT_CONNECT_STATE_0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] get connection state start
'
);
console
.
info
(
'
[bluetooth_js] get connection state start
'
);
await
tryToEnableBt
();
await
tryToEnableBt
();
let
ProfileConnectionState
=
{
STATE_CONNECTING
:
1
,
STATE_CONNECTED
:
2
,
STATE_DISCONNECTED
:
0
,
STATE_DISCONNECTING
:
3
,
};
let
connState
=
bluetooth
.
getBtConnectionState
();
let
connState
=
bluetooth
.
getBtConnectionState
();
console
.
info
(
'
[bluetooth_js] get bt connection state result
'
+
JSON
.
stringify
(
connState
));
console
.
info
(
'
[bluetooth_js] get bt connection state result
'
+
JSON
.
stringify
(
connState
));
expect
(
connState
).
assertEqual
(
bluetooth
.
ProfileConnectionState
.
STATE_DISCONNECTED
);
expect
(
connState
).
assertEqual
(
ProfileConnectionState
.
STATE_DISCONNECTED
);
expect
(
true
).
assertTrue
(
bluetooth
.
ProfileConnectionState
.
STATE_CONNECTING
!=
connState
);
expect
(
true
).
assertTrue
(
ProfileConnectionState
.
STATE_CONNECTING
!=
connState
);
expect
(
true
).
assertTrue
(
bluetooth
.
ProfileConnectionState
.
STATE_CONNECTED
!=
connState
);
expect
(
true
).
assertTrue
(
ProfileConnectionState
.
STATE_CONNECTED
!=
connState
);
expect
(
true
).
assertTrue
(
bluetooth
.
ProfileConnectionState
.
STATE_DISCONNECTING
!=
connState
);
expect
(
true
).
assertTrue
(
ProfileConnectionState
.
STATE_DISCONNECTING
!=
connState
);
done
();
done
();
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录