Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1cf90995
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看板
提交
1cf90995
编写于
4月 26, 2023
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
9380d93e
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
738 addition
and
121 deletion
+738
-121
communication/bluetooth_ble/signature/openharmony_sx.p7b
communication/bluetooth_ble/signature/openharmony_sx.p7b
+0
-0
communication/bluetooth_ble/src/main/config.json
communication/bluetooth_ble/src/main/config.json
+10
-0
communication/bluetooth_manager/signature/openharmony_sx.p7b
communication/bluetooth_manager/signature/openharmony_sx.p7b
+0
-0
communication/bluetooth_manager/src/main/config.json
communication/bluetooth_manager/src/main/config.json
+10
-0
communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js
...bluetooth_manager/src/main/js/test/BleGattManager.test.js
+4
-4
communication/bluetooth_manager/src/main/js/test/BleScanResult.test.js
.../bluetooth_manager/src/main/js/test/BleScanResult.test.js
+29
-1
communication/bluetooth_manager/src/main/js/test/BleService.test.js
...ion/bluetooth_manager/src/main/js/test/BleService.test.js
+517
-70
communication/bluetooth_on/signature/openharmony_sx.p7b
communication/bluetooth_on/signature/openharmony_sx.p7b
+0
-0
communication/bluetooth_on/src/main/config.json
communication/bluetooth_on/src/main/config.json
+10
-0
communication/bluetooth_profile/signature/openharmony_sx.p7b
communication/bluetooth_profile/signature/openharmony_sx.p7b
+0
-0
communication/bluetooth_profile/src/main/config.json
communication/bluetooth_profile/src/main/config.json
+10
-0
communication/bluetooth_standard/signature/openharmony_sx.p7b
...unication/bluetooth_standard/signature/openharmony_sx.p7b
+0
-0
communication/bluetooth_standard/src/main/config.json
communication/bluetooth_standard/src/main/config.json
+10
-0
communication/bluetooth_standard/src/main/js/test/BRDiscovery.test.js
...n/bluetooth_standard/src/main/js/test/BRDiscovery.test.js
+34
-17
communication/bluetooth_standard/src/main/js/test/BRScanMode.test.js
...on/bluetooth_standard/src/main/js/test/BRScanMode.test.js
+4
-2
communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js
...tion/bluetooth_standard/src/main/js/test/BRSwitch.test.js
+33
-7
communication/bluetooth_standard/src/main/js/test/List.test.js
...nication/bluetooth_standard/src/main/js/test/List.test.js
+2
-2
communication/bluetooth_switchoff/signature/openharmony_sx.p7b
...nication/bluetooth_switchoff/signature/openharmony_sx.p7b
+0
-0
communication/bluetooth_switchoff/src/main/config.json
communication/bluetooth_switchoff/src/main/config.json
+10
-0
communication/bluetooth_switchoff/src/main/js/test/SwitchOff003.test.js
...bluetooth_switchoff/src/main/js/test/SwitchOff003.test.js
+36
-1
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
...olocation_standard/src/main/js/test/GeocoderMTest.test.js
+14
-11
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
...olocation_standard/src/main/js/test/LocationMTest.test.js
+5
-6
未找到文件。
communication/bluetooth_ble/signature/openharmony_sx.p7b
浏览文件 @
1cf90995
无法预览此类型文件
communication/bluetooth_ble/src/main/config.json
浏览文件 @
1cf90995
...
...
@@ -106,6 +106,16 @@
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
""
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.DISCOVER_BLUETOOTH"
,
"reason"
:
""
,
...
...
communication/bluetooth_manager/signature/openharmony_sx.p7b
浏览文件 @
1cf90995
无法预览此类型文件
communication/bluetooth_manager/src/main/config.json
浏览文件 @
1cf90995
...
...
@@ -120,6 +120,16 @@
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
""
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.LOCATION"
,
"reason"
:
""
,
...
...
communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js
浏览文件 @
1cf90995
...
...
@@ -217,18 +217,18 @@ describe('bluetoothBLETest', function() {
await
sleep
(
5000
)
try
{
await
gattClient
.
getDeviceName
().
then
((
data
)
=>
{
console
.
info
(
'
[bluetooth_js] device name
'
+
JSON
.
stringify
(
data
))
console
.
info
(
'
[bluetooth_js] device name
:
'
+
JSON
.
stringify
(
data
))
expect
(
data
).
assertNull
();
done
();
}).
catch
(
err
=>
{
console
.
error
(
'
bluetooth getDeviceName has error:
'
+
err
);
expect
(
true
).
assertFalse
();
console
.
error
(
'
[bluetooth_js] bluetooth getDeviceName has error:
'
+
JSON
.
stringify
(
err
)
);
expect
(
err
).
assertFalse
();
done
();
});
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]GetDeviceName_0100 failed, code is
${
error
.
code
}
,
message is
${
error
.
message
}
`
);
expect
(
true
).
assertFalse
();
expect
(
true
).
assertFalse
();
done
()
}
})
...
...
communication/bluetooth_manager/src/main/js/test/BleScanResult.test.js
浏览文件 @
1cf90995
...
...
@@ -16,6 +16,32 @@
import
bluetooth
from
'
@ohos.bluetoothManager
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
bundle
from
'
@ohos.bundle
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
async
function
applyPermission
()
{
let
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
info
(
"
=== getAccountManager finish
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
LocalId is :
"
+
localId
);
0
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.bluetooth.bluetoothhost
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName
=
'
ohos.permission.LOCATION
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permis
'
+
'
sion] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
err
));
});
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
export
default
function
bluetoothBLETest6
()
{
describe
(
'
bluetoothBLETest6
'
,
function
()
{
function
sleep
(
delay
)
{
...
...
@@ -48,8 +74,10 @@ describe('bluetoothBLETest6', function() {
console
.
info
(
'
[bluetooth_js] enable success
'
);
}
}
beforeAll
(
function
(
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll called
'
)
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach called
'
)
...
...
communication/bluetooth_manager/src/main/js/test/BleService.test.js
浏览文件 @
1cf90995
...
...
@@ -16,79 +16,9 @@
import
bluetooth
from
'
@ohos.bluetoothManager
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
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
};
let
SppOption
=
{
uuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
secure
:
true
,
type
:
bluetooth
.
SppType
.
SPP_RFCOMM
};
let
MajorMinorClass
=
{
COMPUTER_UNCATEGORIZED
:
0x0100
,
COMPUTER_DESKTOP
:
0x0104
,
COMPUTER_SERVER
:
0x0108
,
COMPUTER_LAPTOP
:
0x010C
,
COMPUTER_HANDHELD_PC_PDA
:
0x0110
,
COMPUTER_PALM_SIZE_PC_PDA
:
0x0114
,
COMPUTER_WEARABLE
:
0x0118
,
COMPUTER_TABLET
:
0x011C
,
PHONE_UNCATEGORIZED
:
0x0200
,
PHONE_CELLULAR
:
0x0204
,
PHONE_CORDLESS
:
0x0208
,
PHONE_SMART
:
0x020C
,
PHONE_MODEM_OR_GATEWAY
:
0x0210
,
PHONE_ISDN
:
0x0214
,
NETWORK_FULLY_AVAILABLE
:
0x0300
,
NETWORK_1_TO_17_UTILIZED
:
0x0320
,
NETWORK_17_TO_33_UTILIZED
:
0x0340
,
NETWORK_33_TO_50_UTILIZED
:
0x0360
,
NETWORK_60_TO_67_UTILIZED
:
0x0380
,
NETWORK_67_TO_83_UTILIZED
:
0x03A0
,
NETWORK_83_TO_99_UTILIZED
:
0x03C0
,
NETWORK_NO_SERVICE
:
0x03E0
,
AUDIO_VIDEO_UNCATEGORIZED
:
0x0400
,
AUDIO_VIDEO_WEARABLE_HEADSET
:
0x0404
,
AUDIO_VIDEO_HANDSFREE
:
0x0408
,
AUDIO_VIDEO_MICROPHONE
:
0x0410
,
AUDIO_VIDEO_LOUDSPEAKER
:
0x0414
,
AUDIO_VIDEO_HEADPHONES
:
0x0418
,
AUDIO_VIDEO_PORTABLE_AUDIO
:
0x041C
,
AUDIO_VIDEO_CAR_AUDIO
:
0x0420
,
AUDIO_VIDEO_SET_TOP_BOX
:
0x0424
,
AUDIO_VIDEO_HIFI_AUDIO
:
0x0428
,
AUDIO_VIDEO_VCR
:
0x042C
,
AUDIO_VIDEO_VIDEO_CAMERA
:
0x0430
,
AUDIO_VIDEO_CAMCORDER
:
0x0434
,
AUDIO_VIDEO_VIDEO_MONITOR
:
0x0438
,
AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER
:
0x043C
,
AUDIO_VIDEO_VIDEO_CONFERENCING
:
0x0440
,
AUDIO_VIDEO_VIDEO_GAMING_TOY
:
0x0448
,
PERIPHERAL_NON_KEYBOARD_NON_POINTING
:
0x0500
,
PERIPHERAL_KEYBOARD
:
0x0540
,
PERIPHERAL_POINTING_DEVICE
:
0x0580
,
PERIPHERAL_KEYBOARD_POINTING
:
0x05C0
,
PERIPHERAL_UNCATEGORIZED
:
0x0500
,
PERIPHERAL_JOYSTICK
:
0x0504
,
PERIPHERAL_GAMEPAD
:
0x0508
,
PERIPHERAL_REMOTE_CONTROL
:
0x05C0
,
PERIPHERAL_SENSING_DEVICE
:
0x0510
,
PERIPHERAL_DIGITIZER_TABLET
:
0x0514
,
PERIPHERAL_CARD_READER
:
0x0518
,
PERIPHERAL_DIGITAL_PEN
:
0x051C
,
PERIPHERAL_SCANNER_RFID
:
0x0520
,
PERIPHERAL_GESTURAL_INPUT
:
0x0522
,
IMAGING_UNCATEGORIZED
:
0x0600
,
IMAGING_DISPLAY
:
0x0610
,
IMAGING_CAMERA
:
0x0620
,
IMAGING_SCANNER
:
0x0640
,
IMAGING_PRINTER
:
0x0680
,
WEARABLE_UNCATEGORIZED
:
0x0700
,
WEARABLE_WRIST_WATCH
:
0x0704
,
WEARABLE_PAGER
:
0x0708
,
WEARABLE_JACKET
:
0x070C
,
WEARABLE_HELMET
:
0x0710
,
WEARABLE_GLASSES
:
0x0714
,
TOY_UNCATEGORIZED
:
0x0800
,
TOY_ROBOT
:
0x0804
,
TOY_VEHICLE
:
0x0808
,
TOY_DOLL_ACTION_FIGURE
:
0x080C
,
TOY_CONTROLLER
:
0x0810
,
TOY_GAME
:
0x0814
,
HEALTH_UNCATEGORIZED
:
0x0900
,
HEALTH_BLOOD_PRESSURE
:
0x0904
,
HEALTH_THERMOMETER
:
0x0908
,
HEALTH_WEIGHING
:
0x090C
,
HEALTH_GLUCOSE
:
0x0910
,
HEALTH_PULSE_OXIMETER
:
0x0914
,
HEALTH_PULSE_RATE
:
0x0918
,
HEALTH_DATA_DISPLAY
:
0x091C
,
HEALTH_STEP_COUNTER
:
0x0920
,
HEALTH_BODY_COMPOSITION_ANALYZER
:
0x0924
,
HEALTH_PEAK_FLOW_MOITOR
:
0x0928
,
HEALTH_MEDICATION_MONITOR
:
0x092C
,
HEALTH_KNEE_PROSTHESIS
:
0x0930
,
HEALTH_ANKLE_PROSTHESIS
:
0x0934
,
HEALTH_GENERIC_HEALTH_MANAGER
:
0x0938
,
HEALTH_PERSONAL_MOBILITY_DEVICE
:
0x093C
,
HEALTH_PERSONAL_MOBILITY_DEVICE
:
0x093C
,
HEALTH_PEAK_FLOW_MONITOR
:
0x0928
};
let
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
};
let
ProfileId
=
{
PROFILE_A2DP_SOURCE
:
1
,
PROFILE_HANDS_FREE_AUDIO_GATEWAY
:
4
,
PROFILE_HID_HOST
:
6
,
PROFILE_PAN_NETWORK
:
7
};
export
default
function
bluetoothBLETest1
()
{
describe
(
'
bluetoothBLETest1
'
,
function
()
{
...
...
@@ -1256,6 +1186,523 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0333
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0333
'
,
0
,
async
function
(
done
)
{
let
STATE_ON
=
bluetooth
.
BluetoothState
.
STATE_ON
;
console
.
info
(
"
[bluetooth_js]STATE_ON :
"
+
JSON
.
stringify
(
STATE_ON
));
expect
(
true
).
assertTrue
(
STATE_ON
==
2
);
let
STATE_OFF
=
bluetooth
.
BluetoothState
.
STATE_OFF
;
console
.
info
(
"
[bluetooth_js]STATE_OFF :
"
+
JSON
.
stringify
(
STATE_OFF
));
expect
(
true
).
assertTrue
(
STATE_OFF
==
0
);
let
STATE_TURNING_ON
=
bluetooth
.
BluetoothState
.
STATE_TURNING_ON
;
console
.
info
(
"
[bluetooth_js]STATE_TURNING_ON :
"
+
JSON
.
stringify
(
STATE_TURNING_ON
));
expect
(
true
).
assertTrue
(
STATE_TURNING_ON
==
1
);
let
STATE_TURNING_OFF
=
bluetooth
.
BluetoothState
.
STATE_TURNING_OFF
;
console
.
info
(
"
[bluetooth_js]STATE_TURNING_OFF :
"
+
JSON
.
stringify
(
STATE_TURNING_OFF
));
expect
(
true
).
assertTrue
(
STATE_TURNING_OFF
==
3
);
let
STATE_BLE_TURNING_ON
=
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_ON
;
console
.
info
(
"
[bluetooth_js]STATE_BLE_TURNING_ON :
"
+
JSON
.
stringify
(
STATE_BLE_TURNING_ON
));
expect
(
true
).
assertTrue
(
STATE_BLE_TURNING_ON
==
4
);
let
STATE_BLE_ON
=
bluetooth
.
BluetoothState
.
STATE_BLE_ON
;
console
.
info
(
"
[bluetooth_js]STATE_BLE_ON :
"
+
JSON
.
stringify
(
STATE_BLE_ON
));
expect
(
true
).
assertTrue
(
STATE_BLE_ON
==
5
);
let
STATE_BLE_TURNING_OFF
=
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_OFF
;
console
.
info
(
"
[bluetooth_js]STATE_BLE_TURNING_OFF :
"
+
JSON
.
stringify
(
STATE_BLE_TURNING_OFF
));
expect
(
true
).
assertTrue
(
STATE_BLE_TURNING_OFF
==
6
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0555
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0555
'
,
0
,
async
function
(
done
)
{
let
SCAN_MODE_NONE
=
bluetooth
.
ScanMode
.
SCAN_MODE_NONE
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_NONE :
"
+
JSON
.
stringify
(
SCAN_MODE_NONE
));
expect
(
true
).
assertTrue
(
SCAN_MODE_NONE
==
0
);
let
SCAN_MODE_CONNECTABLE
=
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_CONNECTABLE :
"
+
JSON
.
stringify
(
SCAN_MODE_CONNECTABLE
));
expect
(
true
).
assertTrue
(
SCAN_MODE_CONNECTABLE
==
1
);
let
SCAN_MODE_GENERAL_DISCOVERABLE
=
bluetooth
.
ScanMode
.
SCAN_MODE_GENERAL_DISCOVERABLE
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_GENERAL_DISCOVERABLE :
"
+
JSON
.
stringify
(
SCAN_MODE_GENERAL_DISCOVERABLE
));
expect
(
true
).
assertTrue
(
SCAN_MODE_GENERAL_DISCOVERABLE
==
2
);
let
SCAN_MODE_LIMITED_DISCOVERABLE
=
bluetooth
.
ScanMode
.
SCAN_MODE_LIMITED_DISCOVERABLE
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_LIMITED_DISCOVERABLE :
"
+
JSON
.
stringify
(
SCAN_MODE_LIMITED_DISCOVERABLE
));
expect
(
true
).
assertTrue
(
SCAN_MODE_NONE
==
3
);
let
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
=
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE :
"
+
JSON
.
stringify
(
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
));
expect
(
true
).
assertTrue
(
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
==
4
);
let
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
=
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE :
"
+
JSON
.
stringify
(
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
));
expect
(
true
).
assertTrue
(
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE
==
5
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0666
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0666
'
,
0
,
async
function
(
done
)
{
let
STATE_DISCONNECTED
=
bluetooth
.
ProfileConnectionState
.
STATE_DISCONNECTED
;
console
.
info
(
"
[bluetooth_js]STATE_DISCONNECTED :
"
+
JSON
.
stringify
(
STATE_DISCONNECTED
));
expect
(
true
).
assertTrue
(
STATE_DISCONNECTED
==
0
);
let
STATE_CONNECTING
=
bluetooth
.
ProfileConnectionState
.
STATE_CONNECTING
;
console
.
info
(
"
[bluetooth_js]STATE_CONNECTING :
"
+
JSON
.
stringify
(
STATE_CONNECTING
));
expect
(
true
).
assertTrue
(
STATE_CONNECTING
==
1
);
let
STATE_CONNECTED
=
bluetooth
.
ProfileConnectionState
.
STATE_CONNECTED
;
console
.
info
(
"
[bluetooth_js]STATE_CONNECTED :
"
+
JSON
.
stringify
(
STATE_CONNECTED
));
expect
(
true
).
assertTrue
(
STATE_CONNECTED
==
2
);
let
STATE_DISCONNECTING
=
bluetooth
.
ProfileConnectionState
.
STATE_DISCONNECTING
;
console
.
info
(
"
[bluetooth_js]STATE_DISCONNECTING :
"
+
JSON
.
stringify
(
STATE_DISCONNECTING
));
expect
(
true
).
assertTrue
(
STATE_DISCONNECTING
==
3
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0777
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0777
'
,
0
,
async
function
(
done
)
{
let
SCAN_MODE_LOW_POWER
=
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_POWER
;
console
.
info
(
"
[bluetooth_js]STATE_DISCONNECTED :
"
+
JSON
.
stringify
(
SCAN_MODE_LOW_POWER
));
expect
(
true
).
assertTrue
(
SCAN_MODE_LOW_POWER
==
0
);
let
SCAN_MODE_BALANCED
=
bluetooth
.
ScanDuty
.
SCAN_MODE_BALANCED
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_BALANCED :
"
+
JSON
.
stringify
(
SCAN_MODE_BALANCED
));
expect
(
true
).
assertTrue
(
SCAN_MODE_BALANCED
==
1
);
let
SCAN_MODE_LOW_LATENCY
=
bluetooth
.
ScanDuty
.
SCAN_MODE_LOW_LATENCY
;
console
.
info
(
"
[bluetooth_js]SCAN_MODE_LOW_LATENCY :
"
+
JSON
.
stringify
(
SCAN_MODE_LOW_LATENCY
));
expect
(
true
).
assertTrue
(
SCAN_MODE_LOW_LATENCY
==
2
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0888
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0888
'
,
0
,
async
function
(
done
)
{
let
PROFILE_A2DP_SOURCE
=
bluetooth
.
ProfileId
.
PROFILE_A2DP_SOURCE
;
console
.
info
(
"
[bluetooth_js]PROFILE_A2DP_SOURCE :
"
+
JSON
.
stringify
(
PROFILE_A2DP_SOURCE
));
expect
(
true
).
assertTrue
(
PROFILE_A2DP_SOURCE
==
1
);
let
PROFILE_HANDS_FREE_AUDIO_GATEWAY
=
bluetooth
.
ProfileId
.
PROFILE_HANDS_FREE_AUDIO_GATEWAY
;
console
.
info
(
"
[bluetooth_js]PROFILE_HANDS_FREE_AUDIO_GATEWAY :
"
+
JSON
.
stringify
(
PROFILE_HANDS_FREE_AUDIO_GATEWAY
));
expect
(
true
).
assertTrue
(
PROFILE_HANDS_FREE_AUDIO_GATEWAY
==
4
);
let
PROFILE_HID_HOST
=
bluetooth
.
ProfileId
.
PROFILE_HID_HOST
;
console
.
info
(
"
[bluetooth_js]PROFILE_HID_HOST :
"
+
JSON
.
stringify
(
PROFILE_HID_HOST
));
expect
(
true
).
assertTrue
(
PROFILE_HID_HOST
==
6
);
let
PROFILE_PAN_NETWORK
=
bluetooth
.
ProfileId
.
PROFILE_PAN_NETWORK
;
console
.
info
(
"
[bluetooth_js]PROFILE_PAN_NETWORK :
"
+
JSON
.
stringify
(
PROFILE_PAN_NETWORK
));
expect
(
true
).
assertTrue
(
PROFILE_PAN_NETWORK
==
7
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0999
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0999
'
,
0
,
async
function
(
done
)
{
let
STATE_NOT_PLAYING
=
bluetooth
.
PlayingState
.
STATE_NOT_PLAYING
;
console
.
info
(
"
[bluetooth_js]STATE_NOT_PLAYING :
"
+
JSON
.
stringify
(
STATE_NOT_PLAYING
));
expect
(
true
).
assertTrue
(
STATE_NOT_PLAYING
==
0x0000
);
let
STATE_PLAYING
=
bluetooth
.
PlayingState
.
STATE_PLAYING
;
console
.
info
(
"
[bluetooth_js]STATE_PLAYING :
"
+
JSON
.
stringify
(
STATE_PLAYING
));
expect
(
true
).
assertTrue
(
STATE_PLAYING
==
0x0001
);
let
SPP_RFCOMM
=
bluetooth
.
SppType
.
SPP_RFCOMM
;
console
.
info
(
"
[bluetooth_js]SPP_RFCOMM :
"
+
JSON
.
stringify
(
SPP_RFCOMM
));
expect
(
true
).
assertTrue
(
SPP_RFCOMM
==
0
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_1111
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_1111
'
,
0
,
async
function
(
done
)
{
let
MAJOR_MISC
=
bluetooth
.
MajorClass
.
MAJOR_MISC
;
console
.
info
(
"
[bluetooth_js]MAJOR_MISC :
"
+
JSON
.
stringify
(
MAJOR_MISC
));
expect
(
true
).
assertTrue
(
MAJOR_MISC
==
0x0000
);
let
MAJOR_COMPUTER
=
bluetooth
.
MajorClass
.
MAJOR_COMPUTER
;
console
.
info
(
"
[bluetooth_js]MAJOR_COMPUTER :
"
+
JSON
.
stringify
(
MAJOR_COMPUTER
));
expect
(
true
).
assertTrue
(
MAJOR_COMPUTER
==
0x0100
);
let
MAJOR_PHONE
=
bluetooth
.
MajorClass
.
MAJOR_PHONE
;
console
.
info
(
"
[bluetooth_js]MAJOR_PHONE :
"
+
JSON
.
stringify
(
MAJOR_PHONE
));
expect
(
true
).
assertTrue
(
MAJOR_PHONE
==
0x0200
);
let
MAJOR_NETWORKING
=
bluetooth
.
MajorClass
.
MAJOR_NETWORKING
;
console
.
info
(
"
[bluetooth_js]MAJOR_NETWORKING :
"
+
JSON
.
stringify
(
MAJOR_NETWORKING
));
expect
(
true
).
assertTrue
(
MAJOR_NETWORKING
==
0x0300
);
let
MAJOR_AUDIO_VIDEO
=
bluetooth
.
MajorClass
.
MAJOR_AUDIO_VIDEO
;
console
.
info
(
"
[bluetooth_js]MAJOR_AUDIO_VIDEO :
"
+
JSON
.
stringify
(
MAJOR_AUDIO_VIDEO
));
expect
(
true
).
assertTrue
(
MAJOR_AUDIO_VIDEO
==
0x0400
);
let
MAJOR_PERIPHERAL
=
bluetooth
.
MajorClass
.
MAJOR_PERIPHERAL
;
console
.
info
(
"
[bluetooth_js]MAJOR_PERIPHERAL :
"
+
JSON
.
stringify
(
MAJOR_PERIPHERAL
));
expect
(
true
).
assertTrue
(
MAJOR_PERIPHERAL
==
0x0500
);
let
MAJOR_IMAGING
=
bluetooth
.
MajorClass
.
MAJOR_IMAGING
;
console
.
info
(
"
[bluetooth_js]MAJOR_IMAGING :
"
+
JSON
.
stringify
(
MAJOR_IMAGING
));
expect
(
true
).
assertTrue
(
MAJOR_IMAGING
==
0x0600
);
let
MAJOR_WEARABLE
=
bluetooth
.
MajorClass
.
MAJOR_WEARABLE
;
console
.
info
(
"
[bluetooth_js]MAJOR_WEARABLE :
"
+
JSON
.
stringify
(
MAJOR_WEARABLE
));
expect
(
true
).
assertTrue
(
MAJOR_WEARABLE
==
0x0700
);
let
MAJOR_TOY
=
bluetooth
.
MajorClass
.
MAJOR_TOY
;
console
.
info
(
"
[bluetooth_js]MAJOR_TOY :
"
+
JSON
.
stringify
(
MAJOR_TOY
));
expect
(
true
).
assertTrue
(
MAJOR_TOY
==
0x0800
);
let
MAJOR_HEALTH
=
bluetooth
.
MajorClass
.
MAJOR_HEALTH
;
console
.
info
(
"
[bluetooth_js]MAJOR_HEALTH :
"
+
JSON
.
stringify
(
MAJOR_HEALTH
));
expect
(
true
).
assertTrue
(
MAJOR_HEALTH
==
0x0900
);
let
MAJOR_UNCATEGORIZED
=
bluetooth
.
MajorClass
.
MAJOR_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]MAJOR_UNCATEGORIZED :
"
+
JSON
.
stringify
(
MAJOR_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
MAJOR_UNCATEGORIZED
==
0x1F00
);
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_1112
* @tc.name testSendResponse success
* @tc.desc Test SendResponse 401 -error parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_1112
'
,
0
,
async
function
(
done
)
{
let
COMPUTER_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
COMPUTER_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]COMPUTER_UNCATEGORIZED :
"
+
JSON
.
stringify
(
COMPUTER_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
COMPUTER_UNCATEGORIZED
==
0x0100
);
let
COMPUTER_DESKTOP
=
bluetooth
.
MajorMinorClass
.
COMPUTER_DESKTOP
;
console
.
info
(
"
[bluetooth_js]COMPUTER_DESKTOP :
"
+
JSON
.
stringify
(
COMPUTER_DESKTOP
));
expect
(
true
).
assertTrue
(
COMPUTER_DESKTOP
==
0x0104
);
let
COMPUTER_SERVER
=
bluetooth
.
MajorMinorClass
.
COMPUTER_SERVER
;
console
.
info
(
"
[bluetooth_js]COMPUTER_SERVER :
"
+
JSON
.
stringify
(
COMPUTER_SERVER
));
expect
(
true
).
assertTrue
(
COMPUTER_SERVER
==
0x0108
);
let
COMPUTER_LAPTOP
=
bluetooth
.
MajorMinorClass
.
COMPUTER_LAPTOP
;
console
.
info
(
"
[bluetooth_js]COMPUTER_LAPTOP :
"
+
JSON
.
stringify
(
COMPUTER_LAPTOP
));
expect
(
true
).
assertTrue
(
COMPUTER_LAPTOP
==
0x010C
);
let
COMPUTER_HANDHELD_PC_PDA
=
bluetooth
.
MajorMinorClass
.
COMPUTER_HANDHELD_PC_PDA
;
console
.
info
(
"
[bluetooth_js]COMPUTER_HANDHELD_PC_PDA :
"
+
JSON
.
stringify
(
COMPUTER_HANDHELD_PC_PDA
));
expect
(
true
).
assertTrue
(
COMPUTER_HANDHELD_PC_PDA
==
0x0110
);
let
COMPUTER_PALM_SIZE_PC_PDA
=
bluetooth
.
MajorMinorClass
.
COMPUTER_PALM_SIZE_PC_PDA
;
console
.
info
(
"
[bluetooth_js]COMPUTER_PALM_SIZE_PC_PDA :
"
+
JSON
.
stringify
(
COMPUTER_PALM_SIZE_PC_PDA
));
expect
(
true
).
assertTrue
(
COMPUTER_PALM_SIZE_PC_PDA
==
0x0114
);
let
COMPUTER_WEARABLE
=
bluetooth
.
MajorMinorClass
.
COMPUTER_WEARABLE
;
console
.
info
(
"
[bluetooth_js]COMPUTER_WEARABLE :
"
+
JSON
.
stringify
(
COMPUTER_WEARABLE
));
expect
(
true
).
assertTrue
(
COMPUTER_WEARABLE
==
0x0118
);
let
COMPUTER_TABLET
=
bluetooth
.
MajorMinorClass
.
COMPUTER_TABLET
;
console
.
info
(
"
[bluetooth_js]COMPUTER_TABLET :
"
+
JSON
.
stringify
(
COMPUTER_TABLET
));
expect
(
true
).
assertTrue
(
COMPUTER_TABLET
==
0x011C
);
let
PHONE_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
PHONE_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]PHONE_UNCATEGORIZED :
"
+
JSON
.
stringify
(
PHONE_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
PHONE_UNCATEGORIZED
==
0x0200
);
let
PHONE_CELLULAR
=
bluetooth
.
MajorMinorClass
.
PHONE_CELLULAR
;
console
.
info
(
"
[bluetooth_js]PHONE_CELLULAR :
"
+
JSON
.
stringify
(
PHONE_CELLULAR
));
expect
(
true
).
assertTrue
(
PHONE_CELLULAR
==
0x0204
);
let
PHONE_CORDLESS
=
bluetooth
.
MajorMinorClass
.
PHONE_CORDLESS
;
console
.
info
(
"
[bluetooth_js]PHONE_CORDLESS :
"
+
JSON
.
stringify
(
PHONE_CORDLESS
));
expect
(
true
).
assertTrue
(
PHONE_CORDLESS
==
0x0208
);
let
PHONE_SMART
=
bluetooth
.
MajorMinorClass
.
PHONE_SMART
;
console
.
info
(
"
[bluetooth_js]PHONE_SMART :
"
+
JSON
.
stringify
(
PHONE_SMART
));
expect
(
true
).
assertTrue
(
PHONE_SMART
==
0x020C
);
let
PHONE_MODEM_OR_GATEWAY
=
bluetooth
.
MajorMinorClass
.
PHONE_MODEM_OR_GATEWAY
;
console
.
info
(
"
[bluetooth_js]PHONE_MODEM_OR_GATEWAY :
"
+
JSON
.
stringify
(
PHONE_MODEM_OR_GATEWAY
));
expect
(
true
).
assertTrue
(
PHONE_MODEM_OR_GATEWAY
==
0x0210
);
let
PHONE_ISDN
=
bluetooth
.
MajorMinorClass
.
PHONE_ISDN
;
console
.
info
(
"
[bluetooth_js]PHONE_ISDN :
"
+
JSON
.
stringify
(
PHONE_ISDN
));
expect
(
true
).
assertTrue
(
PHONE_ISDN
==
0x0214
);
let
NETWORK_FULLY_AVAILABLE
=
bluetooth
.
MajorMinorClass
.
NETWORK_FULLY_AVAILABLE
;
console
.
info
(
"
[bluetooth_js]NETWORK_FULLY_AVAILABLE :
"
+
JSON
.
stringify
(
NETWORK_FULLY_AVAILABLE
));
expect
(
true
).
assertTrue
(
NETWORK_FULLY_AVAILABLE
==
0x0300
);
let
NETWORK_1_TO_17_UTILIZED
=
bluetooth
.
MajorMinorClass
.
NETWORK_1_TO_17_UTILIZED
;
console
.
info
(
"
[bluetooth_js]NETWORK_1_TO_17_UTILIZED :
"
+
JSON
.
stringify
(
NETWORK_1_TO_17_UTILIZED
));
expect
(
true
).
assertTrue
(
NETWORK_1_TO_17_UTILIZED
==
0x0320
);
let
NETWORK_17_TO_33_UTILIZED
=
bluetooth
.
MajorMinorClass
.
NETWORK_17_TO_33_UTILIZED
;
console
.
info
(
"
[bluetooth_js]NETWORK_17_TO_33_UTILIZED :
"
+
JSON
.
stringify
(
NETWORK_17_TO_33_UTILIZED
));
expect
(
true
).
assertTrue
(
NETWORK_17_TO_33_UTILIZED
==
0x0340
);
let
NETWORK_33_TO_50_UTILIZED
=
bluetooth
.
MajorMinorClass
.
NETWORK_33_TO_50_UTILIZED
;
console
.
info
(
"
[bluetooth_js]NETWORK_33_TO_50_UTILIZED :
"
+
JSON
.
stringify
(
NETWORK_33_TO_50_UTILIZED
));
expect
(
true
).
assertTrue
(
NETWORK_33_TO_50_UTILIZED
==
0x0360
);
let
NETWORK_60_TO_67_UTILIZED
=
bluetooth
.
MajorMinorClass
.
NETWORK_60_TO_67_UTILIZED
;
console
.
info
(
"
[bluetooth_js]NETWORK_60_TO_67_UTILIZED :
"
+
JSON
.
stringify
(
NETWORK_60_TO_67_UTILIZED
));
expect
(
true
).
assertTrue
(
NETWORK_60_TO_67_UTILIZED
==
0x0380
);
let
NETWORK_67_TO_83_UTILIZED
=
bluetooth
.
MajorMinorClass
.
NETWORK_67_TO_83_UTILIZED
;
console
.
info
(
"
[bluetooth_js]NETWORK_67_TO_83_UTILIZED :
"
+
JSON
.
stringify
(
NETWORK_67_TO_83_UTILIZED
));
expect
(
true
).
assertTrue
(
NETWORK_67_TO_83_UTILIZED
==
0x03A0
);
let
NETWORK_83_TO_99_UTILIZED
=
bluetooth
.
MajorMinorClass
.
NETWORK_83_TO_99_UTILIZED
;
console
.
info
(
"
[bluetooth_js]NETWORK_83_TO_99_UTILIZED :
"
+
JSON
.
stringify
(
NETWORK_83_TO_99_UTILIZED
));
expect
(
true
).
assertTrue
(
NETWORK_83_TO_99_UTILIZED
==
0x03C0
);
let
NETWORK_NO_SERVICE
=
bluetooth
.
MajorMinorClass
.
NETWORK_NO_SERVICE
;
console
.
info
(
"
[bluetooth_js]NETWORK_NO_SERVICE :
"
+
JSON
.
stringify
(
NETWORK_NO_SERVICE
));
expect
(
true
).
assertTrue
(
NETWORK_NO_SERVICE
==
0x03E0
);
let
AUDIO_VIDEO_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_UNCATEGORIZED :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_UNCATEGORIZED
==
0x0400
);
let
AUDIO_VIDEO_WEARABLE_HEADSET
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_WEARABLE_HEADSET
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_WEARABLE_HEADSET :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_WEARABLE_HEADSET
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_WEARABLE_HEADSET
==
0x0404
);
let
AUDIO_VIDEO_HANDSFREE
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_HANDSFREE
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_HANDSFREE :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_HANDSFREE
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_HANDSFREE
==
0x0408
);
let
AUDIO_VIDEO_MICROPHONE
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_MICROPHONE
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_MICROPHONE :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_MICROPHONE
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_MICROPHONE
==
0x0410
);
let
AUDIO_VIDEO_LOUDSPEAKER
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_LOUDSPEAKER
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_LOUDSPEAKER :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_LOUDSPEAKER
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_LOUDSPEAKER
==
0x0414
);
let
AUDIO_VIDEO_HEADPHONES
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_HEADPHONES
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_HEADPHONES :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_HEADPHONES
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_HEADPHONES
==
0x0418
);
let
AUDIO_VIDEO_PORTABLE_AUDIO
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_PORTABLE_AUDIO
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_PORTABLE_AUDIO :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_PORTABLE_AUDIO
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_PORTABLE_AUDIO
==
0x041C
);
let
AUDIO_VIDEO_CAR_AUDIO
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_CAR_AUDIO
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_CAR_AUDIO :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_CAR_AUDIO
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_CAR_AUDIO
==
0x0420
);
let
AUDIO_VIDEO_SET_TOP_BOX
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_SET_TOP_BOX
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_SET_TOP_BOX :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_SET_TOP_BOX
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_SET_TOP_BOX
==
0x0424
);
let
AUDIO_VIDEO_HIFI_AUDIO
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_HIFI_AUDIO
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_HIFI_AUDIO :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_HIFI_AUDIO
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_HIFI_AUDIO
==
0x0428
);
let
AUDIO_VIDEO_VCR
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_VCR
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_VCR :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_VCR
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_VCR
==
0x042C
);
let
AUDIO_VIDEO_VIDEO_CAMERA
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_VIDEO_CAMERA
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_VIDEO_CAMERA :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_VIDEO_CAMERA
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_VIDEO_CAMERA
==
0x0430
);
let
AUDIO_VIDEO_CAMCORDER
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_CAMCORDER
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_CAMCORDER :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_CAMCORDER
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_CAMCORDER
==
0x0434
);
let
AUDIO_VIDEO_VIDEO_MONITOR
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_VIDEO_MONITOR
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_VIDEO_MONITOR :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_VIDEO_MONITOR
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_VIDEO_MONITOR
==
0x0438
);
let
AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER
==
0x043C
);
let
AUDIO_VIDEO_VIDEO_CONFERENCING
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_VIDEO_CONFERENCING
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_VIDEO_CONFERENCING :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_VIDEO_CONFERENCING
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_VIDEO_CONFERENCING
==
0x0440
);
let
AUDIO_VIDEO_VIDEO_GAMING_TOY
=
bluetooth
.
MajorMinorClass
.
AUDIO_VIDEO_VIDEO_GAMING_TOY
;
console
.
info
(
"
[bluetooth_js]AUDIO_VIDEO_VIDEO_GAMING_TOY :
"
+
JSON
.
stringify
(
AUDIO_VIDEO_VIDEO_GAMING_TOY
));
expect
(
true
).
assertTrue
(
AUDIO_VIDEO_VIDEO_GAMING_TOY
==
0x0448
);
let
PERIPHERAL_NON_KEYBOARD_NON_POINTING
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_NON_KEYBOARD_NON_POINTING
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_NON_KEYBOARD_NON_POINTING :
"
+
JSON
.
stringify
(
PERIPHERAL_NON_KEYBOARD_NON_POINTING
));
expect
(
true
).
assertTrue
(
PERIPHERAL_NON_KEYBOARD_NON_POINTING
==
0x0500
);
let
PERIPHERAL_KEYBOARD
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_KEYBOARD
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_KEYBOARD :
"
+
JSON
.
stringify
(
PERIPHERAL_KEYBOARD
));
expect
(
true
).
assertTrue
(
PERIPHERAL_KEYBOARD
==
0x0540
);
let
PERIPHERAL_POINTING_DEVICE
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_POINTING_DEVICE
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_POINTING_DEVICE :
"
+
JSON
.
stringify
(
PERIPHERAL_POINTING_DEVICE
));
expect
(
true
).
assertTrue
(
PERIPHERAL_POINTING_DEVICE
==
0x0580
);
let
PERIPHERAL_KEYBOARD_POINTING
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_KEYBOARD_POINTING
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_KEYBOARD_POINTING :
"
+
JSON
.
stringify
(
PERIPHERAL_KEYBOARD_POINTING
));
expect
(
true
).
assertTrue
(
PERIPHERAL_KEYBOARD_POINTING
==
0x05C0
);
let
PERIPHERAL_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_UNCATEGORIZED :
"
+
JSON
.
stringify
(
PERIPHERAL_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
PERIPHERAL_UNCATEGORIZED
==
0x0500
);
let
PERIPHERAL_JOYSTICK
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_JOYSTICK
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_JOYSTICK :
"
+
JSON
.
stringify
(
PERIPHERAL_JOYSTICK
));
expect
(
true
).
assertTrue
(
PERIPHERAL_JOYSTICK
==
0x0504
);
let
PERIPHERAL_GAMEPAD
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_GAMEPAD
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_GAMEPAD :
"
+
JSON
.
stringify
(
PERIPHERAL_GAMEPAD
));
expect
(
true
).
assertTrue
(
PERIPHERAL_GAMEPAD
==
0x0508
);
let
PERIPHERAL_REMOTE_CONTROL
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_REMOTE_CONTROL
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_REMOTE_CONTROL :
"
+
JSON
.
stringify
(
PERIPHERAL_REMOTE_CONTROL
));
expect
(
true
).
assertTrue
(
PERIPHERAL_REMOTE_CONTROL
==
0x05C0
);
let
PERIPHERAL_SENSING_DEVICE
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_SENSING_DEVICE
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_SENSING_DEVICE :
"
+
JSON
.
stringify
(
PERIPHERAL_SENSING_DEVICE
));
expect
(
true
).
assertTrue
(
PERIPHERAL_SENSING_DEVICE
==
0x0510
);
let
PERIPHERAL_DIGITIZER_TABLET
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_DIGITIZER_TABLET
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_DIGITIZER_TABLET :
"
+
JSON
.
stringify
(
PERIPHERAL_DIGITIZER_TABLET
));
expect
(
true
).
assertTrue
(
PERIPHERAL_DIGITIZER_TABLET
==
0x0514
);
let
PERIPHERAL_CARD_READER
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_CARD_READER
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_CARD_READER :
"
+
JSON
.
stringify
(
PERIPHERAL_CARD_READER
));
expect
(
true
).
assertTrue
(
PERIPHERAL_CARD_READER
==
0x0518
);
let
PERIPHERAL_DIGITAL_PEN
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_DIGITAL_PEN
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_DIGITAL_PEN :
"
+
JSON
.
stringify
(
PERIPHERAL_DIGITAL_PEN
));
expect
(
true
).
assertTrue
(
PERIPHERAL_DIGITAL_PEN
==
0x051C
);
let
PERIPHERAL_SCANNER_RFID
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_SCANNER_RFID
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_SCANNER_RFID :
"
+
JSON
.
stringify
(
PERIPHERAL_SCANNER_RFID
));
expect
(
true
).
assertTrue
(
PERIPHERAL_SCANNER_RFID
==
0x0520
);
let
PERIPHERAL_GESTURAL_INPUT
=
bluetooth
.
MajorMinorClass
.
PERIPHERAL_GESTURAL_INPUT
;
console
.
info
(
"
[bluetooth_js]PERIPHERAL_GESTURAL_INPUT :
"
+
JSON
.
stringify
(
PERIPHERAL_GESTURAL_INPUT
));
expect
(
true
).
assertTrue
(
PERIPHERAL_GESTURAL_INPUT
==
0x0522
);
let
IMAGING_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
IMAGING_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]IMAGING_UNCATEGORIZED :
"
+
JSON
.
stringify
(
IMAGING_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
IMAGING_UNCATEGORIZED
==
0x0600
);
let
IMAGING_DISPLAY
=
bluetooth
.
MajorMinorClass
.
IMAGING_DISPLAY
;
console
.
info
(
"
[bluetooth_js]IMAGING_DISPLAY :
"
+
JSON
.
stringify
(
IMAGING_DISPLAY
));
expect
(
true
).
assertTrue
(
IMAGING_DISPLAY
==
0x0610
);
let
IMAGING_CAMERA
=
bluetooth
.
MajorMinorClass
.
IMAGING_CAMERA
;
console
.
info
(
"
[bluetooth_js]IMAGING_CAMERA :
"
+
JSON
.
stringify
(
IMAGING_CAMERA
));
expect
(
true
).
assertTrue
(
IMAGING_CAMERA
==
0x0620
);
let
IMAGING_SCANNER
=
bluetooth
.
MajorMinorClass
.
IMAGING_SCANNER
;
console
.
info
(
"
[bluetooth_js]IMAGING_SCANNER :
"
+
JSON
.
stringify
(
IMAGING_SCANNER
));
expect
(
true
).
assertTrue
(
IMAGING_SCANNER
==
0x0640
);
let
IMAGING_PRINTER
=
bluetooth
.
MajorMinorClass
.
IMAGING_PRINTER
;
console
.
info
(
"
[bluetooth_js]IMAGING_PRINTER :
"
+
JSON
.
stringify
(
IMAGING_PRINTER
));
expect
(
true
).
assertTrue
(
IMAGING_PRINTER
==
0x0680
);
let
WEARABLE_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
WEARABLE_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]WEARABLE_UNCATEGORIZED :
"
+
JSON
.
stringify
(
WEARABLE_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
WEARABLE_UNCATEGORIZED
==
0x0700
);
let
WEARABLE_WRIST_WATCH
=
bluetooth
.
MajorMinorClass
.
WEARABLE_WRIST_WATCH
;
console
.
info
(
"
[bluetooth_js]WEARABLE_WRIST_WATCH :
"
+
JSON
.
stringify
(
WEARABLE_WRIST_WATCH
));
expect
(
true
).
assertTrue
(
WEARABLE_WRIST_WATCH
==
0x0704
);
let
WEARABLE_PAGER
=
bluetooth
.
MajorMinorClass
.
WEARABLE_PAGER
;
console
.
info
(
"
[bluetooth_js]WEARABLE_PAGER :
"
+
JSON
.
stringify
(
WEARABLE_PAGER
));
expect
(
true
).
assertTrue
(
WEARABLE_PAGER
==
0x0708
);
let
WEARABLE_JACKET
=
bluetooth
.
MajorMinorClass
.
WEARABLE_JACKET
;
console
.
info
(
"
[bluetooth_js]WEARABLE_JACKET :
"
+
JSON
.
stringify
(
WEARABLE_JACKET
));
expect
(
true
).
assertTrue
(
WEARABLE_JACKET
==
0x070C
);
let
WEARABLE_HELMET
=
bluetooth
.
MajorMinorClass
.
WEARABLE_HELMET
;
console
.
info
(
"
[bluetooth_js]WEARABLE_HELMET :
"
+
JSON
.
stringify
(
WEARABLE_HELMET
));
expect
(
true
).
assertTrue
(
WEARABLE_HELMET
==
0x0710
);
let
WEARABLE_GLASSES
=
bluetooth
.
MajorMinorClass
.
WEARABLE_GLASSES
;
console
.
info
(
"
[bluetooth_js]WEARABLE_GLASSES :
"
+
JSON
.
stringify
(
WEARABLE_GLASSES
));
expect
(
true
).
assertTrue
(
WEARABLE_GLASSES
==
0x0714
);
let
TOY_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
TOY_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]TOY_UNCATEGORIZED :
"
+
JSON
.
stringify
(
TOY_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
TOY_UNCATEGORIZED
==
0x0800
);
let
TOY_ROBOT
=
bluetooth
.
MajorMinorClass
.
TOY_ROBOT
;
console
.
info
(
"
[bluetooth_js]TOY_ROBOT :
"
+
JSON
.
stringify
(
TOY_ROBOT
));
expect
(
true
).
assertTrue
(
TOY_ROBOT
==
0x0804
);
let
TOY_VEHICLE
=
bluetooth
.
MajorMinorClass
.
TOY_VEHICLE
;
console
.
info
(
"
[bluetooth_js]TOY_VEHICLE :
"
+
JSON
.
stringify
(
TOY_VEHICLE
));
expect
(
true
).
assertTrue
(
TOY_VEHICLE
==
0x0808
);
let
TOY_DOLL_ACTION_FIGURE
=
bluetooth
.
MajorMinorClass
.
TOY_DOLL_ACTION_FIGURE
;
console
.
info
(
"
[bluetooth_js]TOY_DOLL_ACTION_FIGURE :
"
+
JSON
.
stringify
(
TOY_DOLL_ACTION_FIGURE
));
expect
(
true
).
assertTrue
(
TOY_DOLL_ACTION_FIGURE
==
0x080C
);
let
TOY_CONTROLLER
=
bluetooth
.
MajorMinorClass
.
TOY_CONTROLLER
;
console
.
info
(
"
[bluetooth_js]TOY_CONTROLLER :
"
+
JSON
.
stringify
(
TOY_CONTROLLER
));
expect
(
true
).
assertTrue
(
TOY_CONTROLLER
==
0x0810
);
let
TOY_GAME
=
bluetooth
.
MajorMinorClass
.
TOY_GAME
;
console
.
info
(
"
[bluetooth_js]TOY_GAME :
"
+
JSON
.
stringify
(
TOY_GAME
));
expect
(
true
).
assertTrue
(
TOY_GAME
==
0x0814
);
let
HEALTH_UNCATEGORIZED
=
bluetooth
.
MajorMinorClass
.
HEALTH_UNCATEGORIZED
;
console
.
info
(
"
[bluetooth_js]HEALTH_UNCATEGORIZED :
"
+
JSON
.
stringify
(
HEALTH_UNCATEGORIZED
));
expect
(
true
).
assertTrue
(
HEALTH_UNCATEGORIZED
==
0x0900
);
let
HEALTH_BLOOD_PRESSURE
=
bluetooth
.
MajorMinorClass
.
HEALTH_BLOOD_PRESSURE
;
console
.
info
(
"
[bluetooth_js]HEALTH_BLOOD_PRESSURE :
"
+
JSON
.
stringify
(
HEALTH_BLOOD_PRESSURE
));
expect
(
true
).
assertTrue
(
HEALTH_BLOOD_PRESSURE
==
0x0904
);
let
HEALTH_THERMOMETER
=
bluetooth
.
MajorMinorClass
.
HEALTH_THERMOMETER
;
console
.
info
(
"
[bluetooth_js]HEALTH_THERMOMETER :
"
+
JSON
.
stringify
(
HEALTH_THERMOMETER
));
expect
(
true
).
assertTrue
(
HEALTH_THERMOMETER
==
0x0908
);
let
HEALTH_WEIGHING
=
bluetooth
.
MajorMinorClass
.
HEALTH_WEIGHING
;
console
.
info
(
"
[bluetooth_js]HEALTH_WEIGHING :
"
+
JSON
.
stringify
(
HEALTH_WEIGHING
));
expect
(
true
).
assertTrue
(
HEALTH_WEIGHING
==
0x090C
);
let
HEALTH_GLUCOSE
=
bluetooth
.
MajorMinorClass
.
HEALTH_GLUCOSE
;
console
.
info
(
"
[bluetooth_js]HEALTH_GLUCOSE :
"
+
JSON
.
stringify
(
HEALTH_GLUCOSE
));
expect
(
true
).
assertTrue
(
HEALTH_GLUCOSE
==
0x0910
);
let
HEALTH_PULSE_OXIMETER
=
bluetooth
.
MajorMinorClass
.
HEALTH_PULSE_OXIMETER
;
console
.
info
(
"
[bluetooth_js]HEALTH_PULSE_OXIMETER :
"
+
JSON
.
stringify
(
HEALTH_PULSE_OXIMETER
));
expect
(
true
).
assertTrue
(
HEALTH_PULSE_OXIMETER
==
0x0914
);
let
HEALTH_PULSE_RATE
=
bluetooth
.
MajorMinorClass
.
HEALTH_PULSE_RATE
;
console
.
info
(
"
[bluetooth_js]HEALTH_PULSE_RATE :
"
+
JSON
.
stringify
(
HEALTH_PULSE_RATE
));
expect
(
true
).
assertTrue
(
HEALTH_PULSE_RATE
==
0x0918
);
let
HEALTH_DATA_DISPLAY
=
bluetooth
.
MajorMinorClass
.
HEALTH_DATA_DISPLAY
;
console
.
info
(
"
[bluetooth_js]HEALTH_DATA_DISPLAY :
"
+
JSON
.
stringify
(
HEALTH_DATA_DISPLAY
));
expect
(
true
).
assertTrue
(
HEALTH_DATA_DISPLAY
==
0x091C
);
let
HEALTH_STEP_COUNTER
=
bluetooth
.
MajorMinorClass
.
HEALTH_STEP_COUNTER
;
console
.
info
(
"
[bluetooth_js]HEALTH_STEP_COUNTER :
"
+
JSON
.
stringify
(
HEALTH_STEP_COUNTER
));
expect
(
true
).
assertTrue
(
HEALTH_STEP_COUNTER
==
0x0920
);
let
HEALTH_BODY_COMPOSITION_ANALYZER
=
bluetooth
.
MajorMinorClass
.
HEALTH_BODY_COMPOSITION_ANALYZER
;
console
.
info
(
"
[bluetooth_js]HEALTH_BODY_COMPOSITION_ANALYZER :
"
+
JSON
.
stringify
(
HEALTH_BODY_COMPOSITION_ANALYZER
));
expect
(
true
).
assertTrue
(
HEALTH_BODY_COMPOSITION_ANALYZER
==
0x0924
);
let
HEALTH_PEAK_FLOW_MONITOR
=
bluetooth
.
MajorMinorClass
.
HEALTH_PEAK_FLOW_MONITOR
;
console
.
info
(
"
[bluetooth_js]HEALTH_PEAK_FLOW_MONITOR :
"
+
JSON
.
stringify
(
HEALTH_PEAK_FLOW_MONITOR
));
expect
(
true
).
assertTrue
(
HEALTH_PEAK_FLOW_MONITOR
==
0x0928
);
let
HEALTH_MEDICATION_MONITOR
=
bluetooth
.
MajorMinorClass
.
HEALTH_MEDICATION_MONITOR
;
console
.
info
(
"
[bluetooth_js]HEALTH_MEDICATION_MONITOR :
"
+
JSON
.
stringify
(
HEALTH_MEDICATION_MONITOR
));
expect
(
true
).
assertTrue
(
HEALTH_MEDICATION_MONITOR
==
0x092C
);
let
HEALTH_KNEE_PROSTHESIS
=
bluetooth
.
MajorMinorClass
.
HEALTH_KNEE_PROSTHESIS
;
console
.
info
(
"
[bluetooth_js]HEALTH_KNEE_PROSTHESIS :
"
+
JSON
.
stringify
(
HEALTH_KNEE_PROSTHESIS
));
expect
(
true
).
assertTrue
(
HEALTH_KNEE_PROSTHESIS
==
0x0930
);
let
HEALTH_ANKLE_PROSTHESIS
=
bluetooth
.
MajorMinorClass
.
HEALTH_ANKLE_PROSTHESIS
;
console
.
info
(
"
[bluetooth_js]HEALTH_ANKLE_PROSTHESIS :
"
+
JSON
.
stringify
(
HEALTH_ANKLE_PROSTHESIS
));
expect
(
true
).
assertTrue
(
HEALTH_ANKLE_PROSTHESIS
==
0x0934
);
let
HEALTH_GENERIC_HEALTH_MANAGER
=
bluetooth
.
MajorMinorClass
.
HEALTH_GENERIC_HEALTH_MANAGER
;
console
.
info
(
"
[bluetooth_js]HEALTH_GENERIC_HEALTH_MANAGER :
"
+
JSON
.
stringify
(
HEALTH_GENERIC_HEALTH_MANAGER
));
expect
(
true
).
assertTrue
(
HEALTH_GENERIC_HEALTH_MANAGER
==
0x0938
);
let
HEALTH_PERSONAL_MOBILITY_DEVICE
=
bluetooth
.
MajorMinorClass
.
HEALTH_PERSONAL_MOBILITY_DEVICE
;
console
.
info
(
"
[bluetooth_js]HEALTH_PERSONAL_MOBILITY_DEVICE :
"
+
JSON
.
stringify
(
HEALTH_PERSONAL_MOBILITY_DEVICE
));
expect
(
true
).
assertTrue
(
HEALTH_PERSONAL_MOBILITY_DEVICE
==
0x093C
);
done
()
})
})
}
...
...
communication/bluetooth_on/signature/openharmony_sx.p7b
浏览文件 @
1cf90995
无法预览此类型文件
communication/bluetooth_on/src/main/config.json
浏览文件 @
1cf90995
...
...
@@ -110,6 +110,16 @@
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
""
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.DISCOVER_BLUETOOTH"
,
"reason"
:
""
,
...
...
communication/bluetooth_profile/signature/openharmony_sx.p7b
浏览文件 @
1cf90995
无法预览此类型文件
communication/bluetooth_profile/src/main/config.json
浏览文件 @
1cf90995
...
...
@@ -106,6 +106,16 @@
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
""
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
...
...
communication/bluetooth_standard/signature/openharmony_sx.p7b
浏览文件 @
1cf90995
无法预览此类型文件
communication/bluetooth_standard/src/main/config.json
浏览文件 @
1cf90995
...
...
@@ -96,6 +96,16 @@
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
""
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
...
...
communication/bluetooth_standard/src/main/js/test/BRDiscovery.test.js
浏览文件 @
1cf90995
...
...
@@ -14,26 +14,41 @@
*/
import
bluetooth
from
'
@ohos.bluetooth
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
const
PERMISSION_USER_SET
=
1
;
const
PERMISSION_USER_NAME1
=
"
ohos.permission.LOCATION
"
;
const
PERMISSION_USER_NAME2
=
'
ohos.permission.LOCATION_IN_BACKGROUND
'
;
let
tokenID
=
undefined
;
async
function
grantPerm
()
{
console
.
info
(
"
====grant Permission start====
"
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.bluetooth.bluetoothhost
'
,
0
,
100
);
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
"
accessTokenId
"
+
appInfo
.
accessTokenId
+
"
bundleName:
"
+
appInfo
.
bundleName
);
import
osaccount
from
'
@ohos.account.osAccount
'
import
bundle
from
'
@ohos.bundle
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
async
function
applyPermission
()
{
let
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
info
(
"
=== getAccountManager finish
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
LocalId is :
"
+
localId
);
0
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.bluetooth.bluetoothhost
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
let
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME1
,
PERMISSION_USER_SET
);
console
.
info
(
"
tokenId
"
+
tokenID
+
"
result:
"
+
result
);
let
result1
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME2
,
PERMISSION_USER_SET
);
console
.
info
(
"
tokenId
"
+
tokenID
+
"
result1:
"
+
result1
);
console
.
info
(
"
====grant Permission end====
"
);
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName
=
'
ohos.permission.LOCATION
'
;
let
permissionName1
=
'
ohos.permission.APPROXIMATELY_LOCATION
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permis
'
+
'
sion] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
err
));
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success1 :
'
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permis
'
+
'
sion] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
err
));
});
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
export
default
function
bluetoothhostTest3
()
{
describe
(
'
bluetoothhostTest3
'
,
function
()
{
function
sleep
(
delay
)
{
...
...
@@ -69,7 +84,7 @@ describe('bluetoothhostTest3', function() {
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll called
'
)
await
grantPerm
();
await
applyPermission
();
done
()
})
beforeEach
(
async
function
(
done
)
{
...
...
@@ -122,6 +137,8 @@ describe('bluetoothhostTest3', function() {
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_Discovery_0300
'
,
0
,
async
function
(
done
)
{
let
result1
=
bluetooth
.
setBluetoothScanMode
(
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE
,
10
);
console
.
info
(
'
[bluetooth_js] setBluetoothScanMode =
'
+
JSON
.
stringify
(
result1
));
await
sleep
(
3000
);
expect
(
result1
).
assertTrue
();
let
getScanMode
=
bluetooth
.
getBluetoothScanMode
();
console
.
info
(
'
[bluetooth_js] getScanMode =
'
+
JSON
.
stringify
(
getScanMode
));
...
...
communication/bluetooth_standard/src/main/js/test/BRScanMode.test.js
浏览文件 @
1cf90995
...
...
@@ -332,12 +332,14 @@ describe('bluetoothhostTest2', function() {
let
oldScanMode
=
bluetooth
.
getBluetoothScanMode
();
console
.
info
(
'
[bluetooth_js] ScanMode_0800 oldScanMode =
'
+
JSON
.
stringify
(
oldScanMode
));
let
result
=
bluetooth
.
setBluetoothScanMode
(
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
,
0
);
expect
(
result
).
assertTrue
();
console
.
info
(
'
[bluetooth_js] result =
'
+
JSON
.
stringify
(
result
));
// expect(result).assertTrue();
let
getScanMode
=
bluetooth
.
getBluetoothScanMode
();
console
.
info
(
'
[bluetooth_js] ScanMode_0800 getScanMode =
'
+
JSON
.
stringify
(
getScanMode
));
expect
(
true
).
assertEqual
(
getScanMode
==
bluetooth
.
ScanMode
.
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE
);
result
=
bluetooth
.
setBluetoothScanMode
(
oldScanMode
,
0
);
expect
(
result
).
assertTrue
();
console
.
info
(
'
[bluetooth_js] result1 =
'
+
JSON
.
stringify
(
result
));
// expect(result).assertTrue();
let
getOldScanMode
=
bluetooth
.
getBluetoothScanMode
();
console
.
info
(
'
[bluetooth_js] ScanMode_0800 getOldScanMode =
'
+
JSON
.
stringify
(
getOldScanMode
));
expect
(
true
).
assertEqual
(
oldScanMode
==
getOldScanMode
);
...
...
communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js
浏览文件 @
1cf90995
...
...
@@ -15,13 +15,6 @@
import
bluetooth
from
'
@ohos.bluetooth
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
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
};
export
default
function
bluetoothhostTest
()
{
describe
(
'
bluetoothhostTest
'
,
function
()
{
...
...
@@ -126,6 +119,39 @@ describe('bluetoothhostTest', function() {
}
done
()
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0444
* @tc.name testEnableBluetooth and getState
* @tc.desc Test EnableBluetooth api by promise.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
*/
it
(
'
COMMUNICATION_BLUETOOTH_SwitchOff_0444
'
,
0
,
async
function
(
done
)
{
let
STATE_ON
=
bluetooth
.
BluetoothState
.
STATE_ON
;
console
.
info
(
"
[bluetooth_js]STATE_ON :
"
+
JSON
.
stringify
(
STATE_ON
));
expect
(
true
).
assertTrue
(
STATE_ON
==
2
);
let
STATE_OFF
=
bluetooth
.
BluetoothState
.
STATE_OFF
;
console
.
info
(
"
[bluetooth_js]STATE_OFF :
"
+
JSON
.
stringify
(
STATE_OFF
));
expect
(
true
).
assertTrue
(
STATE_OFF
==
0
);
let
STATE_TURNING_ON
=
bluetooth
.
BluetoothState
.
STATE_TURNING_ON
;
console
.
info
(
"
[bluetooth_js]STATE_TURNING_ON :
"
+
JSON
.
stringify
(
STATE_TURNING_ON
));
expect
(
true
).
assertTrue
(
STATE_TURNING_ON
==
1
);
let
STATE_TURNING_OFF
=
bluetooth
.
BluetoothState
.
STATE_TURNING_OFF
;
console
.
info
(
"
[bluetooth_js]STATE_TURNING_OFF :
"
+
JSON
.
stringify
(
STATE_TURNING_OFF
));
expect
(
true
).
assertTrue
(
STATE_TURNING_OFF
==
3
);
let
STATE_BLE_TURNING_ON
=
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_ON
;
console
.
info
(
"
[bluetooth_js]STATE_BLE_TURNING_ON :
"
+
JSON
.
stringify
(
STATE_BLE_TURNING_ON
));
expect
(
true
).
assertTrue
(
STATE_BLE_TURNING_ON
==
4
);
let
STATE_BLE_ON
=
bluetooth
.
BluetoothState
.
STATE_BLE_ON
;
console
.
info
(
"
[bluetooth_js]STATE_BLE_ON :
"
+
JSON
.
stringify
(
STATE_BLE_ON
));
expect
(
true
).
assertTrue
(
STATE_BLE_ON
==
5
);
let
STATE_BLE_TURNING_OFF
=
bluetooth
.
BluetoothState
.
STATE_BLE_TURNING_OFF
;
console
.
info
(
"
[bluetooth_js]STATE_BLE_TURNING_OFF :
"
+
JSON
.
stringify
(
STATE_BLE_TURNING_OFF
));
expect
(
true
).
assertTrue
(
STATE_BLE_TURNING_OFF
==
6
);
done
()
})
})
}
...
...
communication/bluetooth_standard/src/main/js/test/List.test.js
浏览文件 @
1cf90995
...
...
@@ -15,14 +15,14 @@
import
bluetoothhostTest1
from
'
./BRSetLocalName.test.js
'
import
bluetoothhostTest2
from
'
./BRScanMode.test.js
'
import
bluetoothhostTest3
from
'
./BRDiscovery.test.js
'
import
bluetoothhostTest4
from
'
./BRSpp.test.js
'
import
bluetoothhostTest
from
'
./BRSwitch.test.js
'
import
bluetoothhostTest3
from
'
./BRDiscovery.test.js
'
export
default
function
testsuite
()
{
bluetoothhostTest
()
bluetoothhostTest1
()
bluetoothhostTest2
()
bluetoothhostTest3
()
bluetoothhostTest4
()
bluetoothhostTest
()
bluetoothhostTest3
()
}
communication/bluetooth_switchoff/signature/openharmony_sx.p7b
浏览文件 @
1cf90995
无法预览此类型文件
communication/bluetooth_switchoff/src/main/config.json
浏览文件 @
1cf90995
...
...
@@ -96,6 +96,16 @@
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.APPROXIMATELY_LOCATION"
,
"reason"
:
""
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.MANAGE_BLUETOOTH"
,
"reason"
:
""
,
...
...
communication/bluetooth_switchoff/src/main/js/test/SwitchOff003.test.js
浏览文件 @
1cf90995
...
...
@@ -17,6 +17,39 @@ import bluetoothManager from '@ohos.bluetoothManager';
import
bluetooth
from
'
@ohos.bluetooth
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
bundle
from
'
@ohos.bundle
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
async
function
applyPermission
()
{
let
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
info
(
"
=== getAccountManager finish
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
LocalId is :
"
+
localId
);
0
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.bluetooth.bluetoothhost
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName
=
'
ohos.permission.LOCATION
'
;
let
permissionName1
=
'
ohos.permission.APPROXIMATELY_LOCATION
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permis
'
+
'
sion] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
err
));
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success1 :
'
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permis
'
+
'
sion] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
err
));
});
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
export
default
function
bluetoothBLETest3
()
{
describe
(
'
bluetoothBLETest3
'
,
function
()
{
let
gattServer
=
null
;
...
...
@@ -47,10 +80,12 @@ describe('bluetoothBLETest3', function() {
console
.
info
(
'
[bluetooth_js] enable success
'
);
}
}
beforeAll
(
function
(
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll called
'
)
gattServer
=
bluetoothManager
.
BLE
.
createGattServer
();
gattClient
=
bluetoothManager
.
BLE
.
createGattClientDevice
(
"
11:22:33:44:55:66
"
);
await
applyPermission
();
done
();
})
beforeEach
(
async
function
(
done
)
{
console
.
info
(
'
beforeEach called
'
)
...
...
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
浏览文件 @
1cf90995
...
...
@@ -164,17 +164,20 @@ export default function geolocationTest_geo5() {
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation21 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
+
JSON
.
stringify
(
data
)[
0
].
administrativeArea
+
JSON
.
stringify
(
data
)[
0
].
countryCode
+
JSON
.
stringify
(
data
)[
0
].
countryName
+
JSON
.
stringify
(
data
)[
0
].
descriptions
+
JSON
.
stringify
(
data
)[
0
].
descriptionsSize
+
data
[
0
].
latitude
+
JSON
.
stringify
(
data
)[
0
].
locale
+
JSON
.
stringify
(
data
)[
0
].
locality
+
JSON
.
stringify
(
data
)[
0
].
longitude
+
JSON
.
stringify
(
data
)[
0
].
phoneNumber
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
if
(
data
!=
""
)
{
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
+
JSON
.
stringify
(
data
)[
0
].
administrativeArea
+
JSON
.
stringify
(
data
)[
0
].
countryCode
+
JSON
.
stringify
(
data
)[
0
].
countryName
+
JSON
.
stringify
(
data
)[
0
].
descriptions
+
JSON
.
stringify
(
data
)[
0
].
descriptionsSize
+
data
[
0
].
latitude
+
JSON
.
stringify
(
data
)[
0
].
locale
+
JSON
.
stringify
(
data
)[
0
].
locality
+
JSON
.
stringify
(
data
)[
0
].
longitude
+
JSON
.
stringify
(
data
)[
0
].
phoneNumber
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
}
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
...
...
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
浏览文件 @
1cf90995
...
...
@@ -612,7 +612,6 @@ export default function geolocationTest_geo7() {
console
.
info
(
'
[lbs_js] sendcommand promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
error
.
code
).
assertEqual
(
801
);
//expect(true).assertEqual(JSON.stringify(error) != null);
done
();
})
}
catch
(
error
)
{
...
...
@@ -1180,11 +1179,11 @@ export default function geolocationTest_geo7() {
try
{
let
last
=
geolocationm
.
getLastLocation
();
console
.
info
(
'
[lbs_js] getLastLocation latitude:
'
+
last
.
latitude
+
'
longitude:
'
+
result
.
longitude
+
'
altitude:
'
+
resul
t
.
altitude
+
'
accuracy:
'
+
result
.
accuracy
+
'
speed:
'
+
resul
t
.
speed
+
'
timeStamp:
'
+
result
.
timeStamp
+
'
direction:
'
+
resul
t
.
direction
+
'
timeSinceBoot:
'
+
result
.
timeSinceBoot
+
'
additions:
'
+
result
.
additions
+
'
additionSize
'
+
resul
t
.
additionSize
+
'
isFromMock
'
+
resul
t
.
isFromMock
);
'
longitude:
'
+
last
.
longitude
+
'
altitude:
'
+
las
t
.
altitude
+
'
accuracy:
'
+
last
.
accuracy
+
'
speed:
'
+
las
t
.
speed
+
'
timeStamp:
'
+
last
.
timeStamp
+
'
direction:
'
+
las
t
.
direction
+
'
timeSinceBoot:
'
+
last
.
timeSinceBoot
+
'
additions:
'
+
last
.
additions
+
'
additionSize
'
+
las
t
.
additionSize
+
'
isFromMock
'
+
las
t
.
isFromMock
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
last
)
!=
null
);
}
catch
(
error
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录