Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
23c928a6
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
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看板
未验证
提交
23c928a6
编写于
5月 18, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
!18257 【master】修改DMAPI接口详细描述
Merge pull request !18257 from 王旋璇/master
上级
f40809ad
e91e5ed6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
12 deletion
+16
-12
zh-cn/application-dev/reference/apis/js-apis-device-manager.md
.../application-dev/reference/apis/js-apis-device-manager.md
+16
-12
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-device-manager.md
浏览文件 @
23c928a6
...
@@ -199,7 +199,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager
...
@@ -199,7 +199,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| --------- | -------------------- | ---- | ---------- |
| --------- | -------------------- | ---- | ---------- |
| authType | number | 是 | 认证类型。 |
| authType | number | 是 | 认证类型。 |
| extraInfo | {[key:string]
:
any} | 否 | 认证参数可扩展字段。 |
| extraInfo | {[key:string]
:
any} | 否 | 认证参数可扩展字段。
可选,默认为undefined。
|
## AuthInfo
## AuthInfo
...
@@ -211,7 +211,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager
...
@@ -211,7 +211,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager
| --------- | -------------------- | ---- | ---------- |
| --------- | -------------------- | ---- | ---------- |
| authType | number | 是 | 认证类型。 |
| authType | number | 是 | 认证类型。 |
| token | number | 是 | 认证Token。 |
| token | number | 是 | 认证Token。 |
| extraInfo | {[key:string]
:
any} | 否 | 认证信息可扩展字段。 |
| extraInfo | {[key:string]
:
any} | 否 | 认证信息可扩展字段。
可选,默认为undefined。
|
## PublishInfo<sup>9+</sup>
## PublishInfo<sup>9+</sup>
...
@@ -487,6 +487,8 @@ getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): void
...
@@ -487,6 +487,8 @@ getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): void
```
js
```
js
try
{
try
{
// 设备网络标识,可以从可信设备列表中获取
let
networkId
=
"
xxxxxxx
"
dmInstance
.
getDeviceInfo
(
networkId
,
(
err
,
data
)
=>
{
dmInstance
.
getDeviceInfo
(
networkId
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
"
getDeviceInfo errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
console
.
error
(
"
getDeviceInfo errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
...
@@ -530,6 +532,8 @@ getDeviceInfo(networkId: string): Promise<DeviceInfo>
...
@@ -530,6 +532,8 @@ getDeviceInfo(networkId: string): Promise<DeviceInfo>
**示例:**
**示例:**
```
js
```
js
// 设备网络标识,可以从可信设备列表中获取
let
networkId
=
"
xxxxxxx
"
dmInstance
.
getDeviceInfo
(
networkId
).
then
((
data
)
=>
{
dmInstance
.
getDeviceInfo
(
networkId
).
then
((
data
)
=>
{
console
.
log
(
'
get device info:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
get device info:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
@@ -541,7 +545,7 @@ getDeviceInfo(networkId: string): Promise<DeviceInfo>
...
@@ -541,7 +545,7 @@ getDeviceInfo(networkId: string): Promise<DeviceInfo>
startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
发现周边设备。
发现周边设备。
发现状态持续两分钟,超过两分钟,会停止发现,最大发现数量99个。
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
...
@@ -585,7 +589,7 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
...
@@ -585,7 +589,7 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
发现周边设备。
发现周边设备。
发现状态持续两分钟,超过两分钟,会停止发现,最大发现数量99个。
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
...
@@ -594,7 +598,7 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
...
@@ -594,7 +598,7 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ------------------------------- | ---- | ----- |
| ------------- | ------------------------------- | ---- | ----- |
| subscribeInfo |
[
SubscribeInfo
](
#subscribeinfo
)
| 是 | 发现信息。 |
| subscribeInfo |
[
SubscribeInfo
](
#subscribeinfo
)
| 是 | 发现信息。 |
| filterOptions | string | 否 | 发现设备过滤信息。|
| filterOptions | string | 否 | 发现设备过滤信息。
可选,默认为undefined,发现未上线设备。
|
**错误码:**
**错误码:**
...
@@ -673,7 +677,7 @@ stopDeviceDiscovery(subscribeId: number): void
...
@@ -673,7 +677,7 @@ stopDeviceDiscovery(subscribeId: number): void
publishDeviceDiscovery(publishInfo: PublishInfo): void
publishDeviceDiscovery(publishInfo: PublishInfo): void
发布设备发现。
发布设备发现。
发布状态持续两分钟,超过两分钟会停止发布。
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
...
@@ -944,11 +948,11 @@ requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{regi
...
@@ -944,11 +948,11 @@ requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{regi
"
userId
"
:
"
123
"
"
userId
"
:
"
123
"
}
}
try
{
try
{
dm
Class
.
requestCredentialRegisterInfo
(
credentialInfo
,
(
data
)
=>
{
dm
Instance
.
requestCredentialRegisterInfo
(
credentialInfo
,
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
console
.
info
(
"
requestCredentialRegisterInfo result:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
requestCredentialRegisterInfo result:
"
+
JSON
.
stringify
(
data
));
}
else
{
}
else
{
console
.
info
.
push
(
"
requestCredentialRegisterInfo result: data is null
"
);
console
.
info
(
"
requestCredentialRegisterInfo result: data is null
"
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -995,11 +999,11 @@ importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: st
...
@@ -995,11 +999,11 @@ importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: st
]
]
}
}
try
{
try
{
dm
Class
.
importCredential
(
credentialInfo
,
(
data
)
=>
{
dm
Instance
.
importCredential
(
credentialInfo
,
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
console
.
info
(
"
importCredential result:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
importCredential result:
"
+
JSON
.
stringify
(
data
));
}
else
{
}
else
{
console
.
info
.
push
(
"
importCredential result: data is null
"
);
console
.
info
(
"
importCredential result: data is null
"
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -1031,11 +1035,11 @@ deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}
...
@@ -1031,11 +1035,11 @@ deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}
"
userId
"
:
"
123
"
"
userId
"
:
"
123
"
}
}
try
{
try
{
dm
Class
.
deleteCredential
(
queryInfo
,
(
data
)
=>
{
dm
Instance
.
deleteCredential
(
queryInfo
,
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
console
.
info
(
"
deleteCredential result:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
deleteCredential result:
"
+
JSON
.
stringify
(
data
));
}
else
{
}
else
{
console
.
info
.
push
(
"
deleteCredential result: data is null
"
);
console
.
info
(
"
deleteCredential result: data is null
"
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录