Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ebf0f2ee
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ebf0f2ee
编写于
10月 15, 2022
作者:
@
@shi-xiaoxiao-iris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
错误码说明
Signed-off-by:
N
@shi-xiaoxiao-iris
<
shixiaoxiao2@huawei.com
>
上级
517e41b4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
110 addition
and
71 deletion
+110
-71
zh-cn/application-dev/reference/apis/js-apis-device-manager.md
.../application-dev/reference/apis/js-apis-device-manager.md
+110
-71
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-device-manager.md
浏览文件 @
ebf0f2ee
...
...
@@ -47,9 +47,10 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
**示例**
...
...
@@ -220,7 +221,6 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager
设备管理实例,用于获取可信设备和本地设备的相关信息。在调用DeviceManager的方法前,需要先通过createDeviceManager构建一个DeviceManager实例dmInstance。
### release
release(): void
...
...
@@ -247,7 +247,6 @@ release(): void
}
```
### getTrustedDeviceListSync
getTrustedDeviceListSync(): Array
<
DeviceInfo
>
...
...
@@ -256,12 +255,22 @@ getTrustedDeviceListSync(): Array<DeviceInfo>
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
-
返回值:
**返回值**
| 名称 | 说明 |
| -------------------------------------- | --------- |
| Array
<
[DeviceInfo](#deviceinfo)
>
| 返回可信设备列表。 |
-
示例:
**错误码**
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 11600101| Failed to execute the function. |
**示例**
```
js
try
{
var
deviceInfoList
=
dmInstance
.
getTrustedDeviceListSync
();
...
...
@@ -270,7 +279,6 @@ getTrustedDeviceListSync(): Array<DeviceInfo>
}
```
### getTrustedDeviceList<sup>8+</sup>
getTrustedDeviceList(callback:AsyncCallback
<
Array
<
DeviceInfo
>>
): void
...
...
@@ -318,12 +326,22 @@ getTrustedDeviceList(): Promise<Array<DeviceInfo>>
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
-
返回值:
**返回值**
| 类型 | 说明 |
| ---------------------------------------- | --------------------- |
| Promise
<
Array
<
[DeviceInfo](#deviceinfo)
>>
| Promise实例,用于获取异步返回结果。 |
-
示例:
**错误码**
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 11600101| Failed to execute the function. |
**示例**
```
js
dmInstance
.
getTrustedDeviceList
().
then
((
data
)
=>
{
console
.
log
(
'
get trusted device info:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -340,12 +358,22 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo)
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
-
返回值:
**返回值**
| 名称 | 说明 |
| -------------------------------------- | --------- |
| Array
<
[DeviceInfo](#deviceinfo)
>
| 返回本地设备列表。 |
-
示例:
**错误码**
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 11600101| Failed to execute the function. |
**示例**
```
js
try
{
var
deviceInfo
=
dmInstance
.
getLocalDeviceInfoSync
();
...
...
@@ -354,7 +382,6 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo)
}
```
### getLocalDeviceInfo<sup>8+</sup>
getLocalDeviceInfo(callback:AsyncCallback
<
DeviceInfo
>
): void
...
...
@@ -402,11 +429,21 @@ getLocalDeviceInfo(): Promise<DeviceInfo>
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
-
返回值:
**返回值**
| 类型 | 说明 |
| ---------------------------------------- | --------------------- |
| Promise
<
[DeviceInfo](#deviceinfo)
>
| Promise实例,用于获取异步返回结果。 |
**错误码**
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 11600101| Failed to execute the function. |
**示例**
-
示例:
```
js
dmInstance
.
getLocalDeviceInfo
().
then
((
data
)
=>
{
...
...
@@ -439,6 +476,7 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
| 401 | Input parameter error. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
| 11600104 | Discovery invalid. |
**示例**
...
...
@@ -486,6 +524,7 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
| 401 | Input parameter error. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
| 11600104 | Discovery invalid. |
**示例**
...
...
@@ -537,9 +576,11 @@ stopDeviceDiscovery(subscribeId: number): void
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
**示例**
...
...
@@ -571,9 +612,12 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
| 11600105 | Publish invalid. |
**示例**
...
...
@@ -612,9 +656,11 @@ unPublishDeviceDiscovery(publishId: number): void
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
**示例**
...
...
@@ -648,9 +694,12 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
| 11600103 | Authentication invalid. |
**示例**
...
...
@@ -698,9 +747,11 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
**示例**
...
...
@@ -712,7 +763,6 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void
}
```
### verifyAuthInfo
verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback
<
{
deviceId:
string
,
level:
number
}
>
): void
...
...
@@ -733,9 +783,11 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, le
以下的错误码的详细介绍请参见
[
分布式硬件子系统错误码
](
../errorcodes/errorcode-device-manager.md
)
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| -------
-
| --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
| 201 | Permission verify failed. |
| 11600101 | Failed to execute the function. |
| 11600102 | Failed to obtain the service. |
**示例**
...
...
@@ -758,7 +810,6 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, le
}
```
### on('deviceStateChange')
on(type: 'deviceStateChange', callback: Callback
<
{ action: DeviceStateChangeAction, device: DeviceInfo }
>
): void
...
...
@@ -781,7 +832,6 @@ on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -818,7 +868,6 @@ off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChang
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -855,7 +904,6 @@ on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: Dev
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -891,7 +939,6 @@ off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: D
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -927,7 +974,6 @@ on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: nu
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -963,7 +1009,6 @@ off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason:
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -999,7 +1044,6 @@ on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voi
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -1035,7 +1079,6 @@ off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): v
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -1071,7 +1114,6 @@ on(type: 'publishFail', callback: Callback<{ publishId: number, reason: numbe
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -1107,7 +1149,6 @@ off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: num
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -1143,7 +1184,6 @@ on(type: 'serviceDie', callback: () => void): void
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
@@ -1180,7 +1220,6 @@ off(type: 'serviceDie', callback?: () => void): void
| 类型 | 说明 |
| ------- | --------------------------------------------------------------- |
| 401 | Input parameter error. |
| 11600101| Failed to execute the function. |
**示例**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录