Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
cefc688b
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
提交
cefc688b
编写于
6月 25, 2023
作者:
史
史晓晓
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【dm】添加北向接口遗漏接口
Signed-off-by:
N
史晓晓
<
shixiaoxiao.30044129@huawei.com
>
上级
dc45d1e7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
111 addition
and
0 deletion
+111
-0
zh-cn/application-dev/reference/apis/js-apis-distributedDeviceManager.md
...on-dev/reference/apis/js-apis-distributedDeviceManager.md
+54
-0
zh-cn/release-notes/changelogs/OpenHarmony_4.0.9.2/changelogs-distributedDeviceManager.md
...penHarmony_4.0.9.2/changelogs-distributedDeviceManager.md
+57
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-distributedDeviceManager.md
浏览文件 @
cefc688b
...
...
@@ -1121,6 +1121,60 @@ off(type: 'discoverSuccess', callback?: Callback<{ subscribeId: number, device:
}
```
### on('deviceNameChange')
on(type: 'deviceNameChange', callback: Callback
<
{
deviceName:
string
}
>
): void;
注册设备名称改变回调监听。
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------ |
| type | string | 是 | 注册设备名称改变回调,以便在设备名称改变时通知应用程序。 |
| callback | Callback
<
{
deviceName:
string}
>
| 是 | 注册设备名称改变的回调方法。 |
**示例:**
```
js
try
{
dmInstance
.
on
(
'
deviceNameChange
'
,
(
data
)
=>
{
console
.
info
(
"
deviceNameChange on:
"
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
error
(
"
deviceNameChange errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
}
```
### off('deviceNameChange')
off(type: 'deviceNameChange', callback?: Callback
<
{
deviceName:
string
}
>
): void;
取消注册设备名称改变回调监听。
**系统能力**
:SystemCapability.DistributedHardware.DeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------ |
| type | string | 是 | 取消注册设备名称改变回调。 |
| callback | Callback
<
{
deviceName:
string}
>
| 否 | 指示要取消注册设备名称改变的回调方法。 |
**示例:**
```
js
try
{
dmInstance
.
off
(
'
deviceNameChange
'
,
(
data
)
=>
{
console
.
info
(
'
deviceNameChange
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
error
(
"
deviceNameChange errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
}
```
### on('discoverFail')
on(type: 'discoverFail', callback: Callback
<
{ subscribeId: number, reason: number }
>
): void
...
...
zh-cn/release-notes/changelogs/OpenHarmony_4.0.9.2/changelogs-distributedDeviceManager.md
0 → 100644
浏览文件 @
cefc688b
# 设备管理ChangeLog
## cl.distributedDeviceManager.1 接口变更
从Opeharmonny 4.0.9.2版本开始,新增了设备管理接口,部分接口仅系统应用可调用。
**变更影响**
原有的接口暂时可继续使用,但是停止维护,建议使用新接口进行开发。
**关键的接口/组件变更**
##新增接口如下:
| 模块名 | 类名 | 新增接口声明 | 是否支持三方应用调用 |
| ------------------------- | ------------------- | ------------------------------------------------------------ | ------------------------------- |
| @ohos.distributedDeviceManager | deviceManager |
**function**
createDeviceManager(bundleName: string, callback: AsyncCallback
<
DeviceManager
>
): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
releaseDeviceManager(): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getAvailableDeviceListSync(): Array
<
DeviceBasicInfo
>
| 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getAvailableDeviceList(callback:AsyncCallback
<
Array
<
DeviceBasicInfo
>>
): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getAvailableDeviceList(): Promise
<
Array
<
DeviceBasicInfo
>>
| 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getLocalDeviceNetworkIdSync(): string | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getLocalDeviceNameSync(): string | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getLocalDeviceTypeSync(): number | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getLocalDeviceIdSync(): string | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getDeviceNameSync(networkId: string): string; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
getDeviceTypeSync(networkId: string): number; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
startDeviceDiscovery(subscribeId: number, filterOptions?: string): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
stopDeviceDiscovery(subscribeId: number): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
bindDevice(deviceId: string, bindParam: BindParam, callback: AsyncCallback
<
{
deviceId:
string
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
unbindDevice(deviceId: string): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
publishDeviceDiscovery(publishInfo: PublishInfo): void | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
unPublishDeviceDiscovery(publishId: number): void | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback
<
{deviceId: string, level: number}
>
): void | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
setUserOperation(operateAction: number, params: string): void; | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback
<
{
registerInfo:
string
}
>
): void; | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
importCredential(credentialInfo: string, callback: AsyncCallback
<
{
resultInfo:
string
}
>
): void; | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
deleteCredential(queryInfo: string, callback: AsyncCallback
<
{
resultInfo:
string
}
>
): void; | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'deviceStatusChange', callback: Callback
<
{
action:
DeviceStatusChange
,
device:
DeviceBasicInfo
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'deviceStatusChange', callback?: Callback
<
{
action:
DeviceStatusChange
,
device:
DeviceBasicInfo
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'discoverSuccess', callback: Callback
<
{
subscribeId:
number
,
device:
DeviceBasicInfo
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'discoverSuccess', callback?: Callback
<
{
subscribeId:
number
,
device:
DeviceBasicInfo
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'deviceNameChange', callback: Callback
<
{
deviceName:
string
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'deviceNameChange', callback?: Callback
<
{
deviceName:
string
}
>
): void; | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'discoverFail', callback: Callback
<
{ subscribeId: number, reason: number }
>
): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'discoverFail', callback?: Callback
<
{ subscribeId: number, reason: number }
>
): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'serviceDie', callback: () =
>
void): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'serviceDie', callback?: () =
>
void): void | 是 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'uiStateChange', callback: Callback
<
{ param: string}
>
): void; | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'uiStateChange', callback?: Callback
<
{ param: string}
>
): void; | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'publishSuccess', callback: Callback
<
{ publishId: number }
>
): void | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'publishSuccess', callback?: Callback
<
{ publishId: number }
>
): void | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
on(type: 'publishFail', callback: Callback
<
{ publishId: number, reason: number }
>
): void | 否 |
| @ohos.distributedDeviceManager | deviceManager |
**function**
off(type: 'publishFail', callback?: Callback
<
{ publishId: number, reason: number }
>
): void | 否 |
**适配指导**
请参考各接口的
[
API参考
](
../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录