Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c670d055
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看板
提交
c670d055
编写于
6月 20, 2022
作者:
S
shawn_he
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update docs
Signed-off-by:
N
shawn_he
<
shawn.he@huawei.com
>
上级
00b6b9a2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
33 deletion
+67
-33
en/application-dev/device/usb-guidelines.md
en/application-dev/device/usb-guidelines.md
+1
-1
en/application-dev/reference/apis/js-apis-contact.md
en/application-dev/reference/apis/js-apis-contact.md
+62
-28
en/application-dev/reference/apis/js-apis-inputdevice.md
en/application-dev/reference/apis/js-apis-inputdevice.md
+4
-4
未找到文件。
en/application-dev/device/usb-guidelines.md
浏览文件 @
c670d055
...
...
@@ -8,7 +8,7 @@ In Host mode, you can obtain the list of connected devices, enable or disable th
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
The following table lists the USB APIs currently available. For details, see the
[
API Reference
](
../reference/apis/js-apis-usb.md
)
.
The following table lists the USB APIs currently available. For details, see the
[
API Reference
](
../reference/apis/js-apis-usb.md
)
.
**Table 1**
Open USB APIs
...
...
en/application-dev/reference/apis/js-apis-contact.md
浏览文件 @
c670d055
...
...
@@ -195,7 +195,7 @@ Updates a contact based on the specified contact information and attributes. Thi
fullName
:
{
fullName
:
'
xxx
'
},
phoneNumbers
:
[{
phoneNumber
:
'
138xxxxxxxx
'
}]
},{
attributes
:[
'
ATTR_EMAIL
'
,
'
ATTR_NAME
'
]
attributes
:[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
updateContact callback: err->${JSON.stringify(err)}
'
);
...
...
@@ -234,7 +234,7 @@ Updates a contact based on the specified contact information and attributes. Thi
fullName
:
{
fullName
:
'
xxx
'
},
phoneNumbers
:
[{
phoneNumber
:
'
138xxxxxxxx
'
}]
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
});
promise
.
then
(()
=>
{
console
.
log
(
'
updateContact success
'
);
...
...
@@ -564,7 +564,9 @@ Queries contacts based on the specified key and application. This API uses an as
```
js
contact
.
queryContact
(
'
xxx
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContact callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -596,7 +598,7 @@ Queries contacts based on the specified key and attributes. This API uses an asy
```
js
contact
.
queryContact
(
'
xxx
'
,
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContact callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -630,8 +632,11 @@ Queries contacts based on the specified key, application, and attributes. This A
```
js
contact
.
queryContact
(
'
xxx
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContact callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -669,8 +674,11 @@ Queries contacts based on the specified key, application, and attributes. This A
```
js
let
promise
=
contact
.
queryContact
(
'
xxx
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
});
promise
.
then
((
data
)
=>
{
console
.
log
(
`queryContact success: data->
${
JSON
.
stringify
(
data
)}
`
);
...
...
@@ -728,7 +736,9 @@ Queries all contacts based on the specified application. This API uses an asynch
```
js
contact
.
queryContacts
({
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContacts callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -759,7 +769,7 @@ Queries all contacts based on the specified attributes. This API uses an asynchr
```
js
contact
.
queryContacts
({
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContacts callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -791,9 +801,11 @@ Queries all contacts based on the specified application and attributes. This API
```
js
contact
.
queryContacts
({
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContacts callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -829,9 +841,11 @@ Queries all contacts based on the specified application and attributes. This API
```
js
let
promise
=
contact
.
queryContacts
({
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
});
promise
.
then
((
data
)
=>
{
console
.
log
(
`queryContacts success: data->
${
JSON
.
stringify
(
data
)}
`
);
...
...
@@ -891,7 +905,9 @@ Queries contacts based on the specified phone number and application. This API u
```
js
contact
.
queryContactsByPhoneNumber
(
'
138xxxxxxxx
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContactsByPhoneNumber callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -923,7 +939,7 @@ Queries contacts based on the specified phone number and attributes. This API us
```
js
contact
.
queryContactsByPhoneNumber
(
'
138xxxxxxxx
'
,
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContactsByPhoneNumber callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -956,9 +972,11 @@ Queries contacts based on the specified phone number, application, and attribute
```
js
contact
.
queryContactsByPhoneNumber
(
'
138xxxxxxxx
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContactsByPhoneNumber callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -995,9 +1013,11 @@ Queries contacts based on the specified phone number, application, and attribute
```
js
let
promise
=
contact
.
queryContactsByPhoneNumber
(
'
138xxxxxxxx
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
});
promise
.
then
((
data
)
=>
{
console
.
log
(
`queryContactsByPhoneNumber success: data->
${
JSON
.
stringify
(
data
)}
`
);
...
...
@@ -1057,7 +1077,9 @@ Queries contacts based on the specified email address and application. This API
```
js
contact
.
queryContactsByEmail
(
'
xxx@email.com
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContactsByEmail callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -1089,7 +1111,7 @@ Queries contacts based on the specified email address and attributes. This API u
```
js
contact
.
queryContactsByEmail
(
'
xxx@email.com
'
,
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContactsByEmail callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -1122,9 +1144,11 @@ Queries contacts based on the specified email address, application, and attribut
```
js
contact
.
queryContactsByEmail
(
'
xxx@email.com
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryContactsByEmail callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -1161,9 +1185,11 @@ Queries contacts based on the specified email address, application, and attribut
```
js
let
promise
=
contact
.
queryContactsByEmail
(
'
xxx@email.com
'
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
{
attributes
:
[
"
ATTR_EMAIL
"
,
"
ATTR_NAME
"
]
attributes
:
[
contact
.
Attribute
.
ATTR_EMAIL
,
contact
.
Attribute
.
ATTR_NAME
]
});
promise
.
then
((
data
)
=>
{
console
.
log
(
`queryContactsByEmail success: data->
${
JSON
.
stringify
(
data
)}
`
);
...
...
@@ -1221,7 +1247,9 @@ Queries all groups of this contact based on the specified application. This API
```
js
contact
.
queryGroups
({
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryGroups callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -1256,7 +1284,9 @@ Queries all groups of this contact based on the specified application. This API
```
js
let
promise
=
contact
.
queryGroups
({
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
});
promise
.
then
((
data
)
=>
{
console
.
log
(
`queryGroups success: data->
${
JSON
.
stringify
(
data
)}
`
);
...
...
@@ -1371,7 +1401,9 @@ Queries the key of a contact based on the specified contact ID and application.
```
js
contact
.
queryKey
(
id
,
{
holderId
:
1
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`queryKey callback: err->
${
JSON
.
stringify
(
err
)}
`
);
...
...
@@ -1407,7 +1439,9 @@ Queries the key of a contact based on the specified contact ID and application.
```
js
let
promise
=
contact
.
queryKey
(
id
,
{
holderId
:
0
holderId
:
0
,
bundleName
:
""
,
displayName
:
""
});
promise
.
then
((
data
)
=>
{
console
.
log
(
`queryKey success: data->
${
JSON
.
stringify
(
data
)}
`
);
...
...
en/application-dev/reference/apis/js-apis-inputdevice.md
浏览文件 @
c670d055
...
...
@@ -36,7 +36,7 @@ Enables listening for hot swap events of an input device.
let
isPhysicalKeyboardExist
=
true
;
inputDevice
.
on
(
"
change
"
,
(
data
)
=>
{
console
.
log
(
"
type:
"
+
data
.
type
+
"
, deviceId:
"
+
data
.
deviceId
);
inputDevice
.
getKeyboardType
(
data
.
deviceId
,
(
ret
)
=>
{
inputDevice
.
getKeyboardType
(
data
.
deviceId
,
(
err
,
ret
)
=>
{
console
.
log
(
"
The keyboard type of the device is:
"
+
ret
);
if
(
ret
==
inputDevice
.
KeyboardType
.
ALPHABETIC_KEYBOARD
&&
data
.
type
==
'
add
'
)
{
// The physical keyboard is connected.
...
...
@@ -68,12 +68,12 @@ Disables listening for hot swap events of an input device.
**Example**
```
js
listener
:
function
(
data
)
{
function
listener
(
data
)
{
console
.
log
(
"
type:
"
+
data
.
type
+
"
, deviceId:
"
+
data
.
deviceId
);
}
// Disable this listener.
inputDevice
.
off
(
"
change
"
,
this
.
listener
);
inputDevice
.
off
(
"
change
"
,
listener
);
// Disable all listeners.
inputDevice
.
off
(
"
change
"
);
...
...
@@ -336,7 +336,7 @@ Defines the axis range of an input device.
| Name | Type | Description |
| ----------------------- | ------------------------- | -------- |
| source |
[
SourceType
](
#sourcetype
)
| Input source type of the axis.|
| axis |
[
AxisType
](
axistype
)
| Axis type. |
| axis |
[
AxisType
](
#
axistype
)
| Axis type. |
| max | number | Maximum value of the axis. |
| min | number | Minimum value of the axis. |
| fuzz
<sup>
9+
</sup>
| number | Fuzzy value of the axis. |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录