Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5199f285
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看板
未验证
提交
5199f285
编写于
3月 07, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2233 【communication】add rk3568 wifi and bluetooth
Merge pull request !2233 from 权力/cherry-pick-1646651204
上级
570b6c96
059131cb
变更
9
展开全部
显示空白变更内容
内联
并排
Showing
9 changed file
with
441 addition
and
477 deletion
+441
-477
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
...uetooth_ble/src/main/js/default/test/BluetoothBle.test.js
+19
-1
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
...bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
+4
-30
communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
...tooth_standard/src/main/js/default/test/Bluetooth.test.js
+4
-334
communication/wifi_hotspot/src/main/js/default/pages/index/index.js
...ion/wifi_hotspot/src/main/js/default/pages/index/index.js
+1
-0
communication/wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js
.../wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js
+33
-11
communication/wifi_p2p/src/main/js/default/pages/index/index.js
...ication/wifi_p2p/src/main/js/default/pages/index/index.js
+1
-0
communication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js
...ication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js
+14
-11
communication/wifi_standard/src/main/js/default/pages/index/index.js
...on/wifi_standard/src/main/js/default/pages/index/index.js
+1
-0
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
...on/wifi_standard/src/main/js/default/test/WifiSta.test.js
+364
-90
未找到文件。
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
浏览文件 @
5199f285
...
...
@@ -99,6 +99,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] ble turning off :
'
+
JSON
.
stringify
(
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_OFF
));
console
.
info
(
'
bluetooth enable done
'
);
done
();
})
...
...
@@ -544,7 +545,7 @@ describe('bluetoothhostTest', function() {
}
let
ret
=
gattServer
.
addService
(
service
);
console
.
info
(
'
[bluetooth_js] bluetooth addService ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
tru
e
);
expect
(
ret
).
assertEqual
(
fals
e
);
console
.
info
(
'
[bluetooth_js] addService end
'
);
})
...
...
@@ -688,5 +689,22 @@ describe('bluetoothhostTest', function() {
}
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_DISCONNRCT_0001
* @tc.name testDisConnect
* @tc.desc Test DisConnect api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_disconnect
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] gatt disconnect start
'
);
let
ret
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt disconnect ret:
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] gatt disconnect end
'
);
})
})
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
浏览文件 @
5199f285
...
...
@@ -18,29 +18,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
var
SppType
=
{
SPP_RFCOMM
:
0
}
var
MatchMode
=
{
MATCH_MODE_AGGRESSIVE
:
1
,
MATCH_MODE_STICKY
:
2
}
var
MajorClass
=
{
MAJOR_MISC
:
0x0000
,
MAJOR_COMPUTER
:
0x0100
,
MAJOR_PHONE
:
0x0200
,
MAJOR_NETWORKING
:
0x0300
,
MAJOR_AUDIO_VIDEO
:
0x0400
,
MAJOR_PERIPHERAL
:
0x0500
,
MAJOR_IMAGING
:
0x0600
,
MAJOR_WEARABLE
:
0x0700
,
MAJOR_TOY
:
0x0800
,
MAJOR_HEALTH
:
0x0900
,
MAJOR_UNCATEGORIZED
:
0x1F00
}
describe
(
'
bluetoothhostTest
'
,
function
()
{
var
gattServer
=
null
;
...
...
@@ -104,7 +81,7 @@ describe('bluetoothhostTest', function() {
var
enable
=
bluetooth
.
enableBluetooth
();
expect
(
enable
).
assertEqual
(
true
);
console
.
info
(
'
[bluetooth_js] enable On =
'
+
JSON
.
stringify
(
enable
));
await
sleep
(
10
000
);
await
sleep
(
4
000
);
var
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] getState On =
'
+
JSON
.
stringify
(
state
));
await
bluetooth
.
off
(
'
stateChange
'
,
result
=>
{
...
...
@@ -138,12 +115,13 @@ describe('bluetoothhostTest', function() {
await
bluetooth
.
startBluetoothDiscovery
();
await
bluetooth
.
off
(
'
bluetoothDeviceFind
'
,
result
=>
{
console
.
info
(
"
bluetoothDeviceFind off:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[bluetooth_js]
bluetoothDeviceFind off:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
done
();
});
console
.
info
(
'
[bluetooth_js] discovery end
'
);
done
();
await
sleep
(
2000
);
})
...
...
@@ -158,10 +136,6 @@ describe('bluetoothhostTest', function() {
*/
it
(
'
bluetooth_ble_start_scan_without_param
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan start without scan options start
'
);
var
enable
=
bluetooth
.
enableBluetooth
();
expect
(
enable
).
assertEqual
(
true
);
console
.
info
(
'
[bluetooth_js] enable On1 =
'
+
JSON
.
stringify
(
enable
));
await
sleep
(
5000
);
var
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] getState On1 =
'
+
JSON
.
stringify
(
state
));
...
...
@@ -169,7 +143,6 @@ describe('bluetoothhostTest', function() {
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result3 =
'
+
JSON
.
stringify
(
data
))
expect
(
data
.
length
).
assertLarger
(
0
);
//bluetooth.BLE.stopBLEScan();
done
();
}
bluetooth
.
BLE
.
startBLEScan
([{}]);
...
...
@@ -656,5 +629,6 @@ describe('bluetoothhostTest', function() {
done
();
})
})
communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
浏览文件 @
5199f285
...
...
@@ -43,8 +43,6 @@ var MajorClass = {
describe
(
'
bluetoothhostTest
'
,
function
()
{
var
gattServer
=
null
;
var
gattClient
=
null
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll called
'
)
})
...
...
@@ -94,6 +92,7 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] ble turning off :
'
+
JSON
.
stringify
(
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_OFF
));
console
.
info
(
'
bluetooth enable done
'
);
done
();
})
/**
...
...
@@ -295,283 +294,6 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_DISCONNRCT_0001
* @tc.name testDisConnect
* @tc.desc Test DisConnect api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_disconnect
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] gatt disconnect start
'
);
let
ret
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt disconnect ret:
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] gatt disconnect end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_READ_CHARA_VALUE_0001
* @tc.name testReadCharacteristicValue
* @tc.desc Test ReadCharacteristicValue api by promise.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_readCharacteristicValue
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] readCharacteristicValue start
'
);
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
descriptors
[
0
]
=
descriptor
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
32
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
for
(
var
key
in
characteristic
){
console
.
info
(
'
[bluetooth_js] readCharValue:
'
+
characteristic
[
key
]);
}
gattClient
.
readCharacteristicValue
(
characteristic
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
console
.
info
(
'
[bluetooth_js] bluetooth BLECharacteristic is null
'
);
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] BLECharacteristic uuid is successfully
'
);
console
.
info
(
'
[bluetooth_js] readCharacValue data:
'
+
JSON
.
stringify
(
data
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
=>
{
console
.
error
(
`bluetooth readCharacteristicValue has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
});
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_READ_DESCRI_VALUE_0001
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by promise.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_readDescriptorValue
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] readDescriptorValue start
'
);
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
gattClient
.
readDescriptorValue
(
descriptor
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
console
.
info
(
'
[bluetooth_js] BLEDescriptor is null
'
);
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] BLEDescriptor uuid is successfully
'
);
console
.
info
(
'
[bluetooth_js] BLEDescriptor data:
'
+
JSON
.
stringify
(
object
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
=>
{
console
.
error
(
`bluetooth readDescriptorValue has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
});
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_WRITE_CHARACT_VALUE_0001
* @tc.name testWriteCharacteristicValue
* @tc.desc Test WriteCharacteristicValue api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_writeCharacteristicValue
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] writeCharacteristicValue start
'
);
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
descriptors
[
0
]
=
descriptor
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
32
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
for
(
var
key
in
characteristic
){
console
.
info
(
'
[bluetooth_js] writeCharValue:
'
+
characteristic
[
key
]);
}
let
ret
=
gattClient
.
writeCharacteristicValue
(
characteristic
);
console
.
info
(
'
[bluetooth_js] bluetooth writeCharacteristicValue ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] writeCharacteristicValue end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_WRITE_DESC_VALUE_0001
* @tc.name testWriteDescriptorValue
* @tc.desc Test WriteDescriptorValue api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_writeDescriptorValue
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] writeDescriptorValue start
'
);
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
let
ret
=
gattClient
.
writeDescriptorValue
(
descriptor
);
console
.
info
(
'
[bluetooth_js] bluetooth writeDescriptorValue ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] writeDescriptorValue end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_SET_BLE_MTUSIZE_0001
* @tc.name testSetBLEMtuSize
* @tc.desc Test SetBLEMtuSize api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_setBLEMtuSize
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] setBLEMtuSize start
'
);
let
ret
=
gattClient
.
setBLEMtuSize
(
128
);
console
.
info
(
'
[bluetooth_js] bluetooth setBLEMtuSize ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] setBLEMtuSize end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_SET_NOTIFY_CHARA_CHANGED_0001
* @tc.name testSetNotifyCharacteristicChanged
* @tc.desc Test SetNotifyCharacteristicChanged api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_setNotifyCharacteristicChanged
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] setNotifyCharacteristicChanged start
'
);
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
arrayBufferNotify
=
new
ArrayBuffer
(
8
);
let
descNotifyValue
=
new
Uint8Array
(
arrayBufferNotify
);
descNotifyValue
[
0
]
=
1
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
let
descriptorNotify
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00002902-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBufferNotify
};
descriptors
[
0
]
=
descriptor
;
descriptors
[
1
]
=
descriptorNotify
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
1
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
let
ret
=
gattClient
.
setNotifyCharacteristicChanged
(
characteristic
,
false
);
console
.
info
(
'
[bluetooth_js] setNotifyCharacteristicChanged ret:
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] setNotifyCharacteristicChanged end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_NOTIFY_CHARA_CHANGED_0001
* @tc.name testNotifyCharacteristicChanged
* @tc.desc Test NotifyCharacteristicChanged api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_notifyCharacteristicChanged
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] notifyCharacteristicChanged start
'
);
let
descriptors
=
[];
let
arrayBufferDesc
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBufferDesc
);
desValue
[
0
]
=
11
;
let
arrayBufferNotifyDesc
=
new
ArrayBuffer
(
8
);
let
descNotifyValue
=
new
Uint8Array
(
arrayBufferNotifyDesc
);
descNotifyValue
[
0
]
=
1
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
desValue
};
let
descriptorNotify
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00002902-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
descNotifyValue
};
descriptors
[
0
]
=
descriptor
;
descriptors
[
1
]
=
descriptorNotify
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
1
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
cccValue
,
descriptors
:
descriptors
,
confirm
:
'
false
'
};
for
(
var
key
in
characteristic
){
console
.
info
(
'
[bluetooth_js] notifyCharChanged:
'
+
characteristic
[
key
]);
}
let
ret
=
gattServer
.
notifyCharacteristicChanged
(
'
00:00:00:00:00:00
'
,
characteristic
);
console
.
info
(
'
[bluetooth_js] notifyCharacteristicChanged ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] notifyCharacteristicChanged end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_SEND_RESPONSE_0001
* @tc.name testSendResponse
* @tc.desc Test SendResponse api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_sendResponse
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] sendResponse start
'
);
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
value
=
new
Uint8Array
(
arrayBuffer
);
value
[
0
]
=
1
;
let
serverResponse
=
{
deviceId
:
'
00:00:00:00:00
'
,
transId
:
1
,
status
:
0
,
offset
:
0
,
value
:
arrayBuffer
};
for
(
var
key
in
serverResponse
){
console
.
info
(
'
[bluetooth_js] serverResponse:
'
+
serverResponse
[
key
]);
}
let
ret
=
gattServer
.
sendResponse
(
serverResponse
);
console
.
info
(
'
[bluetooth_js] sendResponse ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] sendResponse end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_SPP_LISTEN_0001
* @tc.name testSppListen
...
...
@@ -693,60 +415,6 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] spp write end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetoothble_DEVICE_JS_BLE_PERIPHERA_MANAGER_CLOSE_0001
* @tc.name testBlePeripheralManagerClose
* @tc.desc Test BlePeripheralManagerClose api .
* @tc.author zhangyujie zwx1079266
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetoothble_gattserver_close_test_001
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] GattserverClose test start ...
'
);
if
(
gattServer
==
null
)
{
console
.
info
(
"
[bluetooth_js] GattserverClose: please CreateGattServer first!
"
);
}
console
.
info
(
'
[bluetooth_js] gattclose_server is:
'
+
JSON
.
stringify
(
gattServer
));
try
{
var
result
=
gattServer
.
close
();
console
.
info
(
"
[bluetooth_js] GattserverClose res:
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertTrue
();
console
.
info
(
"
[bluetooth_js] GattserverClose end.
"
);
}
catch
(
error
){
console
.
info
(
"
[bluetooth_js] GattserverClose err:
"
+
JSON
.
stringify
(
error
));
expect
(
null
).
assertFail
();
}
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_CLIENT_CLOSE_0001
* @tc.name testGattClientClose
* @tc.desc Test GattClientClose api .
* @tc.author zhangyujie zwx1079266
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gattclient_close_test_001
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] GattclientClose test start ...
'
);
if
(
gattClient
==
null
)
{
console
.
info
(
"
[bluetooth_js] GattclientClose: please CreateGatt first!
"
);
}
console
.
info
(
'
[bluetooth_js] gattClient is:
'
+
JSON
.
stringify
(
gattServer
));
try
{
var
result
=
gattClient
.
close
();
console
.
info
(
"
[bluetooth_js] GattclientClose result:
"
+
result
);
console
.
info
(
"
[bluetooth_js] GattclientClose json_result:
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertTrue
();
console
.
info
(
"
[bluetooth_js] GattclientClose end.
"
);
}
catch
(
error
){
console
.
info
(
"
[bluetooth_js] GattclientClose err:
"
+
JSON
.
stringify
(
error
));
expect
(
null
).
assertFail
();
}
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_REMO_DEV_NAME_0001
* @tc.name testGetRemoteDeviceName
...
...
@@ -1161,7 +829,7 @@ describe('bluetoothhostTest', function() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_classic_set_local_name14
'
,
0
,
async
function
()
{
it
(
'
bluetooth_classic_set_local_name14
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] set localname start
'
);
var
name
=
bluetooth
.
setLocalName
(
'
0123456789012345678901234567890123456789012345678901
'
+
'
23456789012345678901234567890123456789012345678901234567890123456789012345678012
'
...
...
@@ -1175,7 +843,9 @@ describe('bluetoothhostTest', function() {
expect
(
disable
).
assertTrue
();
await
sleep
(
2000
);
console
.
info
(
'
[bluetooth_js] setLocalName end
'
);
done
();
})
})
communication/wifi_hotspot/src/main/js/default/pages/index/index.js
浏览文件 @
5199f285
...
...
@@ -37,6 +37,7 @@ export default {
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
this
.
timeout
=
15000
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
...
...
communication/wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js
浏览文件 @
5199f285
...
...
@@ -55,7 +55,7 @@ describe('ACTS_WifiTest', function() {
console
.
info
(
"
[wifi_test] enableHotspot and disableHotspot test start.
"
);
if
(
wifi
.
isWifiActive
())
{
var
disable
=
wifi
.
disableWifi
();
await
sleep
(
2
000
);
await
sleep
(
3
000
);
console
.
log
(
"
[wifi_test] wifi close result:
"
+
disable
);
expect
(
disable
).
assertTrue
();
}
...
...
@@ -64,7 +64,7 @@ describe('ACTS_WifiTest', function() {
expect
(
close
).
assertFalse
();
if
(
!
wifi
.
isHotspotActive
())
{
var
on
=
wifi
.
enableHotspot
();
await
sleep
(
3
000
);
await
sleep
(
5
000
);
console
.
info
(
"
[wifi_test] enableHotspot result ->
"
+
on
);
expect
(
on
).
assertTrue
();
}
...
...
@@ -80,12 +80,12 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test set a valid 2.4G hotspot config
* @tc.level Level 0
*/
it
(
'
SUB_Communication_WiFi_Hotspot_Config_0001
'
,
0
,
async
function
()
{
it
(
'
SUB_Communication_WiFi_Hotspot_Config_0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0001
"
);
console
.
info
(
"
[wifi_test] set a valid 2.4G hotspot config start.
"
);
if
(
wifi
.
isHotspotActive
())
{
var
off
=
wifi
.
disableHotspot
();
await
sleep
(
2
000
);
await
sleep
(
3
000
);
console
.
info
(
"
[wifi_test] disableHotspot result ->
"
+
off
);
expect
(
off
).
assertTrue
();
}
...
...
@@ -99,7 +99,7 @@ describe('ACTS_WifiTest', function() {
console
.
log
(
"
[wifi_test] getHotspotConfig result:
"
+
JSON
.
stringify
(
hotspotConfig
));
expect
(
hotspotConfig
.
band
).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0001 end
"
);
done
()
;
done
()
})
/**
...
...
@@ -131,7 +131,7 @@ describe('ACTS_WifiTest', function() {
var
hotspotConfig5
=
wifi
.
getHotspotConfig
();
console
.
log
(
"
[wifi_test] getHotspotConfig result:
"
+
JSON
.
stringify
(
hotspotConfig5
));
expect
(
hotspotConfig5
.
band
).
assertEqual
(
1
);
done
()
;
done
()
})
/**
...
...
@@ -293,6 +293,11 @@ describe('ACTS_WifiTest', function() {
var
isSuccess1
=
wifi
.
setHotspotConfig
(
HotspotConfigS1
);
console
.
log
(
"
[wifi_test] set 33bit ssid invalid hotspot config result:
"
+
isSuccess1
);
expect
(
isSuccess1
).
assertFalse
();
console
.
log
(
"
[wifi_test] check current hotspot config preSharedKey is 8bit
"
);
var
config
=
wifi
.
getHotspotConfig
();
console
.
info
(
"
[wifi_test] getHotspotConfig result ->
"
+
JSON
.
stringify
(
config
));
console
.
info
(
"
preSharedKey:
"
+
config
.
ssid
);
expect
(
config
.
ssid
.
length
).
assertEqual
(
32
);
done
();
})
...
...
@@ -333,7 +338,7 @@ describe('ACTS_WifiTest', function() {
it
(
'
SUB_Communication_WiFi_Hotspot_Config_0008
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] set contains Chinese valid hotspot config start.
"
);
var
HotspotConfigC
=
{
"
ssid
"
:
"
�?�?@12测试
"
,
"
ssid
"
:
"
测试123!@#¥%……&*(
"
,
"
band
"
:
1
,
"
preSharedKey
"
:
"
12345678
"
,
"
securityType
"
:
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
,
...
...
@@ -347,6 +352,11 @@ describe('ACTS_WifiTest', function() {
var
isHotspotActive
=
wifi
.
isHotspotActive
();
console
.
info
(
"
[wifi_test] isHotspotActive ->
"
+
isHotspotActive
);
expect
(
isHotspotActive
).
assertFalse
();
console
.
log
(
"
[wifi_test] check current hotspot config preSharedKey is 8bit
"
);
var
config
=
wifi
.
getHotspotConfig
();
console
.
info
(
"
[wifi_test] getHotspotConfig result ->
"
+
JSON
.
stringify
(
config
));
console
.
info
(
"
preSharedKey:
"
+
config
.
ssid
);
expect
(
true
).
assertEqual
(
config
.
ssid
==
HotspotConfigC
.
ssid
);
})
/**
...
...
@@ -427,6 +437,11 @@ describe('ACTS_WifiTest', function() {
var
isSuccess1
=
wifi
.
setHotspotConfig
(
HotspotConfigPSK
);
console
.
log
(
"
[wifi_test] set a PSK preSharedKey hotspot config result1:
"
+
isSuccess1
);
expect
(
isSuccess1
).
assertTrue
();
console
.
log
(
"
[wifi_test] check current hotspot config preSharedKey is 8bit
"
);
var
config
=
wifi
.
getHotspotConfig
();
console
.
info
(
"
[wifi_test] getHotspotConfig result ->
"
+
JSON
.
stringify
(
config
));
console
.
info
(
"
preSharedKey:
"
+
config
.
ssid
);
expect
(
config
.
preSharedKey
).
assertEqual
(
3
);
console
.
log
(
"
[wifi_test] check the state of Hotspot
"
);
var
isHotspotActive
=
wifi
.
isHotspotActive
();
console
.
info
(
"
[wifi_test] isHotspotActive ->
"
+
isHotspotActive
);
...
...
@@ -460,6 +475,11 @@ describe('ACTS_WifiTest', function() {
var
isSuccess1
=
wifi
.
setHotspotConfig
(
HotspotConfigO
);
console
.
log
(
"
[wifi_test] set a open preSharedKey hotspot config result1:
"
+
isSuccess1
);
expect
(
isSuccess1
).
assertTrue
();
console
.
log
(
"
[wifi_test] check current hotspot config preSharedKey is 8bit
"
);
var
config
=
wifi
.
getHotspotConfig
();
console
.
info
(
"
[wifi_test] getHotspotConfig result ->
"
+
JSON
.
stringify
(
config
));
console
.
info
(
"
preSharedKey:
"
+
config
.
ssid
);
expect
(
config
.
preSharedKey
).
assertEqual
(
1
);
done
();
})
...
...
@@ -535,14 +555,14 @@ describe('ACTS_WifiTest', function() {
console
.
info
(
"
[wifi_test] isHotspotActive ->
"
+
isHotspotActive
);
expect
(
isHotspotActive
).
assertTrue
();
console
.
info
(
"
[wifi_test] open Hotspot, set valid hotspot config start.
"
);
var
HotspotConfig
O
=
{
"
ssid
"
:
"
测试3@%&*
"
,
var
HotspotConfig
W
=
{
"
ssid
"
:
"
WIFI_TEST
"
,
"
band
"
:
1
,
"
preSharedKey
"
:
"
12345678
"
,
"
securityType
"
:
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
,
"
maxConn
"
:
8
}
var
isSuccess1
=
wifi
.
setHotspotConfig
(
HotspotConfig
O
);
var
isSuccess1
=
wifi
.
setHotspotConfig
(
HotspotConfig
W
);
console
.
log
(
"
[wifi_test] set a PSK preSharedKey hotspot config result1:
"
+
isSuccess1
);
expect
(
isSuccess1
).
assertTrue
();
console
.
info
(
"
[wifi_test] check the current config.
"
);
...
...
@@ -554,7 +574,7 @@ describe('ACTS_WifiTest', function() {
console
.
info
(
"
securityType:
"
+
config
.
securityType
);
console
.
info
(
"
maxConn:
"
+
config
.
maxConn
);
console
.
info
(
"
[wifi_test] check the current config is same with set before.
"
);
expect
(
config
.
ssid
).
assertEqual
(
'
测试3@%&*
'
);
expect
(
config
.
ssid
).
assertEqual
(
'
WIFI_TEST
'
);
expect
(
config
.
band
).
assertEqual
(
1
);
expect
(
config
.
preSharedKey
).
assertEqual
(
'
12345678
'
);
expect
(
config
.
securityType
).
assertEqual
(
3
);
...
...
@@ -588,6 +608,7 @@ describe('ACTS_WifiTest', function() {
console
.
info
(
"
ssid:
"
+
stationInfo
.
name
);
console
.
info
(
"
macAddress:
"
+
stationInfo
.
macAddress
);
console
.
info
(
"
ipAddress:
"
+
stationInfo
.
ipAddress
);
expect
(
stationInfo
.
length
).
assertEqual
();
done
();
})
...
...
@@ -727,3 +748,4 @@ describe('ACTS_WifiTest', function() {
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
})
communication/wifi_p2p/src/main/js/default/pages/index/index.js
浏览文件 @
5199f285
...
...
@@ -37,6 +37,7 @@ export default {
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
this
.
timeout
=
15000
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
...
...
communication/wifi_p2p/src/main/js/default/test/WifiP2P.test.js
浏览文件 @
5199f285
...
...
@@ -146,9 +146,10 @@ describe('ACTS_WifiTest', function () {
.
then
((
data
)
=>
{
console
.
info
(
"
[wifi_test] getCurrentGroup [promise] result ->
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
length
!=
0
);
expect
(
true
).
assertEqual
(
data
.
goBand
==
WifiP2PConfig2
.
goBand
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[wifi_js
]getCurrentGroup promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
).
assertFail
();
console
.
info
(
"
[wifi_test
]getCurrentGroup promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertFail
();
});
console
.
info
(
"
[wifi_test] test start removeGroup
"
);
var
removeConfig
=
wifi
.
removeGroup
();
...
...
@@ -190,6 +191,7 @@ describe('ACTS_WifiTest', function () {
.
then
((
data
)
=>
{
console
.
info
(
"
[wifi_test] getCurrentGroup [promise] result ->
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
length
!=
0
);
expect
(
true
).
assertEqual
(
data
.
goBand
==
WifiP2PConfig
.
goBand
);
console
.
info
(
"
[wifi_test] test start deletePersistentGroup
"
);
var
removePConfig
=
wifi
.
deletePersistentGroup
(
data
.
networkId
);
console
.
info
(
"
[wifi_test] test start deletePersistentGroup
"
+
removePConfig
);
...
...
@@ -299,7 +301,7 @@ describe('ACTS_WifiTest', function () {
* @tc.number config_0007
* @tc.name SUB_Communication_WiFi_P2P_Config_0007
* @tc.author wudangping wwx1075776
* @tc.desc Test getP2pDevices infos
* @tc.desc Test getP2p
Peer
Devices infos
*/
it
(
'
SUB_Communication_WiFi_P2P_Config_0007
'
,
0
,
async
function
(
done
)
{
var
P2pDeviceStatus
=
{
...
...
@@ -324,20 +326,20 @@ describe('ACTS_WifiTest', function () {
await
sleep
(
2000
);
console
.
info
(
"
[wifi_test] test startDiscoverDevices result.
"
+
scanConfig
);
expect
(
scanConfig
).
assertTrue
();
await
wifi
.
getP2pDevices
()
await
wifi
.
getP2p
Peer
Devices
()
.
then
((
data
)
=>
{
console
.
info
(
"
[wifi_test] getP2pDevices [promise] result ->
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[wifi_test] getP2p
Peer
Devices [promise] result ->
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
length
!=
0
);
}).
catch
((
error
)
=>
{
console
.
info
(
"
[wifi_test]getP2pDevices promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[wifi_test]getP2p
Peer
Devices promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
wifi
.
getP2pDevices
((
err
,
result
)
=>
{
wifi
.
getP2p
Peer
Devices
((
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
failed to getP2pDevices infos callback because
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
failed to getP2p
Peer
Devices infos callback because
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
"
[wifi_test] getP2pDevices [callback] ->
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[wifi_test] getP2p
Peer
Devices [callback] ->
"
+
JSON
.
stringify
(
result
));
var
len
=
Object
.
keys
(
result
).
length
;
for
(
var
j
=
0
;
j
<
len
;
++
j
)
{
console
.
info
(
"
deviceName:
"
+
result
[
j
].
deviceName
);
...
...
@@ -575,3 +577,4 @@ describe('ACTS_WifiTest', function () {
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
})
communication/wifi_standard/src/main/js/default/pages/index/index.js
浏览文件 @
5199f285
...
...
@@ -37,6 +37,7 @@ export default {
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
this
.
timeout
=
15000
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
...
...
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
浏览文件 @
5199f285
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录