• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3633

entry/12-May-2024-1,2431,119

screenshots/device/12-May-2024-

.gitignoreD12-May-2024143 1211

README.mdD12-May-20241.6 KiB3417

README_zh.mdD12-May-20241.1 KiB3420

build-profile.json5D12-May-20241 KiB4241

hvigorfile.tsD12-May-2024158 21

package.jsonD12-May-2024373 1818

README.md

1# USB management
2
3### Introduction
4
5This example demonstrates the use of USB device management, including USB device insertion and removal status monitoring and USB device information display. The results are as follows:
6
7![](screenshots/device/DeviceList.png)
8
9# Related Conceptions
10
111. [Subscribe to USB Listening Events](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md#commoneventcreatesubscriber) : Obtain the interface usage status by subscribing to the USB insertion and removal listening events.
12
132. [Get USB Device List](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-usb.md#usbgetdevices): Gets the list of plugged in USB devices.
14
15### Related permissions
16
17Not involved
18
19### Usage
20
211. Open the **USB Listening** switch, and the interface pops up the prompt of "Start Listening...".
22
232. Plug in the device, the interface will have a "USB plugged in" prompt, the device list will show the plugged in device. If the list is not updated in time, you can manually refresh the drop-down list.
24
253. Click on the device, the pop-up box will display the specific information of the USB device, click the **OK** button to return to the main page.
26
274. Unplug the USB device, the interface will have a "removed device" prompt, and the device list will remove the device model. If the list is not updated in time, you can manually refresh the drop-down list.
28
29### Constraints and Restrictions
30
311. This sample is only supported to run on standard systems.
32
332. This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.
34

README_zh.md

1# USB管理
2
3### 介绍
4
5本示例展示了USB设备管理的使用,包括USB设备插拔状态监听和USB设备信息显示。
6
7使用说明:
8
91. 打开**USB监听**开关,界面弹出"开始监听..."的提示(USB监听开关仅监听设备是否插入并弹窗进行提示);
102. 插入设备,界面会有“USB已插入”的提示,设备列表会显示已插入设备的名称。如果列表没有及时更新,则可以下拉列表手动刷新;
113. 点击设备,弹框会显示该USB设备的具体信息,点击**确定**按钮返回主页面;
124. 将USB设备拔出,界面会有“已移除设备”的提示,设备列表会移除该名称的设备,如果列表没有及时更新,则可以下拉列表手动刷新。
13
14### 效果预览
15
16|首页|
17|---------|
18|![](screenshots/device/DeviceList.png)|
19
20### 相关权限
21
22不涉及。
23
24### 依赖
25
26不涉及。
27
28### 约束与限制
29
301. 本示例仅支持在标准系统上运行;
31
322. 本示例仅支持API9版本SDK,版本号:3.2.10.6;
33
343. 本示例需要使用DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100)及以上才可编译运行。