Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
896f1ea4
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看板
提交
896f1ea4
编写于
5月 17, 2023
作者:
L
luo-wei246
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:Document Format refresh
Signed-off-by:
N
luo-wei246
<
luowei137@huawei.com
>
上级
e475a982
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
12 deletion
+26
-12
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
+13
-6
未找到文件。
en/application-dev/reference/apis/js-apis-usbManager.md
浏览文件 @
896f1ea4
...
@@ -209,8 +209,8 @@ Removes the permission for the application to access a USB device.
...
@@ -209,8 +209,8 @@ Removes the permission for the application to access a USB device.
**Example**
**Example**
```
js
```
js
let
devicesName
=
"
1-1
"
;
let
devicesName
=
"
1-1
"
;
if
usb
.
removeRight
(
devicesName
)
{
if
(
usb
.
removeRight
(
devicesName
)
)
{
console
.
log
(
`Succeed in removing right`
);
console
.
log
(
`Succeed in removing right`
);
}
}
```
```
...
@@ -245,7 +245,7 @@ Adds the permission for the application to access a USB device.
...
@@ -245,7 +245,7 @@ Adds the permission for the application to access a USB device.
```
js
```
js
let
devicesName
=
"
1-1
"
;
let
devicesName
=
"
1-1
"
;
let
bundleName
=
"
com.example.hello
"
;
let
bundleName
=
"
com.example.hello
"
;
if
usb
.
addRight
(
bundleName
,
devicesName
)
{
if
(
usb
.
addRight
(
bundleName
,
devicesName
)
)
{
console
.
log
(
`Succeed in adding right`
);
console
.
log
(
`Succeed in adding right`
);
}
}
```
```
...
@@ -454,7 +454,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -454,7 +454,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Example**
**Example**
```
js
```
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
)
=>
{
usb
.
controlTransfer
(
devicepipe
,
param
).
then
((
ret
)
=>
{
console
.
log
(
`controlTransfer =
${
ret
}
`
);
console
.
log
(
`controlTransfer =
${
ret
}
`
);
})
})
...
@@ -579,7 +586,7 @@ Converts the USB function list in the numeric mask format to a string in Device
...
@@ -579,7 +586,7 @@ Converts the USB function list in the numeric mask format to a string in Device
**Example**
**Example**
```
js
```
js
let
funcs
=
usb
.
ACM
|
usb
.
ECM
;
let
funcs
=
usb
.
FunctionType
.
ACM
|
usb
.
FunctionType
.
ECM
;
let
ret
=
usb
.
usbFunctionsToString
(
funcs
);
let
ret
=
usb
.
usbFunctionsToString
(
funcs
);
```
```
...
@@ -608,7 +615,7 @@ Sets the current USB function list in Device mode.
...
@@ -608,7 +615,7 @@ Sets the current USB function list in Device mode.
**Example**
**Example**
```
js
```
js
let
funcs
=
usb
.
HDC
;
let
funcs
=
usb
.
FunctionType
.
HDC
;
usb
.
setCurrentFunctions
(
funcs
).
then
(()
=>
{
usb
.
setCurrentFunctions
(
funcs
).
then
(()
=>
{
console
.
info
(
'
usb setCurrentFunctions successfully.
'
);
console
.
info
(
'
usb setCurrentFunctions successfully.
'
);
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
...
...
zh-cn/application-dev/reference/apis/js-apis-usbManager.md
浏览文件 @
896f1ea4
...
@@ -209,8 +209,8 @@ removeRight(deviceName: string): boolean
...
@@ -209,8 +209,8 @@ removeRight(deviceName: string): boolean
**示例:**
**示例:**
```
js
```
js
let
devicesName
=
"
1-1
"
;
let
devicesName
=
"
1-1
"
;
if
usb
.
removeRight
(
devicesName
)
{
if
(
usb
.
removeRight
(
devicesName
)
)
{
console
.
log
(
`Succeed in removing right`
);
console
.
log
(
`Succeed in removing right`
);
}
}
```
```
...
@@ -245,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean
...
@@ -245,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean
```
js
```
js
let
devicesName
=
"
1-1
"
;
let
devicesName
=
"
1-1
"
;
let
bundleName
=
"
com.example.hello
"
;
let
bundleName
=
"
com.example.hello
"
;
if
usb
.
addRight
(
bundleName
,
devicesName
)
{
if
(
usb
.
addRight
(
bundleName
,
devicesName
)
)
{
console
.
log
(
`Succeed in adding right`
);
console
.
log
(
`Succeed in adding right`
);
}
}
```
```
...
@@ -454,7 +454,14 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?:
...
@@ -454,7 +454,14 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?:
**示例:**
**示例:**
```
js
```
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
)
=>
{
usb
.
controlTransfer
(
devicepipe
,
param
).
then
((
ret
)
=>
{
console
.
log
(
`controlTransfer =
${
ret
}
`
);
console
.
log
(
`controlTransfer =
${
ret
}
`
);
})
})
...
@@ -579,7 +586,7 @@ usbFunctionsToString(funcs: FunctionType): string
...
@@ -579,7 +586,7 @@ usbFunctionsToString(funcs: FunctionType): string
**示例:**
**示例:**
```
js
```
js
let
funcs
=
usb
.
ACM
|
usb
.
ECM
;
let
funcs
=
usb
.
FunctionType
.
ACM
|
usb
.
FunctionType
.
ECM
;
let
ret
=
usb
.
usbFunctionsToString
(
funcs
);
let
ret
=
usb
.
usbFunctionsToString
(
funcs
);
```
```
...
@@ -608,7 +615,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\<void\>
...
@@ -608,7 +615,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\<void\>
**示例:**
**示例:**
```
js
```
js
let
funcs
=
usb
.
HDC
;
let
funcs
=
usb
.
FunctionType
.
HDC
;
usb
.
setCurrentFunctions
(
funcs
).
then
(()
=>
{
usb
.
setCurrentFunctions
(
funcs
).
then
(()
=>
{
console
.
info
(
'
usb setCurrentFunctions successfully.
'
);
console
.
info
(
'
usb setCurrentFunctions successfully.
'
);
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录