Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e9d8f8e8
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e9d8f8e8
编写于
5月 18, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
!18388 fix:Document Format refresh
Merge pull request !18388 from 罗巍/OpenHarmony-3.2-Release
上级
8240621b
644e67dc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
13 deletion
+27
-13
en/application-dev/reference/apis/js-apis-usbManager.md
en/application-dev/reference/apis/js-apis-usbManager.md
+13
-6
zh-cn/application-dev/reference/apis/js-apis-usbManager.md
zh-cn/application-dev/reference/apis/js-apis-usbManager.md
+14
-7
未找到文件。
en/application-dev/reference/apis/js-apis-usbManager.md
浏览文件 @
e9d8f8e8
...
...
@@ -30,7 +30,7 @@ Obtains the list of USB devices connected to the host. If no device is connected
```
js
let
devicesList
=
usb
.
getDevices
();
c
c
onsole
.
log
(
`devicesList =
${
devicesList
}
`
);
console
.
log
(
`devicesList =
${
devicesList
}
`
);
// devicesList is a list of USB devices.
// A simple example of devicesList is provided as follows:
[
...
...
@@ -210,7 +210,7 @@ Removes the permission for the application to access a USB device.
```
js
let
devicesName
=
"
1-1
"
;
if
usb
.
removeRight
(
devicesName
)
{
if
(
usb
.
removeRight
(
devicesName
)
)
{
console
.
log
(
`Succeed in removing right`
);
}
```
...
...
@@ -245,7 +245,7 @@ Adds the permission for the application to access a USB device.
```
js
let
devicesName
=
"
1-1
"
;
let
bundleName
=
"
com.example.hello
"
;
if
usb
.
addRight
(
bundleName
,
devicesName
)
{
if
(
usb
.
addRight
(
bundleName
,
devicesName
)
)
{
console
.
log
(
`Succeed in adding right`
);
}
```
...
...
@@ -454,7 +454,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Example**
```
js
let
param
=
new
usb
.
USBControlParams
();
let
param
=
{
request
:
0
,
reqType
:
0
,
target
:
0
,
value
:
0
,
index
:
0
,
data
:
null
};
usb
.
controlTransfer
(
devicepipe
,
param
).
then
((
ret
)
=>
{
console
.
log
(
`controlTransfer =
${
ret
}
`
);
})
...
...
@@ -579,7 +586,7 @@ Converts the USB function list in the numeric mask format to a string in Device
**Example**
```
js
let
funcs
=
usb
.
ACM
|
usb
.
ECM
;
let
funcs
=
usb
.
FunctionType
.
ACM
|
usb
.
FunctionType
.
ECM
;
let
ret
=
usb
.
usbFunctionsToString
(
funcs
);
```
...
...
@@ -608,7 +615,7 @@ Sets the current USB function list in Device mode.
**Example**
```
js
let
funcs
=
usb
.
HDC
;
let
funcs
=
usb
.
FunctionType
.
HDC
;
usb
.
setCurrentFunctions
(
funcs
).
then
(()
=>
{
console
.
info
(
'
usb setCurrentFunctions successfully.
'
);
}).
catch
(
err
=>
{
...
...
zh-cn/application-dev/reference/apis/js-apis-usbManager.md
浏览文件 @
e9d8f8e8
...
...
@@ -30,7 +30,7 @@ getDevices(): Array<Readonly<USBDevice>>
```
js
let
devicesList
=
usb
.
getDevices
();
c
c
onsole
.
log
(
`devicesList =
${
devicesList
}
`
);
console
.
log
(
`devicesList =
${
devicesList
}
`
);
//devicesList 返回的数据结构
//此处提供一个简单的示例,如下
[
...
...
@@ -209,8 +209,8 @@ removeRight(deviceName: string): boolean
**示例:**
```
js
let
devicesName
=
"
1-1
"
;
if
usb
.
removeRight
(
devicesName
)
{
let
devicesName
=
"
1-1
"
;
if
(
usb
.
removeRight
(
devicesName
)
)
{
console
.
log
(
`Succeed in removing right`
);
}
```
...
...
@@ -245,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean
```
js
let
devicesName
=
"
1-1
"
;
let
bundleName
=
"
com.example.hello
"
;
if
usb
.
addRight
(
bundleName
,
devicesName
)
{
if
(
usb
.
addRight
(
bundleName
,
devicesName
)
)
{
console
.
log
(
`Succeed in adding right`
);
}
```
...
...
@@ -454,7 +454,14 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?:
**示例:**
```
js
let
param
=
new
usb
.
USBControlParams
();
let
param
=
{
request
:
0
,
reqType
:
0
,
target
:
0
,
value
:
0
,
index
:
0
,
data
:
null
};
usb
.
controlTransfer
(
devicepipe
,
param
).
then
((
ret
)
=>
{
console
.
log
(
`controlTransfer =
${
ret
}
`
);
})
...
...
@@ -579,7 +586,7 @@ usbFunctionsToString(funcs: FunctionType): string
**示例:**
```
js
let
funcs
=
usb
.
ACM
|
usb
.
ECM
;
let
funcs
=
usb
.
FunctionType
.
ACM
|
usb
.
FunctionType
.
ECM
;
let
ret
=
usb
.
usbFunctionsToString
(
funcs
);
```
...
...
@@ -608,7 +615,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\<void\>
**示例:**
```
js
let
funcs
=
usb
.
HDC
;
let
funcs
=
usb
.
FunctionType
.
HDC
;
usb
.
setCurrentFunctions
(
funcs
).
then
(()
=>
{
console
.
info
(
'
usb setCurrentFunctions successfully.
'
);
}).
catch
(
err
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录